Esempio n. 1
0
 public function getProfileAttribute()
 {
     $profile = $this->profile()->first();
     if (!$profile) {
         $profile = Profile::defaultRecord();
         $this->profile()->save($profile);
     }
     return $profile;
 }
 public static function loginProfile()
 {
     if (Auth::user()) {
         if (!isset(Profile::$login_profile)) {
             if (Auth::user()->profile()->count() == 0) {
                 Auth::user()->profile()->save(Profile::defaultRecord());
             }
             Profile::$login_profile = Auth::user()->profile->first();
         }
     } else {
         Profile::$login_profile = Profile::defaultRecord();
     }
     return Profile::$login_profile;
 }