예제 #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);
 }
예제 #2
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index($id)
 {
     $currentAccount = User::where('id', Auth::user()->id)->get()->first()->username;
     if ($id != 'select' && 'search') {
         $socialMediaAccount = SocialMediaAccount::findOrFail($id);
         $modelAccounts = ModelAccount::where('social_media_account_id', $id)->orderBy('sort_order', 'ASC')->get();
         $bladeVariables = compact('socialMediaAccount', 'modelAccounts', 'currentAccount');
         return view('set-user.search')->with($bladeVariables);
     } else {
         if (Auth::user()->id == 1) {
             $socialMediaAccounts = SocialMediaAccount::where('account_type', 'twitter')->get();
         } else {
             $socialMediaAccounts = SocialMediaAccount::where('user_id', Auth::user()->id)->get();
         }
         $bladeVariables = compact('socialMediaAccounts', 'currentAccount');
         return view('set-user.index')->with($bladeVariables);
     }
 }
예제 #3
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($user_id)
 {
     $user = User::where('id', $user_id);
     //         dd($user);
     $user->take(1)->delete();
     return redirect("/users");
 }