Route tanımlarının aşağıdaki kodun en altında görülen cities route'unda cities.index route'unun parametreli olması gerekiyor.
Yani bir country_id almam ve o country_id'ye bağlı city'leri listelemem gerekiyor.
Dolayısı ile sanırım index metodunun parametreli olması lazım değil mi ?
"Resource'ları oluştur ancak index route'unu oluşturma, ben onu parametreli oluşturacağım" diyorum doğruysa (except)
Ama biliyorum ki bunun daha az saçma olan bir yöntemi vardır 🙂
Ne yapabilirim ?
// VERB URI ACTION ROUTE NAME
// ------------------------------------------------------------------------------
// GET /customers index customers.index
// GET /customers/create create customers.create
// POST /customers store customers.store
// GET /customers/{customer} show customers.show
// GET /customers/{customer}/edit edit customers.edit
// PUT/PATCH /customers/{customer} update customers.update
// DELETE /customers/{customer} destroy customers.destroy
Route::resource('customers', 'CustomerController');
Route::resource('countries', 'CountryController');
Route::resource('suppliers', 'SupplierController');
Route::resource('cities', 'CityController',['except' => ['index']]);
Route::get('cities/{id}','CityController@index')->name('cities.index');