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

tereško
  • 58,060
  • 25
  • 98
  • 150
Pyr James
  • 711
  • 1
  • 6
  • 10

1 Answers1

0

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

Kuba Zabielski
  • 146
  • 2
  • 10
  • 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 '18 at 20:33