Join Joseph Lowery for an in-depth discussion in this video Working with redirects, part of Laravel 4 Essential Training.
- Life isn't always a straight line in webs apps,…much less life itself,…and sometimes you need to redirect your traffic temporarily.…Laravel has a custom function…that handles such scenarios…with a great deal of flexibility.…Let me show you a couple of examples.…If you just need to redirect one path request to another,…you'll want to use the redirect function…with the to method.…I'll scroll down towards the bottom here…and create a new route, again, using the get method.…
Now, let's say, for example, that for whatever reason…people are going to the where path…when they really need directions.…So, we could set this up as another route,…but since it's intended to be a temporary redirect,…we'll use the function for just that purpose.…So, after I've specified my path of where,…I'll put in beginnings of my closure, function.…and I want a return,…this time a Redirect…with the to method, and then specify…where I want that to go.…
And when you use Redirect::to…you specify the path.…A semicolon here, a semicolon there,…and we're done.…
Need a quick dive into Laravel? Check out this short primer, Up and Running with Laravel.
- Installing Laravel and Composer
- Routing requests
- Filtering routes
- Incorporating advanced controllers
- Creating a basic Blade template
- Developing a layout with child pages and forms
- Integrating a database
- Creating tables via migrations
- Outputting data
- Building a Laravel app
- Authenticating users
- Deploying Laravel code
Skill Level Intermediate
1. Introduction to Laravel
2. Fundamental Laravel Concepts
3. Outputting Laravel Code
4. Integrating Databases
5. Querying Data with Eloquent ORM
6. Building a Laravel App
7. Deploying Your Laravel Code
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.