예제 #1
0
 /**
  * Set a citizens address active or inactive
  * @param $usage_id
  */
 public function setUsage($usage_id)
 {
     if (\App\Usage::where('user_id', '=', \Auth::user()->id)->where('usageActivity', '=', 1)->first()) {
         $usage = \App\Usage::where('user_id', '=', \Auth::user()->id)->where('usageActivity', '=', 1)->first();
         $usage->update(['usageActivity' => 0]);
     }
     if (!\App\Usage::where('user_id', '=', \Auth::user()->id)->where('usageActivity', '=', 1)->first()) {
         $usage = \App\Usage::where('id', '=', $usage_id)->where('user_id', '=', \Auth::user()->id)->where('usageActivity', '=', 0)->first();
         $usage->update(['usageActivity' => 1]);
     }
 }
예제 #2
0
파일: routes.php 프로젝트: Jemok/locate
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
Route::get('/', function () {
    return view('welcome');
});
Route::get('/protected-resource', ['middleware' => 'oauth', function () {
    $usage = \App\Usage::where('user_id', '=', \Auth::user()->id)->where('usageActivity', '=', 1)->first()->address_id;
    $address = \App\Address::where('id', '=', $usage)->first()->address;
    //return Response::json(['address' => $address]);
    //return redirect()->route('shelves', ['address' => $address]);
    return Redirect::to('http://localhost:34000/locate/import?address=' . $address);
}]);
Route::get('/shelves', ['as' => 'shelves'], function () {
    return redirect('http://localhost:34000/cart/cart');
});
Route::get('oauth/authorize', ['as' => 'oauth.authorize.get', 'middleware' => ['check-authorization-params', 'auth'], function () {
    // display a form where the user can authorize the client to access it's data
    $authParams = Authorizer::getAuthCodeRequestParams();
    $formParams = array_except($authParams, 'client');
    $formParams['client_id'] = $authParams['client']->getId();
    return View::make('oauth.authorization_form', ['params' => $formParams, 'client' => $authParams['client']]);
}]);
예제 #3
0
 /**
  * Get the address of a user
  * @return mixed
  */
 public function getCitizenAddresses()
 {
     $addresses = \App\Usage::where('user_id', '=', \Auth::user()->id);
     return $addresses;
 }