When a user is logged in and I dd the user I get an all the properties of the current user on screen.
$testing = $request->user();
dd($testing);
The user object:
User {#596 ▼
#table: "users"
+primaryKey: "id"
#fillable: array:3 [▶]
#hidden: array:2 [▶]
#connection: "mysql"
#keyType: "int"
+incrementing: true
#with: []
#withCount: []
#perPage: 15
+exists: true
+wasRecentlyCreated: false
#attributes: array:9 [▶]
#original: array:9 [▶]
#changes: []
#casts: []
#dates: []
#dateFormat: null
#appends: []
#dispatchesEvents: []
#observables: []
#relations: []
#touches: []
+timestamps: true
#visible: []
#guarded: array:1 [▶]
#rememberTokenName: "remember_token"
}
How can I access for example the #attributes array from the controller if I want to use any attribute to run user checks in the controller methods?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire