03.12.2015 Views

laravel4cookbook

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Access Control List 39<br />

.<br />

This file should be saved as app/views/group/index.blade.php.<br />

The first view is the index view. This should list all the groups that are in the database. We extend<br />

the layout as usual, defining a content block for the markup specific to this page.<br />

The main idea is to iterate over the group records, but before we do that we first check if there are<br />

any groups. After all, we don’t want to go to the trouble of showing a table if there’s nothing to put<br />

in it.<br />

If there are groups, we create a (rough) table and iterate over the groups; creating a row for each.<br />

We finish off the view by adding a link to create a new group.<br />

1 Route::any("/group/index", [<br />

2 "as" => "group/index",<br />

3 "uses" => "GroupController@indexAction"<br />

4 ]);<br />

.<br />

This was extracted from app/routes.php.<br />

1

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

Saved successfully!

Ooh no, something went wrong!