
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 add columns in existing table using migration in laravel
- Class "App\Http\Controllers\Auth\Verified" not found
- Call to a member function getRelationExistenceQuery() on array in Laravel
- How to get IP address in laravel
- Print query in laravel
- How to pass data to multiple partial view files in laravel
- Call to a member function pluck() on array
- If condition in Laravel 9
- How to decrypt laravel password
- Ajax GET request in laravel
- Drop foreign key column in Laravel using migration
- Import/Use Storage facade in laravel
- Insert Comma Separated Values in laravel
- Cannot end a section without first starting one
- Create a record if not exist in laravel
- Display first n record from collection in laravel view
- Post model with title and body in laravel 8
- How to use or operator in laravel
- Include External CSS and JS file in Laravel
- Php artisan make model, factory, migration and controller in single command
- How to remove package from laravel
- How to create project_user pivot table in laravel
- If condition in foreach loop in laravel
- How to customize or Change validation error messages
- Laravel create default admin user