@@ -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 |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | /** |
62 | 62 | * Fetch all records with relations from model repository. |
63 | 63 | * |
64 | - * @return \Illuminate\Http\Response |
|
64 | + * @return \Illuminate\Http\JsonResponse|null |
|
65 | 65 | */ |
66 | 66 | public function index() |
67 | 67 | { |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | * Fetch the single object with relations from model repository. |
77 | 77 | * |
78 | 78 | * @param integer $id |
79 | - * @return \Illuminate\Http\Response |
|
79 | + * @return \Illuminate\Http\JsonResponse|null |
|
80 | 80 | */ |
81 | 81 | public function find($id) |
82 | 82 | { |
@@ -94,8 +94,8 @@ discard block |
||
94 | 94 | * @param string $query |
95 | 95 | * @param integer $perPage |
96 | 96 | * @param string $sortBy |
97 | - * @param boolean $desc |
|
98 | - * @return \Illuminate\Http\Response |
|
97 | + * @param integer $desc |
|
98 | + * @return \Illuminate\Http\JsonResponse|null |
|
99 | 99 | */ |
100 | 100 | public function search($query = '', $perPage = 15, $sortBy = 'created_at', $desc = 1) |
101 | 101 | { |
@@ -112,8 +112,8 @@ discard block |
||
112 | 112 | * |
113 | 113 | * @param \Illuminate\Http\Request $request |
114 | 114 | * @param string $sortBy |
115 | - * @param boolean $desc |
|
116 | - * @return \Illuminate\Http\Response |
|
115 | + * @param integer $desc |
|
116 | + * @return \Illuminate\Http\JsonResponse|null |
|
117 | 117 | */ |
118 | 118 | public function findby(Request $request, $sortBy = 'created_at', $desc = 1) |
119 | 119 | { |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | * condition. |
130 | 130 | * |
131 | 131 | * @param \Illuminate\Http\Request $request |
132 | - * @return \Illuminate\Http\Response |
|
132 | + * @return \Illuminate\Http\JsonResponse|null |
|
133 | 133 | */ |
134 | 134 | public function first(Request $request) |
135 | 135 | { |
@@ -145,8 +145,8 @@ discard block |
||
145 | 145 | * |
146 | 146 | * @param integer $perPage |
147 | 147 | * @param string $sortBy |
148 | - * @param boolean $desc |
|
149 | - * @return \Illuminate\Http\Response |
|
148 | + * @param integer $desc |
|
149 | + * @return \Illuminate\Http\JsonResponse|null |
|
150 | 150 | */ |
151 | 151 | public function paginate($perPage = 15, $sortBy = 'created_at', $desc = 1) |
152 | 152 | { |
@@ -164,8 +164,8 @@ discard block |
||
164 | 164 | * @param \Illuminate\Http\Request $request |
165 | 165 | * @param integer $perPage |
166 | 166 | * @param string $sortBy |
167 | - * @param boolean $desc |
|
168 | - * @return \Illuminate\Http\Response |
|
167 | + * @param integer $desc |
|
168 | + * @return \Illuminate\Http\JsonResponse|null |
|
169 | 169 | */ |
170 | 170 | public function paginateby(Request $request, $perPage = 15, $sortBy = 'created_at', $desc = 1) |
171 | 171 | { |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | * Save the given model to repository. |
181 | 181 | * |
182 | 182 | * @param \Illuminate\Http\Request $request |
183 | - * @return \Illuminate\Http\Response |
|
183 | + * @return \Illuminate\Http\JsonResponse|null |
|
184 | 184 | */ |
185 | 185 | public function save(Request $request) |
186 | 186 | { |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | * Delete by the given id from model repository. |
214 | 214 | * |
215 | 215 | * @param integer $id |
216 | - * @return \Illuminate\Http\Response |
|
216 | + * @return \Illuminate\Http\JsonResponse|null |
|
217 | 217 | */ |
218 | 218 | public function delete($id) |
219 | 219 | { |
@@ -229,8 +229,8 @@ discard block |
||
229 | 229 | * @param \Illuminate\Http\Request $request |
230 | 230 | * @param integer $perPage |
231 | 231 | * @param string $sortBy |
232 | - * @param boolean $desc |
|
233 | - * @return \Illuminate\Http\Response |
|
232 | + * @param integer $desc |
|
233 | + * @return \Illuminate\Http\JsonResponse |
|
234 | 234 | */ |
235 | 235 | public function deleted(Request $request, $perPage = 15, $sortBy = 'created_at', $desc = 1) |
236 | 236 | { |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | * Restore the deleted model. |
242 | 242 | * |
243 | 243 | * @param integer $id |
244 | - * @return \Illuminate\Http\Response |
|
244 | + * @return \Illuminate\Http\JsonResponse|null |
|
245 | 245 | */ |
246 | 246 | public function restore($id) |
247 | 247 | { |