Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Laravel Resource - Sublime Text 2 Snippet
<snippet>
<content><![CDATA[
// ${1} Resource
Route::get('${1}s', array('as' => '${1}s', 'uses' => '${1}s@index'));
Route::get('${1}s/(:any)', array('as' => '${1}', 'uses' => '${1}s@show'));
Route::get('${1}s/new', array('as' => 'new_${1}', 'uses' => '${1}s@new'));
Route::get('${1}s/(:any)edit', array('as' => 'edit_${1}', 'uses' => '${1}s@edit'));
Route::post('${1}s', '${1}s@create');
Route::put('${1}s/(:any)', '${1}s@update');
Route::delete('${1}s/(:any)', '${1}s@destroy');
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>resource</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.php</scope>
</snippet>
@SimonJ

This comment has been minimized.

Show comment Hide comment
@SimonJ

SimonJ Sep 29, 2012

Thanks ! :)

SimonJ commented Sep 29, 2012

Thanks ! :)

@drfraker

This comment has been minimized.

Show comment Hide comment
@drfraker

drfraker Oct 11, 2012

Jeffrey,

I'm confused by line #7, should there be a "/" between (:any)edit? So that it is (:any)/edit? If not why not, it doesn't seem like that creates a proper url.

Thanks for this though.

Dustin

Jeffrey,

I'm confused by line #7, should there be a "/" between (:any)edit? So that it is (:any)/edit? If not why not, it doesn't seem like that creates a proper url.

Thanks for this though.

Dustin

@RomainGoncalves

This comment has been minimized.

Show comment Hide comment
@RomainGoncalves

RomainGoncalves Oct 24, 2012

Agreed with drfraker.

In the video there's a /

Agreed with drfraker.

In the video there's a /

@meSingh

This comment has been minimized.

Show comment Hide comment
@meSingh

meSingh Jan 31, 2013

drfraker is right and here is the fixed version for it
https://gist.github.com/4683029

meSingh commented Jan 31, 2013

drfraker is right and here is the fixed version for it
https://gist.github.com/4683029

@mavinothkumar

This comment has been minimized.

Show comment Hide comment
@mavinothkumar

mavinothkumar Oct 16, 2014

Hi

Can you please tell me how to use this, I tried by

Tools -> New Snippet -> and pasted that code there and saved in desktop. Kindly suggest me how to do this.

Hi

Can you please tell me how to use this, I tried by

Tools -> New Snippet -> and pasted that code there and saved in desktop. Kindly suggest me how to do this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment