How To Use Laravel Resource Route Code Example


Example 1: laravel route resources

// Implicit Model Binding Routes can be created with one line using either: Route::resource('photos', PhotoController::class); // OR Route::resources([ 	'photos' => PhotoController::class,     'posts' => PostController::class, ]);  php artisan make:controller PhotoController --resource --model=Photo   // makes a controller with stubouts for methods:   // index   // create   // store   // show   // edit   // update   // destroy

Example 2: how to named route resource laravel

Route::resource('faq', 'ProductFaqController', [     'names' => [         'index' => 'faq',         'store' => 'faq.new',         // etc...     ] ]);

Example 3: Route::resource

php artisan make:controller PhotoController --resource

Example 4: Route::resource

Route::resource('photos', PhotoController::class);

Comments

Popular posts from this blog

Converting A String To Int In Groovy

"Cannot Create Cache Directory /home//.composer/cache/repo/https---packagist.org/, Or Directory Is Not Writable. Proceeding Without Cache"

Android How Can I Convert A String To A Editable