本文整理汇总了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);
}
}
示例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);
});