ModuleServiceProvider bindings not working
Created 5 years ago by pcosta94In my ServiceProvider i have this:
protected $routes = [ 'videos' => 'Anomaly\VideosModule\Http\Controller\VideosController@index', 'videos/watch/{slug}' => [ 'as' => 'anomaly.module.videos::videos.view', 'uses' => 'Anomaly\VideosModule\Http\Controller\VideosController@view' ], ];
And I have the bindings: protected $bindings = [ VideosCategoriasEntryModel::class => CategoriaModel::class, VideosSeriesEntryModel::class => SeriesModel::class, VideosVideosEntryModel::class => VideoModel::class ];
But in twig when I do this: {{ html_link(video.route('view'), video.description) }} The link don't go to the route but to base route of mywebsite.
Can anyone help me?
Can you confirm your service provider is running? The addon is installed/enabled? Maybe add a register
method and dd()
in it to confirm. This is in your addons/
directory then?
The addon is installed. I'm following your tutorial video about modules. @ryanthompson
Hi, The problem is solved. There was a missing import class in my ModuleServiceProvider file.