当前位置: 首页>>代码示例>>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;未经允许,请勿转载。