Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
All resource routes by action, with route names. (Laravel Snippet)
<snippet>
<content><![CDATA[
Route::get('${1:resource}', [ 'uses' => '${3:Controller}@index', 'as' => '${1:resource}.index']);
Route::get('${1:resource}/create', [ 'uses' => '${3:Controller}@create' , 'as' => '${1:resource}.create']);
Route::post('${1:resource}', [ 'uses' => '${3:Controller}@store', 'as' => '${1:resource}.store']);
Route::get('${1:resource}/{${2:resource}}', [ 'uses' => '${3:Controller}@show' , 'as' => '${1:resource}.show']);
Route::get('${1:resource}/{${2:resource}}/edit', [ 'uses' => '${3:Controller}@edit' , 'as' => '${1:resource}.edit']);
Route::patch('${1:resource}/{${2:resource}}', [ 'uses' => '${3:Controller}@update' , 'as' => '${1:resource}.update']);
Route::delete('${1:resource}/{${2:resource}}', [ 'uses' => '${3:Controller}@destroy', 'as' => '${1:resource}.destroy']);
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>Routes</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.php</scope>
</snippet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment