Laravel Tutorials
- What is laravel
- Laravel Installation
- Directory Structure
- htaccess
- Remove public from url
- Artisan Command
- Laravel Configuration
- Routing Configuration
- Namespaces
- Request
- Response
- Controller
- Model
- User Authentication
- Multi User Authentication
- Database Seeding
- Database
- Database Query
- ORM
- One-to-One Relationship
- One-to-Many Relationship
- Many to Many Eloquent Relationship
- Has One Through
- Has Many Through
- Querying Relations
- Middleware
- Laravel Views
- Blade Views
- Print data on view page
- Get Site URL
- Get URL Segment
- Get images from Storage folder
- Clear cache
- Form Class not found
- Flash Message in laravel
- Redirections
- path
- CRUD Projerct
- CRUD in Laravel
- CRUD progran
- Laravel Validation
- Jquery Validation
- Cookie
- Session
- Email Send in laravel
- File uploading
- CSRF Protection
- Helper in Laravel
- Helper Functions
- Guzzle Http Client
- Paypal Payment Gatway Integration
- Cron Job in laravel
- Flash message
- path
- Errors Handling
- Date Format
- Date Format Validation
- Display Image on View Page
- Update User Status using toggle button
- Delete Multiple Records using Checkbox in Laravel?
- Confirmation Before Delete Record
- Delete image from storage
- Remove/Trim Empty & Whitespace From Input Requests
- Block IP Addresses from Accessing Website
- How to Disable New User Registration in Laravel
- Redirect HTTP To HTTPS Using Laravel Middleware
- CKEditor
- slug generate unique
- Prevent Browser's Back Button After Logout
- Datatable dunamically
- encrypt & Decript
- Download File
- Rest API
- Shopping Cart
- Shopping Cart Example
- Dynamic Category-Subcategory Menu
- Ajax Search
- Interview Question
- laravel Tutorilal link
- laravel Tutorilal
Important Links
What is Laravel Redirections?
Named route is used to give specific name to a route. The name can be assigned using the “as” array key.
File name : index.php
Route::get('user/profile', ['as' => 'profile', function () {
//
}]);
Note − Here, we have given the name profile to a route user/profile.
Anchor Tag Redirection
File name : index.php
<a href="{!! url()->current() !!}">Current path</a>
OR
<a href="{!! url()->full() !!}">Full path</a>
OR
<a href="{!! url('/books/news') !!}">Relative to root path</a>
OUTSIDE EXAMPLE:
OR
<a href="{!! url('http://www.google.com') !!}">Path to google</a>
File name : index.php
<a href="{{url('/login')}}" class="nav-link"><span class="pcoded-micon"><i class="feather icon-server"></i></span><span class="pcoded-mtext">login</span></a>
File name : index.php
<a href="<?=URL::to('/registration')?>" ><span class="pcoded-micon"><i class="feather icon-file-text"></i></span><span class="pcoded-mtext">Registration</span></a>
Redirect to URL
return redirect('user/dashboard');
Redirect back to previous page in Laravel
return redirect()->back();
OR
return redirect()->back()->withInput();
Redirect to Named Routes in Laravel
return redirect()->route('home');
Redirect to Named Routes with parameters in Laravel
return redirect()->route('users', [1]);
Redirect to Controller Action in Laravel
return redirect()->action('App\Http\Controllers\UserController@index');
Redirect to Controller Action With Parameters in Laravel
return redirect()->action('App\Http\Controllers\UserController@index', ['id' => 1]);
Redirect with Flashed Session Data in Laravel
return redirect('home')->with('messgae', 'Welcome to ExpertPHP Tutorials!');
How to Redirect to External Link in Laravel?
return redirect()->away('http://www.itechxpert.in');
Redirect Route With Query String in laravel
redirect with success message or error message in laravel application. so we will use the redirect route with query string in laravel application.
File name : index.php
return redirect('/student')->with('success', 'Data has been added');
Redirect To URL
return redirect('');
Redirect with prarmeter
File name : index.php
return redirect('welcome
return redirect('admin/dashboard');
Redirect To Route
File name : index.php
return redirect()->route('posts.index');
File name : index.php
Route::get('post/{id}', 'PostController@edit')-name('post.edit');
We can return to this route using the below code snippet.
return redirect()->route('post.edit', ['id' => $post->id]);
If you have single parameter
File name : index.php
return redirect()->route('post.edit', $post->id);
Redirect with Data
File name : index.php
return redirect()->back()->with('success', 'Post saved successfully.');
chain multiple with() methods
File name : index.php
return redirect()->back()
->with('success', 'Post saved successfully.')
->with('post_id', $post->id);
File name : index.php
$response = [
'success' => 'Post saved successfully.',
'post_id' => $post->id,
];
return redirect()->back()->with($response);
Redirect to Controller Action
File name : index.php
return redirect()->action('PostController@store);
File name : index.php
return response()->action('PostController@edit', ['id' => $post->id]);
File name : index.php
File name : index.php
File name : index.php