29.07.2016 Views

laravel-5

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

HTTP Routing 62<br />

.<br />

1 Route::group(['domain' => '{account}.myapp.com'], function () {<br />

2 Route::get('user/{id}', function ($account, $id) {<br />

3 //<br />

4 });<br />

5 });<br />

Route Prefixes<br />

The prefix group array attribute may be used to prefix each route in the group with a given URI.<br />

For example, you may want to prefix all route URIs within the group with admin:<br />

.<br />

1 Route::group(['prefix' => 'admin'], function () {<br />

2 Route::get('users', function () {<br />

3 // Matches The "/admin/users" URL<br />

4 });<br />

5 });<br />

You may also use the prefix parameter to specify common parameters for your grouped routes:<br />

.<br />

1 Route::group(['prefix' => 'accounts/{account_id}'], function () {<br />

2 Route::get('detail', function ($account_id) {<br />

3 // Matches The accounts/{account_id}/detail URL<br />

4 });<br />

5 });<br />

CSRF Protection<br />

Introduction<br />

Laravel makes it easy to protect your application from cross-site request forgeries⁴⁶. Cross-site<br />

request forgeries are a type of malicious exploit whereby unauthorized commands are performed<br />

on behalf of the authenticated user.<br />

⁴⁶http://en.wikipedia.org/wiki/Cross-site_request_forgery

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!