mercredi 24 juillet 2019

recover the slug of a category linked to another category Laravel

I would like to recover the slug of 2 categories from my routes but can’t write the Controller.

My Route

Route::get('technicians/o/{occupation}/c/{city}', 'User\TechnicianController@viewoccupationcity');

My Controller

  public function viewoccupationcity($slug)
{

    $technicians = TechnicianResource::collection(occupation::where('slug',$slug)->firstOrFail()->technicians()
        ->with('city','occupation')
        ->latest()->get());
    return $technicians;
}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire