
Laravel append URI in route
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
Answers 1
-
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); } }
0
Random Code Snippet Queries: Laravel
- Database transactions in laravel
- Fatal error: Uncaught Error: Class "Illuminate\Foundation\Application" not found
- Target class [admin] does not exist.
- Method Illuminate\Database\Eloquent\Collection::appends does not exist
- Page loader in laravel
- Get count of filter data, while return a small set of records
- How to run a specific seeder class in laravel
- How to check data inserted or deleted in pivot after toggle method
- Cannot end a section without first starting one
- How to get last record from object collection in laravel
- Remove several global scope from query
- On delete set foreign id column value null using migration in laravel 8
- Update if exist else insert new record in laravel
- How to call Laravel route in jQuery
- How to start websocket server in laravel
- Laravel csrf token mismatch for ajax POST Request
- How to upload image in laravel 8
- How to get tomorrow and yesterday date in laravel
- How to pass query string with pagination in laravel
- Use withCount() to Calculate Child Relationship Records
- Route group with URI prefix using middleware and route name prefixes
- Add class to body in laravel view
- How to create projects method with belongstomany relationship in user model
- How to insert dynamic values to additional column with pivot column in pivot table on multiple records
- Get the post details if it has at least one comment in comments table