vendredi 21 juillet 2017

ErrorException Missing required parameters laravel

I am having an issue by modifying the route for a view. I want instead of /company/id to show /company/id/name

the route:

Route::get('/company/{id}/{name}', 'PagesController@showCompany')->name('company.detail');

show method in controller:

public function showCompany($id){
        $company = Company::find($id);
        return view('company.show')->with('company', $company);
    }

and in the view $companies is from a search controller - and it should get the results with a link to open the view

 @foreach($companies as $company)
                <a href="">Show detail </a>
 @endforeach

if using only with id like /company/id works. What i am wrong?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire