/**
  * Obtain the user information from $provider
  *
  * @return Response
  */
 public function handleProviderCallback($provider)
 {
     $user = Socialite::driver($provider)->user();
     $data = ['name' => $user->name, 'email' => 'info+' . $user->nickname . '@sapioweb.com', 'password' => bcrypt('oauthinstagram'), 'token' => $user->token, 'profile_id' => $user->id, 'avatar' => $user->avatar, 'username' => $user->nickname];
     $authUser = CrudHelper::createOrUpdate(new \App\User(), 'profile_id', $user->id, $data)->first();
     \Auth::login($authUser, true);
     return redirect()->route('home');
     // $user->token;
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function updateAd(Request $request, $id)
 {
     $program = $this->showProgram($id);
     $adData = ['program_ad_id' => $program->slug, 'program_ad_title' => $program->titleStrong, 'destination_url' => url('/', $program->slug), 'program_ad_image_url' => url('/') . '/uploads/ads/ad_' . $program->slug . '.jpg', 'program_ad_subtitle' => $program->title, 'program_ad_description' => $program->bullet2, 'program_ad_category' => 'real estate', 'contextual_keywords' => 'closing costs;home assistance;buying home;real estate;'];
     $ad = CrudHelper::createOrUpdate(new \App\Ad(), 'program_ad_id', $id, $adData);
     $ad = $ad->first();
     if (is_null($ad)) {
         return redirect()->route('program.ad.manager', $program->slug)->with(['fail_message' => 'There was an isue with the ad, try again later...']);
     }
     $ad = $ad->toArray();
     $program->ad()->sync([$ad['id']]);
     return redirect()->route('program.ad.manager', $program->slug)->with(['success_message' => 'Ad has been updated...']);
 }