0

I am trying to rewrite a with Laravel 4. previously I used Codeigniter. Usually I would do this in Codeigniter:

redirect('Controller/Function', 'Refresh');

and this would work on redirecting to that function of that controller. Here in laravel things seem different with all the routing happening. I saw many examples on the web and especially on the official laravel site docs & forum. I couldn't get what people are talking about.

Can someone please explain this as simple as possible?

really appreciated :)

1 Answer 1

3

As described here:

return Redirect::action('Controller@Function');

The methods in Redirect send the Location header with appropriate values. In the case of action it matches the URL in routes.php (where you define URL => 'Controller@Function' pairs) and fills in parameters if specified.

The difference between these frameworks is that CodeIgniter uses implicit routing conventions by default while Laravel uses explicit ones.

Implicit means that CodeIgniter will automatically define URL => 'Controller@Function' pairs with the URL part generated from the Controller@Function part.

Explicit means you have to define them yourself with the added benefit that you can rename routes at will as long as you use Redirect to generate redirect headers and URL to generate URLs in your views.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.