@@ -6,35 +6,35 @@ |
||
| 6 | 6 | |
| 7 | 7 | class CreateOauthClientsTable extends Migration |
| 8 | 8 | { |
| 9 | - /** |
|
| 10 | - * Run the migrations. |
|
| 11 | - * |
|
| 12 | - * @return void |
|
| 13 | - */ |
|
| 14 | - public function up() |
|
| 15 | - { |
|
| 16 | - Schema::create('oauth_clients', function (Blueprint $table) { |
|
| 17 | - $table->increments('id'); |
|
| 18 | - $table->unsignedInteger('user_id')->nullable(); |
|
| 19 | - $table->string('name'); |
|
| 20 | - $table->string('secret', 100); |
|
| 21 | - $table->text('redirect'); |
|
| 22 | - $table->boolean('personal_access_client')->default(0); |
|
| 23 | - $table->boolean('password_client')->default(0); |
|
| 24 | - $table->boolean('revoked')->default(0); |
|
| 25 | - $table->timestamps(); |
|
| 9 | + /** |
|
| 10 | + * Run the migrations. |
|
| 11 | + * |
|
| 12 | + * @return void |
|
| 13 | + */ |
|
| 14 | + public function up() |
|
| 15 | + { |
|
| 16 | + Schema::create('oauth_clients', function (Blueprint $table) { |
|
| 17 | + $table->increments('id'); |
|
| 18 | + $table->unsignedInteger('user_id')->nullable(); |
|
| 19 | + $table->string('name'); |
|
| 20 | + $table->string('secret', 100); |
|
| 21 | + $table->text('redirect'); |
|
| 22 | + $table->boolean('personal_access_client')->default(0); |
|
| 23 | + $table->boolean('password_client')->default(0); |
|
| 24 | + $table->boolean('revoked')->default(0); |
|
| 25 | + $table->timestamps(); |
|
| 26 | 26 | |
| 27 | - $table->foreign('user_id')->references('id')->on('users'); |
|
| 28 | - }); |
|
| 29 | - } |
|
| 27 | + $table->foreign('user_id')->references('id')->on('users'); |
|
| 28 | + }); |
|
| 29 | + } |
|
| 30 | 30 | |
| 31 | - /** |
|
| 32 | - * Reverse the migrations. |
|
| 33 | - * |
|
| 34 | - * @return void |
|
| 35 | - */ |
|
| 36 | - public function down() |
|
| 37 | - { |
|
| 38 | - Schema::drop('oauth_clients'); |
|
| 39 | - } |
|
| 31 | + /** |
|
| 32 | + * Reverse the migrations. |
|
| 33 | + * |
|
| 34 | + * @return void |
|
| 35 | + */ |
|
| 36 | + public function down() |
|
| 37 | + { |
|
| 38 | + Schema::drop('oauth_clients'); |
|
| 39 | + } |
|
| 40 | 40 | } |
@@ -6,35 +6,35 @@ |
||
| 6 | 6 | |
| 7 | 7 | class CreateOauthAccessTokensTable extends Migration |
| 8 | 8 | { |
| 9 | - /** |
|
| 10 | - * Run the migrations. |
|
| 11 | - * |
|
| 12 | - * @return void |
|
| 13 | - */ |
|
| 14 | - public function up() |
|
| 15 | - { |
|
| 16 | - Schema::create('oauth_access_tokens', function (Blueprint $table) { |
|
| 17 | - $table->string('id', 100)->primary(); |
|
| 18 | - $table->unsignedInteger('user_id')->nullable(); |
|
| 19 | - $table->unsignedInteger('client_id'); |
|
| 20 | - $table->string('name')->nullable(); |
|
| 21 | - $table->text('scopes')->nullable(); |
|
| 22 | - $table->boolean('revoked'); |
|
| 23 | - $table->timestamps(); |
|
| 24 | - $table->dateTime('expires_at')->nullable(); |
|
| 9 | + /** |
|
| 10 | + * Run the migrations. |
|
| 11 | + * |
|
| 12 | + * @return void |
|
| 13 | + */ |
|
| 14 | + public function up() |
|
| 15 | + { |
|
| 16 | + Schema::create('oauth_access_tokens', function (Blueprint $table) { |
|
| 17 | + $table->string('id', 100)->primary(); |
|
| 18 | + $table->unsignedInteger('user_id')->nullable(); |
|
| 19 | + $table->unsignedInteger('client_id'); |
|
| 20 | + $table->string('name')->nullable(); |
|
| 21 | + $table->text('scopes')->nullable(); |
|
| 22 | + $table->boolean('revoked'); |
|
| 23 | + $table->timestamps(); |
|
| 24 | + $table->dateTime('expires_at')->nullable(); |
|
| 25 | 25 | |
| 26 | - $table->foreign('user_id')->references('id')->on('users'); |
|
| 27 | - $table->foreign('client_id')->references('id')->on('oauth_clients'); |
|
| 28 | - }); |
|
| 29 | - } |
|
| 26 | + $table->foreign('user_id')->references('id')->on('users'); |
|
| 27 | + $table->foreign('client_id')->references('id')->on('oauth_clients'); |
|
| 28 | + }); |
|
| 29 | + } |
|
| 30 | 30 | |
| 31 | - /** |
|
| 32 | - * Reverse the migrations. |
|
| 33 | - * |
|
| 34 | - * @return void |
|
| 35 | - */ |
|
| 36 | - public function down() |
|
| 37 | - { |
|
| 38 | - Schema::drop('oauth_access_tokens'); |
|
| 39 | - } |
|
| 31 | + /** |
|
| 32 | + * Reverse the migrations. |
|
| 33 | + * |
|
| 34 | + * @return void |
|
| 35 | + */ |
|
| 36 | + public function down() |
|
| 37 | + { |
|
| 38 | + Schema::drop('oauth_access_tokens'); |
|
| 39 | + } |
|
| 40 | 40 | } |
@@ -6,29 +6,29 @@ |
||
| 6 | 6 | |
| 7 | 7 | class CreateOauthPersonalAccessClientsTable extends Migration |
| 8 | 8 | { |
| 9 | - /** |
|
| 10 | - * Run the migrations. |
|
| 11 | - * |
|
| 12 | - * @return void |
|
| 13 | - */ |
|
| 14 | - public function up() |
|
| 15 | - { |
|
| 16 | - Schema::create('oauth_personal_access_clients', function (Blueprint $table) { |
|
| 17 | - $table->increments('id'); |
|
| 18 | - $table->unsignedInteger('client_id'); |
|
| 19 | - $table->timestamps(); |
|
| 9 | + /** |
|
| 10 | + * Run the migrations. |
|
| 11 | + * |
|
| 12 | + * @return void |
|
| 13 | + */ |
|
| 14 | + public function up() |
|
| 15 | + { |
|
| 16 | + Schema::create('oauth_personal_access_clients', function (Blueprint $table) { |
|
| 17 | + $table->increments('id'); |
|
| 18 | + $table->unsignedInteger('client_id'); |
|
| 19 | + $table->timestamps(); |
|
| 20 | 20 | |
| 21 | - $table->foreign('client_id')->references('id')->on('oauth_clients'); |
|
| 22 | - }); |
|
| 23 | - } |
|
| 21 | + $table->foreign('client_id')->references('id')->on('oauth_clients'); |
|
| 22 | + }); |
|
| 23 | + } |
|
| 24 | 24 | |
| 25 | - /** |
|
| 26 | - * Reverse the migrations. |
|
| 27 | - * |
|
| 28 | - * @return void |
|
| 29 | - */ |
|
| 30 | - public function down() |
|
| 31 | - { |
|
| 32 | - Schema::drop('oauth_personal_access_clients'); |
|
| 33 | - } |
|
| 25 | + /** |
|
| 26 | + * Reverse the migrations. |
|
| 27 | + * |
|
| 28 | + * @return void |
|
| 29 | + */ |
|
| 30 | + public function down() |
|
| 31 | + { |
|
| 32 | + Schema::drop('oauth_personal_access_clients'); |
|
| 33 | + } |
|
| 34 | 34 | } |
@@ -5,67 +5,67 @@ |
||
| 5 | 5 | |
| 6 | 6 | class Roles extends Migration |
| 7 | 7 | { |
| 8 | - /** |
|
| 9 | - * Run the migrations. |
|
| 10 | - * |
|
| 11 | - * @return void |
|
| 12 | - */ |
|
| 13 | - public function up() |
|
| 14 | - { |
|
| 15 | - Schema::create('roles', function (Blueprint $table) { |
|
| 16 | - $table->increments('id'); |
|
| 17 | - $table->string('name', 100)->unique(); |
|
| 18 | - $table->softDeletes(); |
|
| 19 | - $table->timestamps(); |
|
| 20 | - }); |
|
| 8 | + /** |
|
| 9 | + * Run the migrations. |
|
| 10 | + * |
|
| 11 | + * @return void |
|
| 12 | + */ |
|
| 13 | + public function up() |
|
| 14 | + { |
|
| 15 | + Schema::create('roles', function (Blueprint $table) { |
|
| 16 | + $table->increments('id'); |
|
| 17 | + $table->string('name', 100)->unique(); |
|
| 18 | + $table->softDeletes(); |
|
| 19 | + $table->timestamps(); |
|
| 20 | + }); |
|
| 21 | 21 | |
| 22 | - Schema::create('users_roles', function (Blueprint $table) { |
|
| 23 | - $table->increments('id'); |
|
| 24 | - $table->unsignedInteger('user_id'); |
|
| 25 | - $table->unsignedInteger('role_id'); |
|
| 26 | - $table->softDeletes(); |
|
| 27 | - $table->timestamps(); |
|
| 22 | + Schema::create('users_roles', function (Blueprint $table) { |
|
| 23 | + $table->increments('id'); |
|
| 24 | + $table->unsignedInteger('user_id'); |
|
| 25 | + $table->unsignedInteger('role_id'); |
|
| 26 | + $table->softDeletes(); |
|
| 27 | + $table->timestamps(); |
|
| 28 | 28 | |
| 29 | - $table->foreign('user_id')->references('id')->on('users'); |
|
| 30 | - $table->foreign('role_id')->references('id')->on('roles'); |
|
| 31 | - }); |
|
| 29 | + $table->foreign('user_id')->references('id')->on('users'); |
|
| 30 | + $table->foreign('role_id')->references('id')->on('roles'); |
|
| 31 | + }); |
|
| 32 | 32 | |
| 33 | - /** |
|
| 34 | - * Create Default roles. |
|
| 35 | - */ |
|
| 36 | - \DB::table('roles')->insert( |
|
| 37 | - [ |
|
| 38 | - [ |
|
| 39 | - 'name' => 'Admin', |
|
| 40 | - 'created_at' => \DB::raw('NOW()'), |
|
| 41 | - 'updated_at' => \DB::raw('NOW()') |
|
| 42 | - ] |
|
| 43 | - ] |
|
| 44 | - ); |
|
| 33 | + /** |
|
| 34 | + * Create Default roles. |
|
| 35 | + */ |
|
| 36 | + \DB::table('roles')->insert( |
|
| 37 | + [ |
|
| 38 | + [ |
|
| 39 | + 'name' => 'Admin', |
|
| 40 | + 'created_at' => \DB::raw('NOW()'), |
|
| 41 | + 'updated_at' => \DB::raw('NOW()') |
|
| 42 | + ] |
|
| 43 | + ] |
|
| 44 | + ); |
|
| 45 | 45 | |
| 46 | - /** |
|
| 47 | - * Assign default users to admin roles. |
|
| 48 | - */ |
|
| 49 | - $adminRoleId = \DB::table('roles')->where('name', 'admin')->select('id')->first()->id; |
|
| 50 | - $adminUserId = \DB::table('users')->where('email', '[email protected]')->select('id')->first()->id; |
|
| 51 | - \DB::table('users_roles')->insert( |
|
| 52 | - [ |
|
| 53 | - 'user_id' => $adminUserId, |
|
| 54 | - 'role_id' => $adminRoleId, |
|
| 55 | - 'created_at' => \DB::raw('NOW()'), |
|
| 56 | - 'updated_at' => \DB::raw('NOW()') |
|
| 57 | - ] |
|
| 58 | - ); |
|
| 59 | - } |
|
| 46 | + /** |
|
| 47 | + * Assign default users to admin roles. |
|
| 48 | + */ |
|
| 49 | + $adminRoleId = \DB::table('roles')->where('name', 'admin')->select('id')->first()->id; |
|
| 50 | + $adminUserId = \DB::table('users')->where('email', '[email protected]')->select('id')->first()->id; |
|
| 51 | + \DB::table('users_roles')->insert( |
|
| 52 | + [ |
|
| 53 | + 'user_id' => $adminUserId, |
|
| 54 | + 'role_id' => $adminRoleId, |
|
| 55 | + 'created_at' => \DB::raw('NOW()'), |
|
| 56 | + 'updated_at' => \DB::raw('NOW()') |
|
| 57 | + ] |
|
| 58 | + ); |
|
| 59 | + } |
|
| 60 | 60 | |
| 61 | - /** |
|
| 62 | - * Reverse the migrations. |
|
| 63 | - * |
|
| 64 | - * @return void |
|
| 65 | - */ |
|
| 66 | - public function down() |
|
| 67 | - { |
|
| 68 | - Schema::dropIfExists('roles'); |
|
| 69 | - Schema::dropIfExists('users_roles'); |
|
| 70 | - } |
|
| 61 | + /** |
|
| 62 | + * Reverse the migrations. |
|
| 63 | + * |
|
| 64 | + * @return void |
|
| 65 | + */ |
|
| 66 | + public function down() |
|
| 67 | + { |
|
| 68 | + Schema::dropIfExists('roles'); |
|
| 69 | + Schema::dropIfExists('users_roles'); |
|
| 70 | + } |
|
| 71 | 71 | } |
@@ -15,12 +15,12 @@ |
||
| 15 | 15 | |
| 16 | 16 | Route::group(['prefix' => 'roles'], function () { |
| 17 | 17 | |
| 18 | - Route::get('/', 'RoleController@index'); |
|
| 19 | - Route::get('/{id}', 'RoleController@find'); |
|
| 20 | - Route::post('/', 'RoleController@insert'); |
|
| 21 | - Route::put('/', 'RoleController@update'); |
|
| 22 | - Route::delete('/{id}', 'RoleController@delete'); |
|
| 23 | - Route::get('list/deleted', 'RoleController@deleted'); |
|
| 24 | - Route::patch('restore/{id}', 'RoleController@restore'); |
|
| 25 | - Route::post('assign/permissions', 'RoleController@assignPermissions'); |
|
| 18 | + Route::get('/', 'RoleController@index'); |
|
| 19 | + Route::get('/{id}', 'RoleController@find'); |
|
| 20 | + Route::post('/', 'RoleController@insert'); |
|
| 21 | + Route::put('/', 'RoleController@update'); |
|
| 22 | + Route::delete('/{id}', 'RoleController@delete'); |
|
| 23 | + Route::get('list/deleted', 'RoleController@deleted'); |
|
| 24 | + Route::patch('restore/{id}', 'RoleController@restore'); |
|
| 25 | + Route::post('assign/permissions', 'RoleController@assignPermissions'); |
|
| 26 | 26 | }); |