0

I have been used laravel, and I find it's by far the best PHP Framework there is. But even so, I still think that to be able to understand it and PHP MVC's in general, I need to make my own first.

So, as of now, I'm in the process of making my own MVC, I got most things covered. But I wanted to add a feature that is identical to Laravel, which is the Post-Redirect-Get feature, (or so I think).

What I mean is, for those unaware, that if a person visits a link, say localhost/project/laravel/public/profile using the Route::get('localhost/project/laravel/public/profile', 'SomeController@action) He will only be able to view the profile page, from the action() function in SomeController. But when he uses the Route::post('localhost/project/laravel/public/profile', 'SomeController@action2), only when does is the POST request sent from the localhost/project/laravel/public/profile URL, will the action2() function activate.

So, My question is,

How can I make my own Route::get() and Route::post() to work like in laravel

2
  • 1
    Laravel has the same relation to MVC as Democratic People's Republic of Korea has to democracy.
    – tereško
    Jan 23, 2018 at 10:57
  • What?, How is what you are saying related? I still dont get it
    – Pyr James
    Jan 23, 2018 at 20:31

1 Answer 1

0

If you want have get and post in the same route you should try this methods POST and GET in the same pattern

1
  • I am not using the Laravel, but I am making my own MVC Framework for which I want it to resemble laravel in the Post and get functionalities through the route class
    – Pyr James
    Jan 23, 2018 at 20:33

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.