Laravel append URI in route
Created at 07-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 id of next record in laravel
- File_put_contents(/var/www/html/w3code/storage/framework/sessions/CXwN3EXKxERD6jgy3rADcaAAbAx8FRKih2JK7UO9): Failed to open stream: Permission denied
- How to get date from created_at field in laravel
- Laravel file size validation not working
- How to get only time from created_at in laravel
- Composer\Exception\NoSslException
- The Pusher library requires the PHP cURL module. Please ensure it is installed
- Class 'Facade\Ignition\IgnitionServiceProvider' not found
- How to check if user has created any post or not in laravel
- Conditional where clause in Laravel
- How to check data inserted or deleted in pivot after toggle method
- Order by multiple columns in Laravel
- InRandomOrder() method with example in laravel
- Best code example for create order in Laravel for ecommerce
- Get last week data in Laravel
- Get count of filter data, while return a small set of records
- Php artisan make model, factory, migration and controller in single command
- How to access the nth object from Laravel collection object ?
- How to get last year records count with month wise in Laravel
- Get Array of IDs from Eloquent Collection
- How to prevent host header attack in Laravel
- How to increment column value of table in Laravel
- How to upload image in laravel 8
- Root composer.json requires php ^7.3 but your php version (8.0.0) does not satisfy that requirement
- How to add class to tr in table using foreach in laravel