當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Authorization::attempt方法代碼示例

本文整理匯總了PHP中Authorization::attempt方法的典型用法代碼示例。如果您正苦於以下問題:PHP Authorization::attempt方法的具體用法?PHP Authorization::attempt怎麽用?PHP Authorization::attempt使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Authorization的用法示例。


在下文中一共展示了Authorization::attempt方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: signupOrSignin

 public function signupOrSignin()
 {
     $input = Input::all();
     try {
         $user = $this->service->getUserByEmail($input['email']);
         \Authorization::attempt(['email' => Input::get('username'), 'password' => Input::get('password')]);
         $user = \Authorization::user();
         $transformer = \App::make(\HOFB\Users\UserTransformer::class);
         $response = \Authorizer::issueAccessToken();
         $transformed = $transformer->transform($user);
         $response['user'] = $transformed;
         return \Response::json($response);
     } catch (NotFoundModelException $e) {
         $input['userable_type'] = UserController::filterToType($input['userable_type']);
         $model = $this->service->createUser($input);
         return $this->returnUserModel($model);
     }
 }
開發者ID:HOFB,項目名稱:HOFB,代碼行數:18,代碼來源:UserController.php

示例2: function

    Route::post('projects/', ['uses' => 'ProjectController@store']);
    Route::get('projects', ['uses' => 'ProjectController@index']);
    Route::get('projects/{resource}', ['uses' => 'ProjectController@show']);
    Route::put('projects/{resource}', ['uses' => 'ProjectController@update']);
    Route::delete('projects/{resource}', ['uses' => 'ProjectController@destroy']);
    Route::get('projects/{resource}/activity', ['uses' => 'ActivityController@index']);
    Route::get('projects/{resource}/activity/{Hash}', ['uses' => 'ActivityController@show']);
    Route::post('projects/{resource}/activity', ['uses' => 'ActivityController@store']);
    Route::get('projects/users/{hash}', ['uses' => 'ProjectController@showUserProjects']);
    Route::post('wishes/{resource}', ['uses' => 'WishlistController@store']);
    Route::get('wishes/{resource}', ['uses' => 'WishlistController@index']);
    Route::delete('wishes/{resource}', ['uses' => 'WishlistController@destroy']);
    Route::post('uploads', ['uses' => 'UploadController@store']);
    Route::get('uploads', ['uses' => 'UploadController@index']);
    Route::resource('uploads', 'UploadController');
    Route::resource('projects', 'ProjectController');
    Route::resource('users', 'UserController');
    Route::resource('notifications', 'NotificationController');
    Route::resource('wishes', 'WishlistController');
});
Route::post('signup/users', ['uses' => 'UserController@store']);
route::post('signupOrSignin', ['uses' => 'UserController@signupOrSignin']);
Route::post('oauth/access_token', function () {
    \Authorization::attempt(['email' => Input::get('username'), 'password' => Input::get('password')]);
    $user = \Authorization::user();
    $transformer = \App::make(\HOFB\Users\UserTransformer::class);
    $response = Authorizer::issueAccessToken();
    $transformed = $transformer->transform($user);
    $response['user'] = $transformed;
    return Response::json($response);
});
開發者ID:HOFB,項目名稱:HOFB,代碼行數:31,代碼來源:routes.php


注:本文中的Authorization::attempt方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。