routing Flashcards
1
Q
get/post method
A
Route::get(‘/post’,[ControllerName::class,’methodName’])->name(‘post.create’)
Route::post(‘/post’,[ControllerName::class,’methodName’])
2
Q
Token in Laravel For Security
A
input type=”hidden” name=”_token” value=”{{ csrf_token( ) }}”
3
Q
Auth Group
A
Route::middleware(‘auth’)->group( function( ){
Route you want to authorize
} )
4
Q
routing methods
A
Route::get($uri, $callback); Route::post($uri, $callback); Route::put($uri, $callback); Route::patch($uri, $callback); Route::delete($uri, $callback); Route::options($uri, $callback);
5
Q
optional parameters
A
Route::get(‘/user/{name?}’, function ($name = null) {
return $name;
});
Route::get(‘/user/{name?}’, function ($name = ‘John’) {
return $name;
});