@@ -1,11 +1,11 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | $factory->define(App\Modules\Core\Setting::class, function (Faker\Generator $faker) { |
| 4 | - return [ |
|
| 5 | - 'name' => $faker->randomElement(['Company Name', 'Title', 'Header Image']), |
|
| 6 | - 'value' => $faker->word(), |
|
| 7 | - 'key' => $faker->word(), |
|
| 8 | - 'created_at' => $faker->dateTimeBetween('-1 years', 'now'), |
|
| 9 | - 'updated_at' => $faker->dateTimeBetween('-1 years', 'now') |
|
| 10 | - ]; |
|
| 4 | + return [ |
|
| 5 | + 'name' => $faker->randomElement(['Company Name', 'Title', 'Header Image']), |
|
| 6 | + 'value' => $faker->word(), |
|
| 7 | + 'key' => $faker->word(), |
|
| 8 | + 'created_at' => $faker->dateTimeBetween('-1 years', 'now'), |
|
| 9 | + 'updated_at' => $faker->dateTimeBetween('-1 years', 'now') |
|
| 10 | + ]; |
|
| 11 | 11 | }); |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -$factory->define(App\Modules\Core\Setting::class, function (Faker\Generator $faker) { |
|
| 3 | +$factory->define(App\Modules\Core\Setting::class, function(Faker\Generator $faker) { |
|
| 4 | 4 | return [ |
| 5 | 5 | 'name' => $faker->randomElement(['Company Name', 'Title', 'Header Image']), |
| 6 | 6 | 'value' => $faker->word(), |
@@ -9,43 +9,43 @@ |
||
| 9 | 9 | |
| 10 | 10 | class SetRelations |
| 11 | 11 | { |
| 12 | - protected $arr; |
|
| 13 | - protected $route; |
|
| 14 | - protected $config; |
|
| 12 | + protected $arr; |
|
| 13 | + protected $route; |
|
| 14 | + protected $config; |
|
| 15 | 15 | |
| 16 | - /** |
|
| 17 | - * Init new object. |
|
| 18 | - * |
|
| 19 | - * @param Route $route |
|
| 20 | - * @param Arr $arr |
|
| 21 | - * @param Config $config |
|
| 22 | - * |
|
| 23 | - * @return void |
|
| 24 | - */ |
|
| 25 | - public function __construct(Route $route, Arr $arr, Config $config) |
|
| 26 | - { |
|
| 27 | - $this->arr = $arr; |
|
| 28 | - $this->route = $route; |
|
| 29 | - $this->config = $config->getConfig(); |
|
| 30 | - } |
|
| 16 | + /** |
|
| 17 | + * Init new object. |
|
| 18 | + * |
|
| 19 | + * @param Route $route |
|
| 20 | + * @param Arr $arr |
|
| 21 | + * @param Config $config |
|
| 22 | + * |
|
| 23 | + * @return void |
|
| 24 | + */ |
|
| 25 | + public function __construct(Route $route, Arr $arr, Config $config) |
|
| 26 | + { |
|
| 27 | + $this->arr = $arr; |
|
| 28 | + $this->route = $route; |
|
| 29 | + $this->config = $config->getConfig(); |
|
| 30 | + } |
|
| 31 | 31 | |
| 32 | - /** |
|
| 33 | - * Handle an incoming request. |
|
| 34 | - * |
|
| 35 | - * @param \Illuminate\Http\Request $request |
|
| 36 | - * @param \Closure $next |
|
| 37 | - * @return mixed |
|
| 38 | - */ |
|
| 39 | - public function handle($request, Closure $next) |
|
| 40 | - { |
|
| 41 | - $routeActions = explode('@', $this->route->currentRouteAction()); |
|
| 42 | - $modelName = explode('\\', $routeActions[0]); |
|
| 43 | - $modelName = lcfirst(str_replace('Controller', '', end($modelName))); |
|
| 44 | - $route = explode('@', $this->route->currentRouteAction())[1]; |
|
| 45 | - $route = $route !== 'index' ? $route : 'list'; |
|
| 46 | - $relations = $this->arr->get($this->config['relations'], $modelName, false); |
|
| 47 | - $request->relations = $relations && isset($relations[$route]) ? $relations[$route] : []; |
|
| 32 | + /** |
|
| 33 | + * Handle an incoming request. |
|
| 34 | + * |
|
| 35 | + * @param \Illuminate\Http\Request $request |
|
| 36 | + * @param \Closure $next |
|
| 37 | + * @return mixed |
|
| 38 | + */ |
|
| 39 | + public function handle($request, Closure $next) |
|
| 40 | + { |
|
| 41 | + $routeActions = explode('@', $this->route->currentRouteAction()); |
|
| 42 | + $modelName = explode('\\', $routeActions[0]); |
|
| 43 | + $modelName = lcfirst(str_replace('Controller', '', end($modelName))); |
|
| 44 | + $route = explode('@', $this->route->currentRouteAction())[1]; |
|
| 45 | + $route = $route !== 'index' ? $route : 'list'; |
|
| 46 | + $relations = $this->arr->get($this->config['relations'], $modelName, false); |
|
| 47 | + $request->relations = $relations && isset($relations[$route]) ? $relations[$route] : []; |
|
| 48 | 48 | |
| 49 | - return $next($request); |
|
| 50 | - } |
|
| 49 | + return $next($request); |
|
| 50 | + } |
|
| 51 | 51 | } |
@@ -1,9 +1,9 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | $factory->define(App\Modules\Roles\Role::class, function (Faker\Generator $faker) { |
| 4 | - return [ |
|
| 5 | - 'name' => $faker->unique->word(), |
|
| 6 | - 'created_at' => $faker->dateTimeBetween('-1 years', 'now'), |
|
| 7 | - 'updated_at' => $faker->dateTimeBetween('-1 years', 'now') |
|
| 8 | - ]; |
|
| 4 | + return [ |
|
| 5 | + 'name' => $faker->unique->word(), |
|
| 6 | + 'created_at' => $faker->dateTimeBetween('-1 years', 'now'), |
|
| 7 | + 'updated_at' => $faker->dateTimeBetween('-1 years', 'now') |
|
| 8 | + ]; |
|
| 9 | 9 | }); |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -$factory->define(App\Modules\Roles\Role::class, function (Faker\Generator $faker) { |
|
| 3 | +$factory->define(App\Modules\Roles\Role::class, function(Faker\Generator $faker) { |
|
| 4 | 4 | return [ |
| 5 | 5 | 'name' => $faker->unique->word(), |
| 6 | 6 | 'created_at' => $faker->dateTimeBetween('-1 years', 'now'), |
@@ -6,26 +6,26 @@ |
||
| 6 | 6 | |
| 7 | 7 | class AssignPermissions extends FormRequest |
| 8 | 8 | { |
| 9 | - /** |
|
| 10 | - * Determine if the user is authorized to make this request. |
|
| 11 | - * |
|
| 12 | - * @return bool |
|
| 13 | - */ |
|
| 14 | - public function authorize() |
|
| 15 | - { |
|
| 16 | - return true; |
|
| 17 | - } |
|
| 9 | + /** |
|
| 10 | + * Determine if the user is authorized to make this request. |
|
| 11 | + * |
|
| 12 | + * @return bool |
|
| 13 | + */ |
|
| 14 | + public function authorize() |
|
| 15 | + { |
|
| 16 | + return true; |
|
| 17 | + } |
|
| 18 | 18 | |
| 19 | - /** |
|
| 20 | - * Get the validation rules that apply to the request. |
|
| 21 | - * |
|
| 22 | - * @return array |
|
| 23 | - */ |
|
| 24 | - public function rules() |
|
| 25 | - { |
|
| 26 | - return [ |
|
| 27 | - 'permission_ids' => 'required|exists:permissions,id', |
|
| 28 | - 'role_id' => 'required|array|exists:roles,id' |
|
| 29 | - ]; |
|
| 30 | - } |
|
| 19 | + /** |
|
| 20 | + * Get the validation rules that apply to the request. |
|
| 21 | + * |
|
| 22 | + * @return array |
|
| 23 | + */ |
|
| 24 | + public function rules() |
|
| 25 | + { |
|
| 26 | + return [ |
|
| 27 | + 'permission_ids' => 'required|exists:permissions,id', |
|
| 28 | + 'role_id' => 'required|array|exists:roles,id' |
|
| 29 | + ]; |
|
| 30 | + } |
|
| 31 | 31 | } |
@@ -6,26 +6,26 @@ |
||
| 6 | 6 | |
| 7 | 7 | class UpdateRole extends FormRequest |
| 8 | 8 | { |
| 9 | - /** |
|
| 10 | - * Determine if the user is authorized to make this request. |
|
| 11 | - * |
|
| 12 | - * @return bool |
|
| 13 | - */ |
|
| 14 | - public function authorize() |
|
| 15 | - { |
|
| 16 | - return true; |
|
| 17 | - } |
|
| 9 | + /** |
|
| 10 | + * Determine if the user is authorized to make this request. |
|
| 11 | + * |
|
| 12 | + * @return bool |
|
| 13 | + */ |
|
| 14 | + public function authorize() |
|
| 15 | + { |
|
| 16 | + return true; |
|
| 17 | + } |
|
| 18 | 18 | |
| 19 | - /** |
|
| 20 | - * Get the validation rules that apply to the request. |
|
| 21 | - * |
|
| 22 | - * @return array |
|
| 23 | - */ |
|
| 24 | - public function rules() |
|
| 25 | - { |
|
| 26 | - return [ |
|
| 27 | - 'id' => 'required|exists:roles,id', |
|
| 28 | - 'name' => 'required|string|max:100|unique:roles,name,'.$this->get('id') |
|
| 29 | - ]; |
|
| 30 | - } |
|
| 19 | + /** |
|
| 20 | + * Get the validation rules that apply to the request. |
|
| 21 | + * |
|
| 22 | + * @return array |
|
| 23 | + */ |
|
| 24 | + public function rules() |
|
| 25 | + { |
|
| 26 | + return [ |
|
| 27 | + 'id' => 'required|exists:roles,id', |
|
| 28 | + 'name' => 'required|string|max:100|unique:roles,name,'.$this->get('id') |
|
| 29 | + ]; |
|
| 30 | + } |
|
| 31 | 31 | } |
@@ -6,25 +6,25 @@ |
||
| 6 | 6 | |
| 7 | 7 | class InsertRole extends FormRequest |
| 8 | 8 | { |
| 9 | - /** |
|
| 10 | - * Determine if the user is authorized to make this request. |
|
| 11 | - * |
|
| 12 | - * @return bool |
|
| 13 | - */ |
|
| 14 | - public function authorize() |
|
| 15 | - { |
|
| 16 | - return true; |
|
| 17 | - } |
|
| 9 | + /** |
|
| 10 | + * Determine if the user is authorized to make this request. |
|
| 11 | + * |
|
| 12 | + * @return bool |
|
| 13 | + */ |
|
| 14 | + public function authorize() |
|
| 15 | + { |
|
| 16 | + return true; |
|
| 17 | + } |
|
| 18 | 18 | |
| 19 | - /** |
|
| 20 | - * Get the validation rules that apply to the request. |
|
| 21 | - * |
|
| 22 | - * @return array |
|
| 23 | - */ |
|
| 24 | - public function rules() |
|
| 25 | - { |
|
| 26 | - return [ |
|
| 27 | - 'name' => 'required|string|max:100|unique:roles,name,'.$this->get('id') |
|
| 28 | - ]; |
|
| 29 | - } |
|
| 19 | + /** |
|
| 20 | + * Get the validation rules that apply to the request. |
|
| 21 | + * |
|
| 22 | + * @return array |
|
| 23 | + */ |
|
| 24 | + public function rules() |
|
| 25 | + { |
|
| 26 | + return [ |
|
| 27 | + 'name' => 'required|string|max:100|unique:roles,name,'.$this->get('id') |
|
| 28 | + ]; |
|
| 29 | + } |
|
| 30 | 30 | } |
@@ -6,30 +6,30 @@ |
||
| 6 | 6 | |
| 7 | 7 | class CreateOauthRefreshTokensTable extends Migration |
| 8 | 8 | { |
| 9 | - /** |
|
| 10 | - * Run the migrations. |
|
| 11 | - * |
|
| 12 | - * @return void |
|
| 13 | - */ |
|
| 14 | - public function up() |
|
| 15 | - { |
|
| 16 | - Schema::create('oauth_refresh_tokens', function (Blueprint $table) { |
|
| 17 | - $table->string('id', 100)->primary(); |
|
| 18 | - $table->string('access_token_id', 100); |
|
| 19 | - $table->boolean('revoked'); |
|
| 20 | - $table->dateTime('expires_at')->nullable(); |
|
| 9 | + /** |
|
| 10 | + * Run the migrations. |
|
| 11 | + * |
|
| 12 | + * @return void |
|
| 13 | + */ |
|
| 14 | + public function up() |
|
| 15 | + { |
|
| 16 | + Schema::create('oauth_refresh_tokens', function (Blueprint $table) { |
|
| 17 | + $table->string('id', 100)->primary(); |
|
| 18 | + $table->string('access_token_id', 100); |
|
| 19 | + $table->boolean('revoked'); |
|
| 20 | + $table->dateTime('expires_at')->nullable(); |
|
| 21 | 21 | |
| 22 | - $table->foreign('access_token_id')->references('id')->on('oauth_access_tokens'); |
|
| 23 | - }); |
|
| 24 | - } |
|
| 22 | + $table->foreign('access_token_id')->references('id')->on('oauth_access_tokens'); |
|
| 23 | + }); |
|
| 24 | + } |
|
| 25 | 25 | |
| 26 | - /** |
|
| 27 | - * Reverse the migrations. |
|
| 28 | - * |
|
| 29 | - * @return void |
|
| 30 | - */ |
|
| 31 | - public function down() |
|
| 32 | - { |
|
| 33 | - Schema::drop('oauth_refresh_tokens'); |
|
| 34 | - } |
|
| 26 | + /** |
|
| 27 | + * Reverse the migrations. |
|
| 28 | + * |
|
| 29 | + * @return void |
|
| 30 | + */ |
|
| 31 | + public function down() |
|
| 32 | + { |
|
| 33 | + Schema::drop('oauth_refresh_tokens'); |
|
| 34 | + } |
|
| 35 | 35 | } |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | public function up() |
| 15 | 15 | { |
| 16 | - Schema::create('oauth_refresh_tokens', function (Blueprint $table) { |
|
| 16 | + Schema::create('oauth_refresh_tokens', function(Blueprint $table) { |
|
| 17 | 17 | $table->string('id', 100)->primary(); |
| 18 | 18 | $table->string('access_token_id', 100); |
| 19 | 19 | $table->boolean('revoked'); |
@@ -6,26 +6,26 @@ |
||
| 6 | 6 | |
| 7 | 7 | class AssignRoles extends FormRequest |
| 8 | 8 | { |
| 9 | - /** |
|
| 10 | - * Determine if the user is authorized to make this request. |
|
| 11 | - * |
|
| 12 | - * @return bool |
|
| 13 | - */ |
|
| 14 | - public function authorize() |
|
| 15 | - { |
|
| 16 | - return true; |
|
| 17 | - } |
|
| 9 | + /** |
|
| 10 | + * Determine if the user is authorized to make this request. |
|
| 11 | + * |
|
| 12 | + * @return bool |
|
| 13 | + */ |
|
| 14 | + public function authorize() |
|
| 15 | + { |
|
| 16 | + return true; |
|
| 17 | + } |
|
| 18 | 18 | |
| 19 | - /** |
|
| 20 | - * Get the validation rules that apply to the request. |
|
| 21 | - * |
|
| 22 | - * @return array |
|
| 23 | - */ |
|
| 24 | - public function rules() |
|
| 25 | - { |
|
| 26 | - return [ |
|
| 27 | - 'role_ids' => 'required|exists:roles,id', |
|
| 28 | - 'user_id' => 'required|exists:users,id' |
|
| 29 | - ]; |
|
| 30 | - } |
|
| 19 | + /** |
|
| 20 | + * Get the validation rules that apply to the request. |
|
| 21 | + * |
|
| 22 | + * @return array |
|
| 23 | + */ |
|
| 24 | + public function rules() |
|
| 25 | + { |
|
| 26 | + return [ |
|
| 27 | + 'role_ids' => 'required|exists:roles,id', |
|
| 28 | + 'user_id' => 'required|exists:users,id' |
|
| 29 | + ]; |
|
| 30 | + } |
|
| 31 | 31 | } |
@@ -1,10 +1,10 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | $factory->define(App\Modules\Permissions\Permission::class, function (Faker\Generator $faker) { |
| 4 | - return [ |
|
| 5 | - 'name' => $faker->randomElement(['save', 'delete', 'find', 'paginate']), |
|
| 6 | - 'model' => $faker->randomElement(['users', 'roles', 'settings', 'notifications']), |
|
| 7 | - 'created_at' => $faker->dateTimeBetween('-1 years', 'now'), |
|
| 8 | - 'updated_at' => $faker->dateTimeBetween('-1 years', 'now') |
|
| 9 | - ]; |
|
| 4 | + return [ |
|
| 5 | + 'name' => $faker->randomElement(['save', 'delete', 'find', 'paginate']), |
|
| 6 | + 'model' => $faker->randomElement(['users', 'roles', 'settings', 'notifications']), |
|
| 7 | + 'created_at' => $faker->dateTimeBetween('-1 years', 'now'), |
|
| 8 | + 'updated_at' => $faker->dateTimeBetween('-1 years', 'now') |
|
| 9 | + ]; |
|
| 10 | 10 | }); |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -$factory->define(App\Modules\Permissions\Permission::class, function (Faker\Generator $faker) { |
|
| 3 | +$factory->define(App\Modules\Permissions\Permission::class, function(Faker\Generator $faker) { |
|
| 4 | 4 | return [ |
| 5 | 5 | 'name' => $faker->randomElement(['save', 'delete', 'find', 'paginate']), |
| 6 | 6 | 'model' => $faker->randomElement(['users', 'roles', 'settings', 'notifications']), |