nWidart / laravel-modules

Module Management In Laravel
https://docs.laravelmodules.com
MIT License
5.43k stars 945 forks source link

How to call Modules::asset() func inside config files? #738

Closed anburocky3 closed 5 years ago

anburocky3 commented 5 years ago

I'm using SEO package . I need to setup an default image in the config/seotools.php. How to call the Modules::asset() func inside the config files?

Calling like: ' 'images' => \Module::asset('site:img/assets/banner.png') not working, throwing

Class 'Module' not found

nWidart commented 5 years ago

That's because laravel didn't register facades at that point.

You can't do this in a config file. Instead do it in a service provider for instance.

anburocky3 commented 5 years ago

Can you be elaborate on how to do that?

nWidart commented 5 years ago

You can set configuration values anywhere. like config()->set()

anburocky3 commented 5 years ago

Thank you. i have moved the default image into laravel original layout and now its working.. Another doubt? I created a model using the following command php artisan module:make-model Career Site it created Career model inside Entities folder. Now, how to call this model in my Http/SiteController.php ? Doing traditional way, is not working like: App\Career::first() Also please update the documentation regarding it.

nWidart commented 5 years ago

You call php classes like always, this is still PHP.