vanilophp / framework

The truly Laravel E-commerce Framework
https://vanilo.io
MIT License
810 stars 102 forks source link

A question for a Laravel 5.6 installation #18

Closed yokimpillay closed 6 years ago

yokimpillay commented 6 years ago

Hi there!

Thank you for the work you've put into creating this framework, it's very well built and nicely documented. :)

I have a question regarding setting Vanilo on a Laravel 5.6 installation.

How would you go about extending the \Konekt\AppShell\Models\User class with the Authenticatable trait that the standard LV 5.6 User extends?

Any guidance would be greatly appreciated!

fulopattila122 commented 6 years ago

As a general idea, create a local user class in your app: App\User that extends the original model, and the do whatever you want :)

The base class is being extended from Laravel as far as I see: https://github.com/artkonekt/user/blob/master/src/Models/User.php

Another approach is to use a completely replace the implementation with yours:

  1. Create your App\User class and make it to implement this interface: \Konekt\User\Contracts\User

  2. Register your variant:

    
    namespace App\Providers;

use Konekt\User\Contracts\User as UserContract;

class AppServiceProvider extends ServiceProvider { public function register() { $this->app->concord->registerModel(UserContract::class, \App\User::class); } }



Please let me know if it's clean/solves the problem.
yokimpillay commented 6 years ago

Hi Attila!

I did a bit of digging into the package source and saw that the base class is being extended as you say.

I will definitely keep what you've said in mind, thank you so much for the help! I think this is a great implementation that you've done.

Cheers!

fulopattila122 commented 6 years ago

Thx! We wanted to make it simple and flexible, so that if there are some parts you don't like, you can replace it easily.

Please report any issues if it still annoys you :)