@@ -12,10 +12,10 @@ |
||
12 | 12 | */ |
13 | 13 | public function up() |
14 | 14 | { |
15 | - Schema::create('settings', function (Blueprint $table) { |
|
15 | + Schema::create('settings', function(Blueprint $table) { |
|
16 | 16 | $table->increments('id'); |
17 | - $table->string('name',100); |
|
18 | - $table->string('key',100)->unique(); |
|
17 | + $table->string('name', 100); |
|
18 | + $table->string('key', 100)->unique(); |
|
19 | 19 | $table->text('value')->nullable(); |
20 | 20 | $table->softDeletes(); |
21 | 21 | $table->timestamps(); |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -$factory->define(App\Modules\Core\Settings::class, function (Faker\Generator $faker) { |
|
3 | +$factory->define(App\Modules\Core\Settings::class, function(Faker\Generator $faker) { |
|
4 | 4 | return [ |
5 | 5 | 'name' => $faker->randomElement(['Company Name', 'Title', 'Header Image']), |
6 | 6 | 'value' => $faker->word(), |
@@ -3,14 +3,14 @@ |
||
3 | 3 | use Illuminate\Database\Eloquent\Model; |
4 | 4 | use Illuminate\Database\Eloquent\SoftDeletes; |
5 | 5 | |
6 | -class Settings extends Model{ |
|
6 | +class Settings extends Model { |
|
7 | 7 | |
8 | 8 | use SoftDeletes; |
9 | 9 | protected $table = 'settings'; |
10 | 10 | protected $dates = ['created_at', 'updated_at', 'deleted_at']; |
11 | 11 | protected $hidden = ['deleted_at']; |
12 | 12 | protected $guarded = ['id', 'key']; |
13 | - protected $fillable = ['name','value']; |
|
13 | + protected $fillable = ['name', 'value']; |
|
14 | 14 | public $searchable = ['name', 'value', 'key']; |
15 | 15 | |
16 | 16 | public function getCreatedAtAttribute($value) |
@@ -34,9 +34,9 @@ discard block |
||
34 | 34 | $this->validationRules = property_exists($this, 'validationRules') ? $this->validationRules : false; |
35 | 35 | $this->skipPermissionCheck = property_exists($this, 'skipPermissionCheck') ? $this->skipPermissionCheck : []; |
36 | 36 | $this->skipLoginCheck = property_exists($this, 'skipLoginCheck') ? $this->skipLoginCheck : []; |
37 | - $route = explode('@',\Route::currentRouteAction())[1]; |
|
37 | + $route = explode('@', \Route::currentRouteAction())[1]; |
|
38 | 38 | |
39 | - $this->middleware(function ($request, $next) { |
|
39 | + $this->middleware(function($request, $next) { |
|
40 | 40 | |
41 | 41 | $this->repo = call_user_func_array("\Core::{$this->model}", []); |
42 | 42 | return $next($request); |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | |
229 | 229 | if ($isPasswordClient && (in_array($permission, $this->skipPermissionCheck) || \Core::users()->can($permission, $this->model))) |
230 | 230 | {} |
231 | - elseif ( ! $isPasswordClient && $user->tokenCan($this->model . '-' . $permission)) |
|
231 | + elseif ( ! $isPasswordClient && $user->tokenCan($this->model.'-'.$permission)) |
|
232 | 232 | {} |
233 | 233 | else |
234 | 234 | { |
@@ -13,14 +13,14 @@ |
||
13 | 13 | * to preform actions like (add, edit ... etc). |
14 | 14 | * @var string |
15 | 15 | */ |
16 | - protected $model = 'settings'; |
|
16 | + protected $model = 'settings'; |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * The validations rules used by the base api controller |
20 | 20 | * to check before add. |
21 | 21 | * @var array |
22 | 22 | */ |
23 | - protected $validationRules = [ |
|
23 | + protected $validationRules = [ |
|
24 | 24 | 'id' => 'required|exists:settings,id', |
25 | 25 | 'value' => 'required|string' |
26 | 26 | ]; |
@@ -20,27 +20,27 @@ discard block |
||
20 | 20 | ], |
21 | 21 | [ |
22 | 22 | 'title' => 'email equal [email protected] and user is blocked:', |
23 | - 'content' => ['and' => ['email' => '[email protected]','blocked' => 1]] |
|
23 | + 'content' => ['and' => ['email' => '[email protected]', 'blocked' => 1]] |
|
24 | 24 | ], |
25 | 25 | [ |
26 | 26 | 'title' => 'email equal [email protected] or user is blocked:', |
27 | - 'content' => ['or' => ['email' => '[email protected]','blocked' => 1]] |
|
27 | + 'content' => ['or' => ['email' => '[email protected]', 'blocked' => 1]] |
|
28 | 28 | ], |
29 | 29 | [ |
30 | 30 | 'title' => 'email contain John:', |
31 | - 'content' => ['email' => ['op' => 'like','val' => '%John%']] |
|
31 | + 'content' => ['email' => ['op' => 'like', 'val' => '%John%']] |
|
32 | 32 | ], |
33 | 33 | [ |
34 | 34 | 'title' => 'user created after 2016-10-25:', |
35 | - 'content' => ['created_at' => ['op' => '>','val' => '2016-10-25']] |
|
35 | + 'content' => ['created_at' => ['op' => '>', 'val' => '2016-10-25']] |
|
36 | 36 | ], |
37 | 37 | [ |
38 | 38 | 'title' => 'user created between 2016-10-20 and 2016-10-25:', |
39 | - 'content' => ['created_at' => ['op' => 'between','val1' => '2016-10-20','val2' => '2016-10-25']] |
|
39 | + 'content' => ['created_at' => ['op' => 'between', 'val1' => '2016-10-20', 'val2' => '2016-10-25']] |
|
40 | 40 | ], |
41 | 41 | [ |
42 | 42 | 'title' => 'user id in 1,2,3:', |
43 | - 'content' => ['id' => ['op' => 'in','val' => [1, 2, 3]]] |
|
43 | + 'content' => ['id' => ['op' => 'in', 'val' => [1, 2, 3]]] |
|
44 | 44 | ], |
45 | 45 | [ |
46 | 46 | 'title' => 'user name is null:', |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | ], |
53 | 53 | [ |
54 | 54 | 'title' => 'user has group admin:', |
55 | - 'content' => ['groups' => ['op' => 'has','val' => ['name' => 'Admin']]] |
|
55 | + 'content' => ['groups' => ['op' => 'has', 'val' => ['name' => 'Admin']]] |
|
56 | 56 | ] |
57 | 57 | ]; |
58 | 58 |
@@ -22,7 +22,7 @@ |
||
22 | 22 | */ |
23 | 23 | public function saveMany(array $data) |
24 | 24 | { |
25 | - \DB::transaction(function () use ($data) { |
|
25 | + \DB::transaction(function() use ($data) { |
|
26 | 26 | foreach ($data as $key => $value) |
27 | 27 | { |
28 | 28 | $this->save($value); |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | if ($route) |
46 | 46 | { |
47 | 47 | $actoinArray = explode('@', $route['action']); |
48 | - if(array_get($actoinArray, 1, false)) |
|
48 | + if (array_get($actoinArray, 1, false)) |
|
49 | 49 | { |
50 | 50 | $controller = $actoinArray[0]; |
51 | 51 | $method = $actoinArray[1]; |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | $route['response'] = $this->getResponseObject($classProperties['model'], $route['name'], $route['returnDocBlock']); |
65 | 65 | |
66 | 66 | preg_match('/api\/([^#]+)\//iU', $route['uri'], $module); |
67 | - $docData['modules'][$module[1]][substr($route['prefix'], strlen('/api/' . $module[1] . '/') - 1)][] = $route; |
|
67 | + $docData['modules'][$module[1]][substr($route['prefix'], strlen('/api/'.$module[1].'/') - 1)][] = $route; |
|
68 | 68 | |
69 | 69 | $this->getModels($classProperties['model'], $docData); |
70 | 70 | } |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | */ |
83 | 83 | protected function getRoutes() |
84 | 84 | { |
85 | - return collect(\Route::getRoutes())->map(function ($route) { |
|
85 | + return collect(\Route::getRoutes())->map(function($route) { |
|
86 | 86 | if (strpos($route->uri(), 'api') !== false) |
87 | 87 | { |
88 | 88 | return [ |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | ]; |
115 | 115 | |
116 | 116 | |
117 | - if (! $skipLoginCheck || ! in_array($method, $skipLoginCheck)) |
|
117 | + if ( ! $skipLoginCheck || ! in_array($method, $skipLoginCheck)) |
|
118 | 118 | { |
119 | 119 | $route['headers']['Authorization'] = 'Bearer {token}'; |
120 | 120 | } |
@@ -168,16 +168,16 @@ discard block |
||
168 | 168 | } |
169 | 169 | else |
170 | 170 | { |
171 | - $route['body'] = eval('return ' . str_replace(',\'.$request->get(\'id\')', ',{id}\'', $match[1]) . ';'); |
|
171 | + $route['body'] = eval('return '.str_replace(',\'.$request->get(\'id\')', ',{id}\'', $match[1]).';'); |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | foreach ($route['body'] as &$rule) |
175 | 175 | { |
176 | - if(strpos($rule, 'unique')) |
|
176 | + if (strpos($rule, 'unique')) |
|
177 | 177 | { |
178 | 178 | $rule = substr($rule, 0, strpos($rule, 'unique') + 6); |
179 | 179 | } |
180 | - elseif(strpos($rule, 'exists')) |
|
180 | + elseif (strpos($rule, 'exists')) |
|
181 | 181 | { |
182 | 182 | $rule = substr($rule, 0, strpos($rule, 'exists') - 1); |
183 | 183 | } |
@@ -250,10 +250,10 @@ discard block |
||
250 | 250 | $model = factory($modelClass)->make(); |
251 | 251 | $modelArr = $model->toArray(); |
252 | 252 | |
253 | - if ( $model->trans && ! $model->trans->count()) |
|
253 | + if ($model->trans && ! $model->trans->count()) |
|
254 | 254 | { |
255 | 255 | $modelArr['trans'] = [ |
256 | - 'en' => factory($modelClass . 'Translation')->make()->toArray() |
|
256 | + 'en' => factory($modelClass.'Translation')->make()->toArray() |
|
257 | 257 | ]; |
258 | 258 | } |
259 | 259 |
@@ -26,7 +26,7 @@ |
||
26 | 26 | { |
27 | 27 | $this->registerPolicies(); |
28 | 28 | |
29 | - Passport::routes(function ($router) { |
|
29 | + Passport::routes(function($router) { |
|
30 | 30 | $router->forAuthorization(); |
31 | 31 | $router->forAccessTokens(); |
32 | 32 | $router->forPersonalAccessTokens(); |