lundi 16 mai 2016

Laravel 5 - Slug implementation

I am hitting a roadblock with slug and so seeking your expert advice.

We have a drivers table, cars table, fleet-owners table.
- drivers have cars
- fleet owners have drivers who have cars I am trying to create slug as follows:

http://ift.tt/200ja5R  
http://ift.tt/259qXW8  
http://ift.tt/200j6mF

In my webapp, I implemented the slug using eloquent-sluggable from [http://ift.tt/259qROc] as following with respective the trait.

In the driver model I have create a sluggable method as below

protected $sluggable = [
        'build_from' => 'user.name',
        'save_to'    => 'slug',
    ];

For drivers, it uses user.name and saves the respective slug and it works as expected for both drivers and cards.

But for fleet owners, I am not able to do this, since for a fleet owner, the driver's name is stored as driver name but I am not able to reference this name or create slug for this.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire