Friday, November 6, 2015

CRUD Models

Route-Model binding 

In the RouteServiceProvider.php file, add the following file to link cat
$router->model('cat', 'Furbook\Cat');

Using Forms

In the require section of composer.json, add the following code to use common HTML and form elements and then run composer update

"laravelcollective/html": "5.0.*"

This will install the package. Next, we need to register the service provider and façades. Open config/app.php and add the following the $providers array:

Collective\Html\HtmlServiceProvider::class,

Then add the following two lines to the $alias array:

'Form'      => Collective\Html\FormFacade::class,'Html'      => Collective\Html\HtmlFacade::class,

Create a new controller class from root
php artisan make:controller CatController

No comments:

Post a Comment