laravel route two methods code example
Example 1: laravel route multiple methods
Route::match(['get', 'post'], '/user', [
'uses' => 'AppController@user',
'as' => 'useraccess',
'roles'=> 'HomeController@useroles',
]);
Example 2: laravel route match
Route::match(['get', 'post'], '/', function () {
});
Route::any('/', function () {
});
Example 3: comment = Comment::find($this->route('comment')); in laravel
Schema::create('comments', function (Blueprint $table) {
$table->increments('id');
$table->integer('user_id')->unsigned();
$table->foreign('user_id')->references('id')->on('users')->onCascade('update')->onDelete('cascade');
$table->integer('post_id')->unsigned();
$table->foreign('post_id')->references('id')->on('users')->onCascade('update')->onDelete('cascade');
$table->text('comment');
$table->timestamps();
$table->rememberToken();
});