コード例 #1
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     if (Auth::user()->id == 1) {
         $socialMediaAccounts = SocialMediaAccount::orderBy('account_type', "DESC")->get();
     } else {
         $socialMediaAccounts = SocialMediaAccount::where('user_id', Auth::user()->id)->get();
     }
     $currentAccount = User::where('id', Auth::user()->id)->get()->first()->username;
     $bladeVariables = compact('socialMediaAccounts', 'currentAccount');
     return view('accounts.index')->with($bladeVariables);
 }