resources kullanımı
|
1 |
php artisan make:controller Urunler --resource |
route web.php’ye
|
1 |
Route::resource('urun', 'Urunler'); |
birden fazla resources için
|
1 2 3 4 |
Route::resources([ 'urun' => 'Urunler', 'icerik' => 'IcerikController' ]); |
resources ürün controllerinin fonksiyonların linkleri ve tanımlamaları
| Verb | URI | Action | Route Name |
|---|---|---|---|
| GET | /urun |
index | urun.index |
| GET | /urun/create |
create | urun.create |
| POST | /urun |
store | urun.store |
| GET | /urun/{urunid} |
show | urun.show |
| GET | /urun/{urunid}/edit |
edit | urun.edit |
| PUT/PATCH | /urun/{urunid} |
update | urun.update |
| DELETE | /urun/{urunid} |
destroy | urun.destroy |
create = oluşturma
store = create sonrası post işlemi
show = ilgili id’ye göre gösterme
edit = ilgili id’ye göre düzenleme
update = ilgili id’ye göre update
destroy = silme işlemi