@@ -9,7 +9,7 @@ |
||
| 9 | 9 | */ |
| 10 | 10 | public function run() |
| 11 | 11 | { |
| 12 | - factory(App\Models\User::class, 20)->create()->each(function ($user) { |
|
| 12 | + factory(App\Models\User::class, 20)->create()->each(function($user) { |
|
| 13 | 13 | $user->save(); |
| 14 | 14 | }); |
| 15 | 15 | } |
@@ -13,59 +13,59 @@ discard block |
||
| 13 | 13 | { |
| 14 | 14 | $tableNames = config('permission.table_names'); |
| 15 | 15 | |
| 16 | - Schema::create($tableNames['permissions'], function (Blueprint $table) { |
|
| 16 | + Schema::create($tableNames[ 'permissions' ], function(Blueprint $table) { |
|
| 17 | 17 | $table->increments('id'); |
| 18 | 18 | $table->string('name'); |
| 19 | 19 | $table->string('guard_name'); |
| 20 | 20 | $table->timestamps(); |
| 21 | 21 | }); |
| 22 | 22 | |
| 23 | - Schema::create($tableNames['roles'], function (Blueprint $table) { |
|
| 23 | + Schema::create($tableNames[ 'roles' ], function(Blueprint $table) { |
|
| 24 | 24 | $table->increments('id'); |
| 25 | 25 | $table->string('name'); |
| 26 | 26 | $table->string('guard_name'); |
| 27 | 27 | $table->timestamps(); |
| 28 | 28 | }); |
| 29 | 29 | |
| 30 | - Schema::create($tableNames['model_has_permissions'], function (Blueprint $table) use ($tableNames) { |
|
| 30 | + Schema::create($tableNames[ 'model_has_permissions' ], function(Blueprint $table) use ($tableNames) { |
|
| 31 | 31 | $table->unsignedInteger('permission_id'); |
| 32 | 32 | $table->morphs('model'); |
| 33 | 33 | |
| 34 | 34 | $table->foreign('permission_id') |
| 35 | 35 | ->references('id') |
| 36 | - ->on($tableNames['permissions']) |
|
| 36 | + ->on($tableNames[ 'permissions' ]) |
|
| 37 | 37 | ->onDelete('cascade'); |
| 38 | 38 | |
| 39 | - $table->primary(['permission_id', 'model_id', 'model_type']); |
|
| 39 | + $table->primary([ 'permission_id', 'model_id', 'model_type' ]); |
|
| 40 | 40 | }); |
| 41 | 41 | |
| 42 | - Schema::create($tableNames['model_has_roles'], function (Blueprint $table) use ($tableNames) { |
|
| 42 | + Schema::create($tableNames[ 'model_has_roles' ], function(Blueprint $table) use ($tableNames) { |
|
| 43 | 43 | $table->unsignedInteger('role_id'); |
| 44 | 44 | $table->morphs('model'); |
| 45 | 45 | |
| 46 | 46 | $table->foreign('role_id') |
| 47 | 47 | ->references('id') |
| 48 | - ->on($tableNames['roles']) |
|
| 48 | + ->on($tableNames[ 'roles' ]) |
|
| 49 | 49 | ->onDelete('cascade'); |
| 50 | 50 | |
| 51 | - $table->primary(['role_id', 'model_id', 'model_type']); |
|
| 51 | + $table->primary([ 'role_id', 'model_id', 'model_type' ]); |
|
| 52 | 52 | }); |
| 53 | 53 | |
| 54 | - Schema::create($tableNames['role_has_permissions'], function (Blueprint $table) use ($tableNames) { |
|
| 54 | + Schema::create($tableNames[ 'role_has_permissions' ], function(Blueprint $table) use ($tableNames) { |
|
| 55 | 55 | $table->unsignedInteger('permission_id'); |
| 56 | 56 | $table->unsignedInteger('role_id'); |
| 57 | 57 | |
| 58 | 58 | $table->foreign('permission_id') |
| 59 | 59 | ->references('id') |
| 60 | - ->on($tableNames['permissions']) |
|
| 60 | + ->on($tableNames[ 'permissions' ]) |
|
| 61 | 61 | ->onDelete('cascade'); |
| 62 | 62 | |
| 63 | 63 | $table->foreign('role_id') |
| 64 | 64 | ->references('id') |
| 65 | - ->on($tableNames['roles']) |
|
| 65 | + ->on($tableNames[ 'roles' ]) |
|
| 66 | 66 | ->onDelete('cascade'); |
| 67 | 67 | |
| 68 | - $table->primary(['permission_id', 'role_id']); |
|
| 68 | + $table->primary([ 'permission_id', 'role_id' ]); |
|
| 69 | 69 | |
| 70 | 70 | app('cache')->forget('spatie.permission.cache'); |
| 71 | 71 | }); |
@@ -78,10 +78,10 @@ discard block |
||
| 78 | 78 | { |
| 79 | 79 | $tableNames = config('permission.table_names'); |
| 80 | 80 | |
| 81 | - Schema::drop($tableNames['role_has_permissions']); |
|
| 82 | - Schema::drop($tableNames['model_has_roles']); |
|
| 83 | - Schema::drop($tableNames['model_has_permissions']); |
|
| 84 | - Schema::drop($tableNames['roles']); |
|
| 85 | - Schema::drop($tableNames['permissions']); |
|
| 81 | + Schema::drop($tableNames[ 'role_has_permissions' ]); |
|
| 82 | + Schema::drop($tableNames[ 'model_has_roles' ]); |
|
| 83 | + Schema::drop($tableNames[ 'model_has_permissions' ]); |
|
| 84 | + Schema::drop($tableNames[ 'roles' ]); |
|
| 85 | + Schema::drop($tableNames[ 'permissions' ]); |
|
| 86 | 86 | } |
| 87 | 87 | } |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | */ |
| 12 | 12 | public function up() |
| 13 | 13 | { |
| 14 | - Schema::create('users', function (Blueprint $table) { |
|
| 14 | + Schema::create('users', function(Blueprint $table) { |
|
| 15 | 15 | $table->increments('id'); |
| 16 | 16 | $table->string('name'); |
| 17 | 17 | $table->string('email')->unique(); |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | */ |
| 12 | 12 | public function up() |
| 13 | 13 | { |
| 14 | - Schema::create('password_resets', function (Blueprint $table) { |
|
| 14 | + Schema::create('password_resets', function(Blueprint $table) { |
|
| 15 | 15 | $table->string('email')->index(); |
| 16 | 16 | $table->string('token'); |
| 17 | 17 | $table->timestamp('created_at')->nullable(); |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | | |
| 14 | 14 | */ |
| 15 | 15 | |
| 16 | -$factory->define(App\Models\User::class, function (Faker $faker) { |
|
| 16 | +$factory->define(App\Models\User::class, function(Faker $faker) { |
|
| 17 | 17 | static $password; |
| 18 | 18 | |
| 19 | 19 | return [ |
@@ -11,6 +11,6 @@ |
||
| 11 | 11 | | |
| 12 | 12 | */ |
| 13 | 13 | |
| 14 | -Broadcast::channel('App.User.{id}', function ($user, $id) { |
|
| 14 | +Broadcast::channel('App.User.{id}', function($user, $id) { |
|
| 15 | 15 | return (int) $user->id === (int) $id; |
| 16 | 16 | }); |
@@ -11,6 +11,6 @@ |
||
| 11 | 11 | | |
| 12 | 12 | */ |
| 13 | 13 | |
| 14 | -Route::get('/', function () { |
|
| 14 | +Route::get('/', function() { |
|
| 15 | 15 | return view('welcome'); |
| 16 | 16 | }); |
@@ -13,6 +13,6 @@ |
||
| 13 | 13 | | |
| 14 | 14 | */ |
| 15 | 15 | |
| 16 | -Artisan::command('inspire', function () { |
|
| 16 | +Artisan::command('inspire', function() { |
|
| 17 | 17 | $this->comment(Inspiring::quote()); |
| 18 | 18 | })->describe('Display an inspiring quote'); |
@@ -17,8 +17,8 @@ discard block |
||
| 17 | 17 | $api = app(Router::class); |
| 18 | 18 | |
| 19 | 19 | // Create a Dingo Version Group |
| 20 | -$api->version('v1', ['middleware' => 'api'], function ($api) { |
|
| 21 | - $api->group(['prefix' => 'auth'], function ($api) { |
|
| 20 | +$api->version('v1', [ 'middleware' => 'api' ], function($api) { |
|
| 21 | + $api->group([ 'prefix' => 'auth' ], function($api) { |
|
| 22 | 22 | $api->post('register', [ |
| 23 | 23 | 'as' => 'register', |
| 24 | 24 | 'uses' => 'App\\Api\\V1\\Controllers\\RegisterController@register', |
@@ -42,14 +42,14 @@ discard block |
||
| 42 | 42 | $api->post('reset', 'App\\Api\\V1\\Controllers\\ResetPasswordController@resetPassword'); |
| 43 | 43 | $api->get('reset/{token}', [ |
| 44 | 44 | 'as' => 'password.reset', |
| 45 | - function () { |
|
| 45 | + function() { |
|
| 46 | 46 | }, |
| 47 | 47 | ]); |
| 48 | 48 | }); |
| 49 | 49 | |
| 50 | 50 | // Protected routes |
| 51 | - $api->group(['middleware' => 'auth:api'], function ($api) { |
|
| 52 | - $api->get('protected', function () { |
|
| 51 | + $api->group([ 'middleware' => 'auth:api' ], function($api) { |
|
| 52 | + $api->get('protected', function() { |
|
| 53 | 53 | return response()->json([ |
| 54 | 54 | 'message' => 'Access to protected resources granted! You are seeing this text as you provided the token correctly.', |
| 55 | 55 | ]); |