public function ajaxAuth(Request $request)
 {
     $login = $this->login($request);
     $sessionData = $login->getSession();
     if (!is_null($sessionData->get('errors'))) {
         $errors = $sessionData->get('errors')->toJson();
         return $sessionData->get('errors')->toJson();
     }
     $response = new \Illuminate\Http\Response();
     $response->withCookie(cookie()->forget('propertyViews'));
     return $response;
 }
 public function login(Request $request)
 {
     $res = $request->input("response");
     $check = User::CheckUser($res['id']);
     if ($check == false) {
         //tài khoàn fb người dùng chưa đăng kí
         $result = User::CreateUser($res);
         $response = new \Illuminate\Http\Response(view('layout.index'));
         $response->withCookie(cookie()->forever('user', $result));
     } else {
         $response = new \Illuminate\Http\Response(view('layout.index'));
         $response->withCookie(cookie()->forever('user', $check));
     }
 }
Пример #3
0
 public function deleteFavoriteFromCookie($request)
 {
     $response = new \Illuminate\Http\Response('adding favorite');
     $favorites = json_decode($request->cookie('favorites'), true);
     $post_id = intval($request->input('post_id'));
     if ($favorites) {
         $post_position = array_search($post_id, $favorites);
         if ($post_position !== false) {
             unset($favorites[$post_position]);
             $response->withCookie(cookie()->forever('favorites', json_encode($favorites, JSON_FORCE_OBJECT)));
         }
     }
     return $response;
 }
 public function showSingleProperties(Request $request, $listingId)
 {
     $property = \App\Property::where('MLSNumber', '=', $listingId)->with('propertyImages')->first();
     if (is_null($property)) {
         return redirect()->route('properties')->with('error_message', 'Property is no longer available');
     }
     $amentities = $this->getAmentities($property);
     $geocode = new Geocode();
     $address = $property['StreetNumber'] . ' ' . $property['StreetName'] . ' ' . $property['City'] . ' ' . $property['StateOrProvince'] . ' ' . $property['PostalCode'];
     $geoLocation = $geocode->getCoordinates($address);
     switch (true) {
         case !is_null($request->cookie('propertyViews')):
             if (!\Auth::check()) {
                 $this->views = $this->views + (int) $request->cookie('propertyViews');
                 if ($this->views > 0) {
                     $response = new \Illuminate\Http\Response(view('pages.propertyDetailSubscribe')->with(['property' => $property, 'communities' => $this->communities, 'amentities' => $amentities, 'geoLocation' => isset($geoLocation['geometry']) ? $geoLocation['geometry']['location'] : []]));
                 }
                 $response->withCookie(cookie()->forever('propertyViews', $this->views + 1));
             } else {
                 $response = new \Illuminate\Http\Response(view('pages.propertyDetail')->with(['property' => $property, 'communities' => $this->communities, 'amentities' => $amentities, 'geoLocation' => isset($geoLocation['geometry']) ? $geoLocation['geometry']['location'] : [], 'recent' => $this->recent]));
                 $response->withCookie(cookie()->forget('propertyViews'));
             }
             break;
         default:
             $response = new \Illuminate\Http\Response(view('pages.propertyDetail')->with(['property' => $property, 'communities' => $this->communities, 'amentities' => $amentities, 'geoLocation' => isset($geoLocation['geometry']) ? $geoLocation['geometry']['location'] : [], 'recent' => $this->recent]));
             $response->withCookie(cookie()->forever('propertyViews', $this->views + 1));
             break;
     }
     return $response;
 }
Пример #5
0
| and give it the controller to call when that URI is requested.
|
*/
Route::get('showsponsor', 'LinkController@showSponsor');
Route::get('cookie/', function () {
    $cookie = \Cookie::get('sponsor');
    dd($cookie);
});
Route::get('getcookie', function () {
    if (Cookie::get('sponsor')) {
        return Cookie::get('sponsor');
    } else {
        // IF NO SPONSOR DIRECT IT TO COMPANY
        $sponsor = App\Link::with(['user', 'user.profile'])->find(1);
        $response = new Illuminate\Http\Response($sponsor);
        return $response->withCookie(cookie('sponsor', $sponsor, 60));
    }
});
Route::get('/cardline/ten/{lid}', ['as' => 'forceCycle', 'uses' => 'CardlineController@forceCycle']);
Route::get('/cardline/create/{lid}', ['as' => 'tenCreate', 'uses' => 'CardlineController@create']);
Route::get('/cardline/freecycle', ['as' => 'freeCycle', 'uses' => 'CardlineController@free']);
Route::get('/cardline/switchToJack/{lid}', ['as' => 'switchToJack', 'uses' => 'CardlineController@switchToJack']);
Route::get('/cardline/DynamicFlushLine', ['as' => 'DynamicFlushLine', 'uses' => 'CardlineController@DynamicFlushLine']);
Route::get('/cardline/Booster/{qty}', ['as' => 'Booster', 'uses' => 'CardlineController@Booster']);
//Get home view
Route::get('/', ['as' => '/', 'uses' => 'HomeController@index']);
//show profile edit form
Route::get('profile', ['as' => 'profile', 'uses' => 'UserController@edit']);
//show login/signup form
Route::get('login', ['as' => 'login', 'uses' => 'Auth\\AuthController@getLogin']);
//Post Login and Start Session
 public function authadmin(Request $request)
 {
     $user = Admin::where('email', $request->get('email'))->get()->first();
     //->take(1)
     if (count($user) > 0) {
         if (Hash::check($request->get('password'), $user->password)) {
             $user->last_login = date('Y-m-d H:i:s');
             $user->save();
             $response = new \Illuminate\Http\Response(Redirect::route('taskmenu'));
             return $response->withCookie(Cookie::make('thinkadmin', $user->uuid, 60, null, null, false, false));
             //->with("user",$authenticate);//View::make('cloudtasks.menu')->with("request",$request)->with("authenticate",$authenticate);["user"=>$authenticate]
         }
     }
     return back()->withErrors("Wrong credentials.");
 }