dimanche 27 août 2017

Laravel eloquent model binding for user, who can be a client, admin or producer

What would be a clean way to retrieve the role model

  • id: 1
  • name: sample name
  • email: email@email.com
  • password: pass
  • role_type: client
  • role_id: 3 ( points to the clients table)

  • id: 2
  • name: sample name2
  • email: email2@email.com
  • password: pass
  • role_type: producer
  • role_id: 3 ( points to the producer table)

Goal:

  • $user->role -> Client in first case
  • $user->role -> Producer in second case

Other solutions to achieve similar functionality are welcome



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2wTO0bn
via IFTTT

Aucun commentaire:

Enregistrer un commentaire