ModuleServiceProvider bindings not working
Created 5 years ago by pcosta94

In 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?

pcosta94  —  5 years ago Best Answer

Hi, The problem is solved. There was a missing import class in my ModuleServiceProvider file.

ryanthompson  —  5 years ago

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?

pcosta94  —  5 years ago

The addon is installed. I'm following your tutorial video about modules. @ryanthompson

pcosta94  —  5 years ago Best Answer

Hi, The problem is solved. There was a missing import class in my ModuleServiceProvider file.