I want to add some mutators on Voyager's User class, but I won't change anything inside vendor folder, and Voyages uses a User model inside the package. Is it possible for me to, somehow, change this?
相关问题
- Laravel Option Select - Default Issue
- Laravel 5.1 MethodNotAllowedHttpException on store
- Laravel - Implicit route model binding with soft d
- laravel : php artisan suddenly stop working
- How to execute MYSQL query in laravel?
相关文章
- laravel create model from custom stub when using p
- send redirect and setting cookie, using laravel 5
- How to send parameters to queues?
- Bcrypt vs Hash in laravel
- Laravel: What's the advantage of using the ass
- How to make public folder as root in Laravel?
- Input file in laravel 5.2?
- What is the difference between Session::set and Se
Simple enough. Modify the default Laravel User model to
Then you can update
app/config/voyager.php
as @aimme said and have it asThis way you bring in the power of Voyager's User model to your own with no hackery involved.
For most cases extending the vendor packages works fine.
Update voyager configuration
See
config/voyager.php
change user array like this. i have changed only
namespace
here,from voyager user tp App\User.but to bring additional changes you could try following way.
Loading whole voyager package as a local package.
To do that
1 - create a packages folder on the root of the project.
2 - clone the tcg/voyager repo into the packages folder or cut paste vendor tcg folder into packages folder that you created. so you will be having your directories like this
yourproject/packages/tcg/voyager
. if you have required tcg/voyager in composer.json remove it from there.3 - update composer.json file on the root of your project. add
TCG\\Voyager
autoload. see below sample, added the line inside psr-4.4 - run composer update
sometimes you might have to do
composer dump-autoload
after bringing changes to the packages.