samedi 4 juin 2016

Laravel 5.1: Controller use variable from method [Get]

I have code in route.php

Route::get('website/{post}/{comment}', ['uses'=>'MainController@add']);

In file MainController:

public function add(Requests $request){
    $data = $request->all();
    echo $data['post'];
    echo $data['comment'];
}

Can i do like this? If i can, help me fix it.

Thank you!



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire