Last active
June 16, 2021 08:08
-
-
Save sam-ngu/c82383172be8524fdd337ba4cccf26bb to your computer and use it in GitHub Desktop.
Revisions
-
sam-ngu revised this gist
Jun 16, 2021 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -12,6 +12,8 @@ Route::get('/users', [\App\Http\Controllers\UserController::class, 'index']) ->name('index'); // Once we defined the 'namespace' attribute, we can invoke our controller method // by using the <controller_class>@<method> string Route::post('/users', 'UserController@store') ->name('store'); -
sam-ngu revised this gist
Jun 16, 2021 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,8 +5,8 @@ 'auth:api', \App\Http\Middleware\RedirectIfAuthenticated::class, ], 'prefix' => 'heyaa', // adding url prefix to all routes in this group 'as' => 'users.', // adding route name prefix to all routes in this group 'namespace' => "\App\Http\Controllers", ], function(){ Route::get('/users', [\App\Http\Controllers\UserController::class, 'index']) -
sam-ngu revised this gist
Jun 16, 2021 . 2 changed files with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,5 @@ <?php // using array syntax Route::group([ 'middleware' => [ 'auth:api', This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,5 @@ <?php // using method syntax Route::middleware([ 'auth:api', \App\Http\Middleware\RedirectIfAuthenticated::class, -
sam-ngu revised this gist
Jun 16, 2021 . 2 changed files with 24 additions and 8 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,9 +8,19 @@ 'as' => 'users.', // adding url name 'namespace' => "\App\Http\Controllers", ], function(){ Route::get('/users', [\App\Http\Controllers\UserController::class, 'index']) ->name('index'); Route::post('/users', 'UserController@store') ->name('store'); Route::get('/users/{user}', [\App\Http\Controllers\UserController::class, 'show']) ->name('show'); Route::patch('/users/{user}', [\App\Http\Controllers\UserController::class, 'update']) ->name('update'); Route::delete('/users/{user}', [\App\Http\Controllers\UserController::class, 'destroy']) ->name('destroy'); }); This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -14,7 +14,13 @@ Route::get('/users/{user}', [\App\Http\Controllers\UserController::class, 'show']) ->name('show'); Route::post('/users', [\App\Http\Controllers\UserController::class, 'store']) ->name('store'); Route::patch('/users/{user}', [\App\Http\Controllers\UserController::class, 'update']) ->name('update'); Route::delete('/users/{user}', [\App\Http\Controllers\UserController::class, 'destroy']) ->name('destroy'); }); -
sam-ngu revised this gist
Jun 16, 2021 . 2 changed files with 2 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -11,4 +11,6 @@ Route::get('/users', [\App\Http\Controllers\UserController::class, 'index'])->name('index'); Route::post('/users', 'UserController@store')->name('store'); Route::get('/users/{user}', [\App\Http\Controllers\UserController::class, 'show'])->name('show'); Route::patch('/users/{user}', [\App\Http\Controllers\UserController::class, 'update'])->name('update'); Route::delete('/users/{user}', [\App\Http\Controllers\UserController::class, 'destroy'])->name('destroy'); }); This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -14,10 +14,7 @@ Route::get('/users/{user}', [\App\Http\Controllers\UserController::class, 'show']) ->name('show'); Route::post('/users', [\App\Http\Controllers\UserController::class, 'store'])->name('store'); Route::patch('/users/{user}', [\App\Http\Controllers\UserController::class, 'update'])->name('update'); Route::delete('/users/{user}', [\App\Http\Controllers\UserController::class, 'destroy'])->name('destroy'); }); -
sam-ngu created this gist
Jun 16, 2021 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,14 @@ <?php Route::group([ 'middleware' => [ 'auth:api', \App\Http\Middleware\RedirectIfAuthenticated::class, ], 'prefix' => 'heyaa', // adding url prefix to all route in this group 'as' => 'users.', // adding url name 'namespace' => "\App\Http\Controllers", ], function(){ Route::get('/users', [\App\Http\Controllers\UserController::class, 'index'])->name('index'); Route::post('/users', 'UserController@store')->name('store'); Route::get('/users/{user}', [\App\Http\Controllers\UserController::class, 'show'])->name('show'); }); This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,23 @@ <?php Route::middleware([ 'auth:api', \App\Http\Middleware\RedirectIfAuthenticated::class, ]) ->name('users.') // you can use the as() method here as well ->namespace("\App\Http\Controllers") ->prefix('heyaa') ->group(function () { Route::get('/users', [\App\Http\Controllers\UserController::class, 'index']) ->name('index'); Route::get('/users/{user}', [\App\Http\Controllers\UserController::class, 'show']) ->name('show'); Route::post('/users', [\App\Http\Controllers\UserController::class, 'store'])->name('store'); Route::patch('/users/{user}', [\App\Http\Controllers\UserController::class, 'update'])->name('update'); Route::delete('/users/{user}', [\App\Http\Controllers\UserController::class, 'destroy'])->name('destroy'); });