@@ -12,10 +12,10 @@ |
||
| 12 | 12 | */ |
| 13 | 13 | public function up() |
| 14 | 14 | { |
| 15 | - Schema::create('reports', function (Blueprint $table) { |
|
| 15 | + Schema::create('reports', function(Blueprint $table) { |
|
| 16 | 16 | $table->increments('id'); |
| 17 | - $table->string('report_name',100); |
|
| 18 | - $table->string('view_name',100); |
|
| 17 | + $table->string('report_name', 100); |
|
| 18 | + $table->string('view_name', 100); |
|
| 19 | 19 | $table->softDeletes(); |
| 20 | 20 | $table->timestamps(); |
| 21 | 21 | }); |
@@ -80,7 +80,7 @@ |
||
| 80 | 80 | if ($this->cacheConfig && $this->cacheConfig == 'cache') |
| 81 | 81 | { |
| 82 | 82 | $page = \Request::get('page') !== null ? \Request::get('page') : '1'; |
| 83 | - $cacheKey = $name . $page . \Session::get('locale') . serialize($arguments); |
|
| 83 | + $cacheKey = $name.$page.\Session::get('locale').serialize($arguments); |
|
| 84 | 84 | return $this->cache->tags([$this->cacheTag])->rememberForever($cacheKey, function() use ($arguments, $name) { |
| 85 | 85 | return call_user_func_array([$this->repo, $name], $arguments); |
| 86 | 86 | }); |
@@ -84,8 +84,7 @@ discard block |
||
| 84 | 84 | return $this->cache->tags([$this->cacheTag])->rememberForever($cacheKey, function() use ($arguments, $name) { |
| 85 | 85 | return call_user_func_array([$this->repo, $name], $arguments); |
| 86 | 86 | }); |
| 87 | - } |
|
| 88 | - else if ($this->cacheConfig) |
|
| 87 | + } else if ($this->cacheConfig) |
|
| 89 | 88 | { |
| 90 | 89 | $this->cache->tags($this->cacheConfig)->flush(); |
| 91 | 90 | return call_user_func_array([$this->repo, $name], $arguments); |
@@ -109,8 +108,7 @@ discard block |
||
| 109 | 108 | if ($cacheConfig && in_array($name, $cacheConfig['cache'])) |
| 110 | 109 | { |
| 111 | 110 | $this->cacheConfig = 'cache'; |
| 112 | - } |
|
| 113 | - else if ($cacheConfig && isset($cacheConfig['clear'][$name])) |
|
| 111 | + } else if ($cacheConfig && isset($cacheConfig['clear'][$name])) |
|
| 114 | 112 | { |
| 115 | 113 | $this->cacheConfig = $cacheConfig['clear'][$name]; |
| 116 | 114 | } |
@@ -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) |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | Route::group([ |
| 55 | 55 | 'middleware' => 'web', |
| 56 | 56 | 'namespace' => $this->namespace, |
| 57 | - ], function ($router) { |
|
| 57 | + ], function($router) { |
|
| 58 | 58 | require module_path('core', 'Routes/web.php'); |
| 59 | 59 | }); |
| 60 | 60 | } |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | 'middleware' => 'api', |
| 73 | 73 | 'namespace' => $this->namespace, |
| 74 | 74 | 'prefix' => 'api', |
| 75 | - ], function ($router) { |
|
| 75 | + ], function($router) { |
|
| 76 | 76 | require module_path('core', 'Routes/api.php'); |
| 77 | 77 | }); |
| 78 | 78 | } |
@@ -18,10 +18,10 @@ |
||
| 18 | 18 | { |
| 19 | 19 | foreach ($this->getRepoNameSpace() as $repoNameSpace) |
| 20 | 20 | { |
| 21 | - $class = rtrim($repoNameSpace, '\\') . '\\' . ucfirst(str_singular($name)) . 'Repository'; |
|
| 21 | + $class = rtrim($repoNameSpace, '\\').'\\'.ucfirst(str_singular($name)).'Repository'; |
|
| 22 | 22 | if (class_exists($class)) |
| 23 | 23 | { |
| 24 | - \App::singleton($class, function ($app) use ($class) { |
|
| 24 | + \App::singleton($class, function($app) use ($class) { |
|
| 25 | 25 | |
| 26 | 26 | return new \App\Modules\Core\Decorators\CachingDecorator(new $class, $app['cache.store']); |
| 27 | 27 | }); |
@@ -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); |
@@ -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); |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | |
| 230 | 230 | if ($isPasswordClient && (in_array($permission, $this->skipPermissionCheck) || \Core::users()->can($permission, $this->model))) |
| 231 | 231 | {} |
| 232 | - elseif ( ! $isPasswordClient && $user->tokenCan($this->model . '-' . $permission)) |
|
| 232 | + elseif ( ! $isPasswordClient && $user->tokenCan($this->model.'-'.$permission)) |
|
| 233 | 233 | {} |
| 234 | 234 | else |
| 235 | 235 | { |
@@ -157,8 +157,7 @@ discard block |
||
| 157 | 157 | if ($request->has('id')) |
| 158 | 158 | { |
| 159 | 159 | $rule = str_replace('{id}', $request->get('id'), $rule); |
| 160 | - } |
|
| 161 | - else |
|
| 160 | + } else |
|
| 162 | 161 | { |
| 163 | 162 | $rule = str_replace(',{id}', '', $rule); |
| 164 | 163 | } |
@@ -228,10 +227,8 @@ discard block |
||
| 228 | 227 | } |
| 229 | 228 | |
| 230 | 229 | if ($isPasswordClient && (in_array($permission, $this->skipPermissionCheck) || \Core::users()->can($permission, $this->model))) |
| 231 | - {} |
|
| 232 | - elseif ( ! $isPasswordClient && $user->tokenCan($this->model . '-' . $permission)) |
|
| 233 | - {} |
|
| 234 | - else |
|
| 230 | + {} elseif ( ! $isPasswordClient && $user->tokenCan($this->model . '-' . $permission)) |
|
| 231 | + {} else |
|
| 235 | 232 | { |
| 236 | 233 | |
| 237 | 234 | \ErrorHandler::noPermissions(); |
@@ -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 | ]; |
@@ -11,13 +11,13 @@ discard block |
||
| 11 | 11 | */ |
| 12 | 12 | public function uploadImage($image, $dir) |
| 13 | 13 | { |
| 14 | - $imageName = str_slug('image' . uniqid() . time() . '_' . $image->getClientOriginalName()); |
|
| 15 | - $destinationPath = 'media' . DIRECTORY_SEPARATOR . $dir . DIRECTORY_SEPARATOR; |
|
| 14 | + $imageName = str_slug('image'.uniqid().time().'_'.$image->getClientOriginalName()); |
|
| 15 | + $destinationPath = 'media'.DIRECTORY_SEPARATOR.$dir.DIRECTORY_SEPARATOR; |
|
| 16 | 16 | |
| 17 | 17 | ! file_exists($destinationPath) ? \File::makeDirectory($destinationPath) : false; |
| 18 | 18 | $image->move($destinationPath, $imageName); |
| 19 | 19 | |
| 20 | - return url($destinationPath . $imageName); |
|
| 20 | + return url($destinationPath.$imageName); |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | /** |
@@ -29,20 +29,20 @@ discard block |
||
| 29 | 29 | */ |
| 30 | 30 | public function uploadImageBas64($image, $dir) |
| 31 | 31 | { |
| 32 | - if (! strlen($image)) |
|
| 32 | + if ( ! strlen($image)) |
|
| 33 | 33 | { |
| 34 | 34 | return null; |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - $imageName = 'image' . uniqid() . time() . '.jpg'; |
|
| 38 | - $destinationPath = 'media' . DIRECTORY_SEPARATOR . $dir . DIRECTORY_SEPARATOR; |
|
| 37 | + $imageName = 'image'.uniqid().time().'.jpg'; |
|
| 38 | + $destinationPath = 'media'.DIRECTORY_SEPARATOR.$dir.DIRECTORY_SEPARATOR; |
|
| 39 | 39 | |
| 40 | 40 | ! file_exists($destinationPath) ? \File::makeDirectory($destinationPath) : false; |
| 41 | 41 | |
| 42 | - $base = base64_decode(preg_replace('#^data:image/\w+;base64,#i', '', $image)); |
|
| 43 | - \Image::make($base)->save($destinationPath . $imageName); |
|
| 42 | + $base = base64_decode(preg_replace('#^data:image/\w+;base64,#i', '', $image)); |
|
| 43 | + \Image::make($base)->save($destinationPath.$imageName); |
|
| 44 | 44 | |
| 45 | - return url($destinationPath . $imageName); |
|
| 45 | + return url($destinationPath.$imageName); |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | /** |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | public function deleteImage($path, $dir) |
| 56 | 56 | { |
| 57 | 57 | $arr = explode('/', $path); |
| 58 | - $path = 'media' . DIRECTORY_SEPARATOR . $dir . DIRECTORY_SEPARATOR . end($arr); |
|
| 58 | + $path = 'media'.DIRECTORY_SEPARATOR.$dir.DIRECTORY_SEPARATOR.end($arr); |
|
| 59 | 59 | if (\File::exists($path)) |
| 60 | 60 | { |
| 61 | 61 | \File::delete($path); |