lundi 29 février 2016

Creating Follower & Following relationships in Laravel 5

Im trying to create a function in laravel that will return all the user's followers through Laravel's dynamic property. It should look something like this:$user->followers.

I also have the following table structures:

--users--
id pk

--follows--
follower pk,fk
following pk,fk

I was trying to use the hasManyThrough function in the model but I haven seen an example in the documentation that lets me specify a custom primary key aside from an incremental id.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire