@@ -5,7 +5,7 @@ |
||
| 5 | 5 | public function getConfig() |
| 6 | 6 | { |
| 7 | 7 | $customSettings = []; |
| 8 | - Settings::get(['key', 'value'])->each(function ($setting) use (&$customSettings){ |
|
| 8 | + Settings::get(['key', 'value'])->each(function($setting) use (&$customSettings){ |
|
| 9 | 9 | $customSettings[$setting['key']] = $setting['value']; |
| 10 | 10 | }); |
| 11 | 11 | |
@@ -3,7 +3,7 @@ |
||
| 3 | 3 | use Illuminate\Database\Eloquent\Model; |
| 4 | 4 | use Illuminate\Database\Eloquent\SoftDeletes; |
| 5 | 5 | |
| 6 | -class Log extends Model{ |
|
| 6 | +class Log extends Model { |
|
| 7 | 7 | |
| 8 | 8 | use SoftDeletes; |
| 9 | 9 | protected $table = 'logs'; |
@@ -12,11 +12,11 @@ |
||
| 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(); |
|
| 19 | - $table->string('value',100); |
|
| 17 | + $table->string('name', 100); |
|
| 18 | + $table->string('key', 100)->unique(); |
|
| 19 | + $table->string('value', 100); |
|
| 20 | 20 | $table->softDeletes(); |
| 21 | 21 | $table->timestamps(); |
| 22 | 22 | }); |
@@ -12,11 +12,11 @@ |
||
| 12 | 12 | */ |
| 13 | 13 | public function up() |
| 14 | 14 | { |
| 15 | - Schema::create('logs', function (Blueprint $table) { |
|
| 15 | + Schema::create('logs', function(Blueprint $table) { |
|
| 16 | 16 | $table->increments('id'); |
| 17 | - $table->string('action',100); |
|
| 18 | - $table->string('item_name',100); |
|
| 19 | - $table->string('item_type',100); |
|
| 17 | + $table->string('action', 100); |
|
| 18 | + $table->string('item_name', 100); |
|
| 19 | + $table->string('item_type', 100); |
|
| 20 | 20 | $table->integer('item_id'); |
| 21 | 21 | $table->integer('user_id'); |
| 22 | 22 | $table->softDeletes(); |
@@ -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 | |
| 15 | 15 | public function getCreatedAtAttribute($value) |
| 16 | 16 | { |
@@ -18,7 +18,7 @@ |
||
| 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 | 24 | return \App::make($class); |
@@ -12,5 +12,5 @@ |
||
| 12 | 12 | * to preform actions like (add, edit ... etc). |
| 13 | 13 | * @var string |
| 14 | 14 | */ |
| 15 | - protected $model = 'logs'; |
|
| 15 | + protected $model = 'logs'; |
|
| 16 | 16 | } |
@@ -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 | 'name' => 'required|string|max:100', |
| 25 | 25 | 'value' => 'required|string|max:100' |
| 26 | 26 | ]; |
@@ -47,7 +47,7 @@ |
||
| 47 | 47 | $this->skipLoginCheck = property_exists($this, 'skipLoginCheck') ? $this->skipLoginCheck : []; |
| 48 | 48 | |
| 49 | 49 | $this->relations = array_key_exists($this->model, $this->config['relations']) ? $this->config['relations'][$this->model] : false; |
| 50 | - $route = explode('@',\Route::currentRouteAction())[1]; |
|
| 50 | + $route = explode('@', \Route::currentRouteAction())[1]; |
|
| 51 | 51 | $this->checkPermission(explode('_', snake_case($route))[1]); |
| 52 | 52 | } |
| 53 | 53 | |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | /** |
| 38 | 38 | * Fetch all records with relations from model repository. |
| 39 | 39 | * |
| 40 | - * @return \Illuminate\Http\Response |
|
| 40 | + * @return \Illuminate\Http\JsonResponse|null |
|
| 41 | 41 | */ |
| 42 | 42 | public function getIndex() |
| 43 | 43 | { |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | * Fetch the single object with relations from model repository. |
| 53 | 53 | * |
| 54 | 54 | * @param integer $id |
| 55 | - * @return \Illuminate\Http\Response |
|
| 55 | + * @return \Illuminate\Http\JsonResponse|null |
|
| 56 | 56 | */ |
| 57 | 57 | public function getFind($id) |
| 58 | 58 | { |
@@ -70,8 +70,8 @@ discard block |
||
| 70 | 70 | * @param string $query |
| 71 | 71 | * @param integer $perPage |
| 72 | 72 | * @param string $sortBy |
| 73 | - * @param boolean $desc |
|
| 74 | - * @return \Illuminate\Http\Response |
|
| 73 | + * @param integer $desc |
|
| 74 | + * @return \Illuminate\Http\JsonResponse|null |
|
| 75 | 75 | */ |
| 76 | 76 | public function getSearch($query = '', $perPage = 15, $sortBy = 'created_at', $desc = 1) |
| 77 | 77 | { |
@@ -88,8 +88,8 @@ discard block |
||
| 88 | 88 | * |
| 89 | 89 | * @param \Illuminate\Http\Request $request |
| 90 | 90 | * @param string $sortBy |
| 91 | - * @param boolean $desc |
|
| 92 | - * @return \Illuminate\Http\Response |
|
| 91 | + * @param integer $desc |
|
| 92 | + * @return \Illuminate\Http\JsonResponse|null |
|
| 93 | 93 | */ |
| 94 | 94 | public function postFindby(Request $request, $sortBy = 'created_at', $desc = 1) |
| 95 | 95 | { |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | * condition. |
| 106 | 106 | * |
| 107 | 107 | * @param \Illuminate\Http\Request $request |
| 108 | - * @return \Illuminate\Http\Response |
|
| 108 | + * @return \Illuminate\Http\JsonResponse|null |
|
| 109 | 109 | */ |
| 110 | 110 | public function postFirst(Request $request) |
| 111 | 111 | { |
@@ -121,8 +121,8 @@ discard block |
||
| 121 | 121 | * |
| 122 | 122 | * @param integer $perPage |
| 123 | 123 | * @param string $sortBy |
| 124 | - * @param boolean $desc |
|
| 125 | - * @return \Illuminate\Http\Response |
|
| 124 | + * @param integer $desc |
|
| 125 | + * @return \Illuminate\Http\JsonResponse|null |
|
| 126 | 126 | */ |
| 127 | 127 | public function getPaginate($perPage = 15, $sortBy = 'created_at', $desc = 1) |
| 128 | 128 | { |
@@ -140,8 +140,8 @@ discard block |
||
| 140 | 140 | * @param \Illuminate\Http\Request $request |
| 141 | 141 | * @param integer $perPage |
| 142 | 142 | * @param string $sortBy |
| 143 | - * @param boolean $desc |
|
| 144 | - * @return \Illuminate\Http\Response |
|
| 143 | + * @param integer $desc |
|
| 144 | + * @return \Illuminate\Http\JsonResponse|null |
|
| 145 | 145 | */ |
| 146 | 146 | public function postPaginateby(Request $request, $perPage = 15, $sortBy = 'created_at', $desc = 1) |
| 147 | 147 | { |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | * Save the given model to repository. |
| 157 | 157 | * |
| 158 | 158 | * @param \Illuminate\Http\Request $request |
| 159 | - * @return \Illuminate\Http\Response |
|
| 159 | + * @return \Illuminate\Http\JsonResponse|null |
|
| 160 | 160 | */ |
| 161 | 161 | public function postSave(Request $request) |
| 162 | 162 | { |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | * Delete by the given id from model repository. |
| 190 | 190 | * |
| 191 | 191 | * @param integer $id |
| 192 | - * @return \Illuminate\Http\Response |
|
| 192 | + * @return \Illuminate\Http\JsonResponse|null |
|
| 193 | 193 | */ |
| 194 | 194 | public function getDelete($id) |
| 195 | 195 | { |