/**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $googleId = Google::findOrFail($id);
     $googleId->delete($id);
     flash()->success('Gelukt!', 'Uw google ID is verwijderd!');
     return redirect('admin/google/analytics');
 }
Esempio n. 2
0
 public function postLoginGoogle()
 {
     $accessToken = session('google_access_token');
     $gg = new Google();
     $userGG = $gg->getUserInfo($accessToken);
     $test = new User();
     if (!$test->findEmail($userGG->email)) {
         $user = new User();
         $user->name = $userGG->name;
         $user->email = $userGG->email;
         $user->save();
     }
     Session::put('user_name', $userGG->name);
     Session::put('user_email', $userGG->email);
     return redirect('/');
 }
Esempio n. 3
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($slug)
 {
     $article = Article::where('slug', $slug)->firstOrFail();
     $articleSide = DB::select("select title, slug, image_lead\n                                   from articles\n                                   WHERE ID !='{$article->id}' limit 5;");
     $googlePhrahes = Google::limit(30)->orderBy('id', 'DESC')->get();
     return view('article', compact('article', 'articleSide', 'googlePhrahes'));
 }
Esempio n. 4
0
 public function saveAccessToken()
 {
     $gg = new Google();
     if (isset($_GET['code'])) {
         $result = $gg->callback($_GET['code']);
         $accessToken = $result->access_token;
     }
     if (isset($accessToken)) {
         Session::put('google_access_token', $accessToken);
     }
     if (session('redirectPath')) {
         return redirect(session('redirectPath'));
     } else {
         return redirect('/');
     }
 }
Esempio n. 5
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $medsASC = Meds::limit(15)->offset(0)->orderBy('id', 'ASC')->get();
     $medsDESC = Meds::limit(15)->offset(0)->orderBy('id', 'DESC')->get();
     $medsRAND = Meds::limit(15)->orderByRaw("RAND()")->get();
     $googlePhrahes = Google::limit(30)->orderBy('id', 'DESC')->get();
     $articles = Article::limit(30)->orderBy('id', 'DESC')->get();
     return view('index', compact('articles', 'medsASC', 'medsDESC', 'medsRAND', 'googlePhrahes'));
 }
 /**
  * Bootstrap any application services.
  *
  * @return void
  */
 public function boot()
 {
     view()->composer('admin.google.partials.id', function ($view) {
         $view->with('googleId', Google::latest()->first());
     });
 }