前提・実現したいこと
こんにちは、今laravelでログイン制のとあるシステムをつくってまして、
そこの上部のナビバーの左側にログインしてる人のemailを表示したいのです。
そこで$user = Auth::getuser();としたあと$email = $user->email;で
取得しようとしたのですが$emailの値は0となってしまいできませんでした。
柿に$userの値を載せますのでどのように書けばこの中にあるemailの値を
取得できるか教えていただけると幸いです。
追記:認証に使ってるテーブルはデフォルトのUserテーブルではなく
独自に用意されたUsersテーブルを使っています。
Users {#219 ▼ #fillable: array:2 [▼ 0 => "email" 1 => "password" ] #table: "users" #primaryKey: "email" #connection: "mysql" #keyType: "int" +incrementing: true #with: [] #withCount: [] #perPage: 15 +exists: true +wasRecentlyCreated: false #attributes: array:4 [▼ "email" => "(登録してあるemail)" "password" => "(登録してあるpassword)" "updated_at" => "2019-02-26 17:03:46" "created_at" => "2019-02-26 17:03:46" ] #original: array:4 [▼ "email" => "(登録してあるemail)" "password" => "(登録してあるpassword)" "updated_at" => "2019-02-26 17:03:46" "created_at" => "2019-02-26 17:03:46" ] #changes: [] #casts: [] #dates: [] #dateFormat: null #appends: [] #dispatchesEvents: [] #observables: [] #relations: [] #touches: [] +timestamps: true #hidden: [] #visible: [] #guarded: array:1 [▼ 0 => "*" ] #rememberTokenName: "remember_token" }
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2019/02/27 07:34