samedi 3 octobre 2015

laravel , getting Auth::user() table name

laravel version : 5.0

Im currently making admin login middleware in laravel.

im using laravel default authentication out of its box. in this state, i have succesfully logged in.

as i know, i can get the user id by doing Auth::User()->id;, but the problem : i cant find way to retrive the table name;

below this is the result if i execute dd(Auth::User());

as you can see it cointains information #table:"admins"

Admin {#177 ▼
  #table: "admins"
  #fillable: array:3 [▶]
  #hidden: array:2 [▶]
  #connection: null
  #primaryKey: "id"
  #perPage: 15
  +incrementing: true
  +timestamps: true
  #attributes: array:7 [▶]
  #original: array:7 [▶]
  #relations: []
  #visible: []
  #appends: []
  #guarded: array:1 [▶]
  #dates: []
  #casts: []
  #touches: []
  #observables: []
  #with: []
  #morphClass: null
  +exists: true
}

im trying to look for it from laravel documentation and search in stackoverflow, seems like i get nothin.

what method i need to call from Auth:: to obtain the table name? thank you for your help



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire