
Laravel append URI in route
Created at 06-Sep-2021 ,
By samar
Laravel append URI in route
In this session, we are going to try to solve the "Laravel append URI in route" puzzle by using the computer language.
You can append URI in route using comma separated array value to route. You can redirect to generated query string URL using redirect on controller action and using anchor tag in view file-
Pass query string to url using named route in laravel
<?php <a href="{{ route('searchResult', ['keyword' => 'samar']) }}"> URL with query string </a> //OutputĀ <a href="http://localhost:8000/search/all?keyword=samar" target="_blank" rel="noopener">http://localhost:8000/search/all?keyword=samar</a> //Step by step code implementation //# Create route in web.php use App\Http\Controllers\SearchController; Route::get('/search/all/', [SearchController::class, 'getAllSearchResult'])->name('searchResult'); //Create SearchController if not exists with method getAllSearchResult php artisan make:controller SearchController //#Create controller method //app\Http\Controllers\SearchController.php <?php namespace App\Http\Controllers; use Illuminate\Http\Request; class SearchController extends Controller { public function getAllSearchResult(){ $getQueryString=\Request::fullUrl(); dd($getQueryString); } }
If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.
Don't forget to share this article! Help us spread the word by clicking the share button below.
We appreciate your support and are committed to providing you valuable and informative content.
We are thankful for your never ending support.
Random Code Snippet Queries: Laravel
- How to get route method name in Laravel
- Permission denied error while creating storage link in Laravel
- Laravel recursive function in controller
- How to upload multiple images after preview in laravel using cropper js
- Json encode method in laravel
- Insert dummy data in users table Laravel
- How to get tomorrow and yesterday date in laravel
- Call to undefined method Illuminate\Support\Facades\Request::all()
- Get latest record by created at in Laravel
- Non-static method App\Http\Helper::myFunction() should not be called statically
- How to get column names from table in Laravel
- How to send email in laravel
- Send OTP using textlocal api in laravel
- Class 'Facade\Ignition\IgnitionServiceProvider' not found
- How to insert multiple rows in mysql using loop in laravel?
- Call to a member function update() on null
- Laravel API response format
- Cannot end a section without first starting one
- Delete records with relationship in laravel
- Laravel insert query not working
- Generate unique username in Laravel
- Class 'App\Http\Controllers\User' not found
- How to use more than one query scope in Laravel
- Ajax POST request in laravel
- Update last created record in Laravel