@@ -13,7 +13,7 @@ |
||
13 | 13 | */ |
14 | 14 | public function up() |
15 | 15 | { |
16 | - Schema::create('api_access_tokens', function (Blueprint $table) { |
|
16 | + Schema::create('api_access_tokens', function(Blueprint $table) { |
|
17 | 17 | $table->increments('id'); |
18 | 18 | $table->integer('user_id'); |
19 | 19 | $table->string('app_id', 190); |
@@ -13,7 +13,7 @@ |
||
13 | 13 | */ |
14 | 14 | public function up() |
15 | 15 | { |
16 | - Schema::create('api_apps', function (Blueprint $table) { |
|
16 | + Schema::create('api_apps', function(Blueprint $table) { |
|
17 | 17 | $table->string('app_id', 190); |
18 | 18 | $table->integer('user_id'); |
19 | 19 | $table->string('app_secret'); |
@@ -25,8 +25,8 @@ |
||
25 | 25 | public function issueToken(Request $request) |
26 | 26 | { |
27 | 27 | $app = App::where('app_id', $request->app_id) |
28 | - ->where('app_secret', $request->app_secret) |
|
29 | - ->first(); |
|
28 | + ->where('app_secret', $request->app_secret) |
|
29 | + ->first(); |
|
30 | 30 | |
31 | 31 | if (is_null($app)) { |
32 | 32 | throw new InvalidAppException('Invalid App Info'); |
@@ -80,7 +80,7 @@ |
||
80 | 80 | */ |
81 | 81 | public static function generateAccessToken($app) |
82 | 82 | { |
83 | - if (! ($app instanceof App)) { |
|
83 | + if (!($app instanceof App)) { |
|
84 | 84 | throw new GenerateAccessTokenException('[' . get_class($app) . '] Must Be An Instance Of [Yansongda\LaravelApi\Models\App]'); |
85 | 85 | } |
86 | 86 |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | */ |
60 | 60 | public function user() |
61 | 61 | { |
62 | - if (! is_null($this->user)) { |
|
62 | + if (!is_null($this->user)) { |
|
63 | 63 | return $this->user; |
64 | 64 | } |
65 | 65 | |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | */ |
78 | 78 | public function app() |
79 | 79 | { |
80 | - if (! is_null($this->app)) { |
|
80 | + if (!is_null($this->app)) { |
|
81 | 81 | return $this->app; |
82 | 82 | } |
83 | 83 | |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | $token = $this->request->getPassword(); |
144 | 144 | } |
145 | 145 | |
146 | - if (! empty($token)) { |
|
146 | + if (!empty($token)) { |
|
147 | 147 | return $token; |
148 | 148 | } |
149 | 149 |
@@ -82,7 +82,7 @@ |
||
82 | 82 | */ |
83 | 83 | protected function registerGuard() |
84 | 84 | { |
85 | - Auth::extend('api', function ($app, $name, array $config) { |
|
85 | + Auth::extend('api', function($app, $name, array $config) { |
|
86 | 86 | $guard = new TokenGuard($app['request']); |
87 | 87 | |
88 | 88 | $user = $guard->user(); |
@@ -5,6 +5,6 @@ |
||
5 | 5 | Route::prefix(Api::$routePrefix) |
6 | 6 | ->middleware('api') |
7 | 7 | ->namespace('Yansongda\LaravelApi\Http\Controllers') |
8 | - ->group(function () { |
|
8 | + ->group(function() { |
|
9 | 9 | Route::post('token', 'TokenController@issueToken')->name('api.token'); |
10 | 10 | }); |