Laravel dependency injection not working
Change the injected variable name to $event
to match the route parameter name {event}
:
public function show(SchoolEvent $event)
You can see the route parameters with this command:
php artisan route:list
Change the model name to Event
to make model binding work.
Since the
$user
variable is type-hinted as theApp\User
Eloquent model and the variable name matches the{user}
URI segment, Laravel will automatically inject the model instance that has an ID matching the corresponding value from the request URI