Route::get('entity/{id}', 'EntityController@edit');
class EntityController {
public function edit(Entity $id)
{
//code
}
}
$id->remove();
// Provider
$toute->bind('my_model', Blog::class);
// Route
Route::get('entity/{my_model}', 'EntityController@edit');
// Controller
class EntityController {
public function edit(Blog $model)
{
//code
}
}
Find more questions by tags Laravel
$id->remove();
. Call a spade a spade. As well easier. $entity->remove(); - jules_Nolan10 commented on July 9th 19 at 13:55In this example, since the Eloquent type-hinted the $user variable defined on the route matches the {user} segment in the route''s URI, Laravel will automatically inject the model instance that has an ID matching the corresponding value from the request URI. - jules_Nolan10 commented on July 9th 19 at 14:04