@@ -13,10 +13,10 @@ discard block |
||
| 13 | 13 | public function rules() |
| 14 | 14 | { |
| 15 | 15 | return [ |
| 16 | - 'key' => 'required|string|max:255|unique:' . Denomination::class, |
|
| 16 | + 'key' => 'required|string|max:255|unique:'.Denomination::class, |
|
| 17 | 17 | 'name' => 'required|string|max:255', |
| 18 | 18 | 'value' => 'required|numeric|min:0', |
| 19 | - 'type' => 'required|enum:' . DenominationType::class, |
|
| 19 | + 'type' => 'required|enum:'.DenominationType::class, |
|
| 20 | 20 | 'quantity_per_bundle' => 'required|numeric|min:0', |
| 21 | 21 | 'minimum_order_bundle' => 'required|numeric|min:0', |
| 22 | 22 | 'maximum_order_bundle' => 'required|numeric|gte:minimum_order_bundle', |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | |
| 45 | 45 | $file->storeAs( |
| 46 | 46 | Denomination::IMAGE_PATH, |
| 47 | - $filename = ($this->input('type') . '-' . $this->input('value') . '.' . $file->getClientOriginalExtension()) |
|
| 47 | + $filename = ($this->input('type').'-'.$this->input('value').'.'.$file->getClientOriginalExtension()) |
|
| 48 | 48 | ); |
| 49 | 49 | |
| 50 | 50 | return $filename; |
@@ -15,10 +15,10 @@ discard block |
||
| 15 | 15 | public function rules() |
| 16 | 16 | { |
| 17 | 17 | return [ |
| 18 | - 'key' => ['required', 'string', 'max:255', Rule::unique(Denomination::class)->ignoreModel($this->route('denomination'))], |
|
| 18 | + 'key' => [ 'required', 'string', 'max:255', Rule::unique(Denomination::class)->ignoreModel($this->route('denomination')) ], |
|
| 19 | 19 | 'name' => 'required|string|max:255', |
| 20 | 20 | 'value' => 'required|numeric|min:0', |
| 21 | - 'type' => 'required|enum:' . DenominationType::class, |
|
| 21 | + 'type' => 'required|enum:'.DenominationType::class, |
|
| 22 | 22 | 'quantity_per_bundle' => 'required|numeric|min:0', |
| 23 | 23 | 'minimum_order_bundle' => 'required|numeric|min:0', |
| 24 | 24 | 'maximum_order_bundle' => 'required|numeric|gte:minimum_order_bundle', |
@@ -46,14 +46,14 @@ discard block |
||
| 46 | 46 | $model = $this->route('denomination'); |
| 47 | 47 | |
| 48 | 48 | if ($model->getRawOriginal('image') && $this->hasFile($key)) { |
| 49 | - Storage::delete(Denomination::IMAGE_PATH . '/' . $model->getRawOriginal('image')); |
|
| 49 | + Storage::delete(Denomination::IMAGE_PATH.'/'.$model->getRawOriginal('image')); |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | $file = $this->file($key); |
| 53 | 53 | |
| 54 | 54 | $file->storeAs( |
| 55 | 55 | Denomination::IMAGE_PATH, |
| 56 | - $filename = ($this->input('type') . '-' . $this->input('value') . '.' . $file->getClientOriginalExtension()) |
|
| 56 | + $filename = ($this->input('type').'-'.$this->input('value').'.'.$file->getClientOriginalExtension()) |
|
| 57 | 57 | ); |
| 58 | 58 | |
| 59 | 59 | return $filename; |
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | public function rules() |
| 13 | 13 | { |
| 14 | 14 | return [ |
| 15 | - 'key' => 'required|string|max:255|unique:' . Configuration::class, |
|
| 15 | + 'key' => 'required|string|max:255|unique:'.Configuration::class, |
|
| 16 | 16 | 'value' => 'sometimes|nullable|string|max:255', |
| 17 | 17 | 'description' => 'sometimes|nullable|string', |
| 18 | 18 | ]; |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | public function rules() |
| 14 | 14 | { |
| 15 | 15 | return [ |
| 16 | - 'key' => ['required', 'string', 'max:255', Rule::unique(Configuration::class)->ignoreModel($this->route('configuration'))], |
|
| 16 | + 'key' => [ 'required', 'string', 'max:255', Rule::unique(Configuration::class)->ignoreModel($this->route('configuration')) ], |
|
| 17 | 17 | 'value' => 'sometimes|nullable|string|max:255', |
| 18 | 18 | 'description' => 'sometimes|nullable|string', |
| 19 | 19 | ]; |
@@ -18,22 +18,22 @@ |
||
| 18 | 18 | */ |
| 19 | 19 | public function toArray($request) |
| 20 | 20 | { |
| 21 | - $elements = []; |
|
| 21 | + $elements = [ ]; |
|
| 22 | 22 | |
| 23 | 23 | if ($request->user()->can('view', $this->resource)) { |
| 24 | - $elements[] = view('components.datatables.link-show', [ |
|
| 24 | + $elements[ ] = view('components.datatables.link-show', [ |
|
| 25 | 25 | 'url' => route('admin.denomination.show', $this->resource), |
| 26 | 26 | ])->render(); |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | if ($request->user()->can('update', $this->resource)) { |
| 30 | - $elements[] = view('components.datatables.link-edit', [ |
|
| 30 | + $elements[ ] = view('components.datatables.link-edit', [ |
|
| 31 | 31 | 'url' => route('admin.denomination.edit', $this->resource), |
| 32 | 32 | ])->render(); |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | if ($request->user()->can('delete', $this->resource)) { |
| 36 | - $elements[] = view('components.datatables.link-destroy', [ |
|
| 36 | + $elements[ ] = view('components.datatables.link-destroy', [ |
|
| 37 | 37 | 'url' => route('admin.denomination.destroy', $this->resource), |
| 38 | 38 | ])->render(); |
| 39 | 39 | } |
@@ -20,15 +20,15 @@ |
||
| 20 | 20 | */ |
| 21 | 21 | protected static function bootEvent() |
| 22 | 22 | { |
| 23 | - static::saving(function (Denomination $model) { |
|
| 23 | + static::saving(function(Denomination $model) { |
|
| 24 | 24 | if (!$model->can_order_custom_quantity) { |
| 25 | 25 | $model->minimum_order_quantity = $model->countMinimumOrderQuantityAttribute(); |
| 26 | 26 | $model->maximum_order_quantity = $model->countMaximumOrderQuantityAttribute(); |
| 27 | 27 | } |
| 28 | 28 | }); |
| 29 | 29 | |
| 30 | - static::deleting(function (Denomination $model) { |
|
| 31 | - Storage::delete(Denomination::IMAGE_PATH . '/' . $model->getRawOriginal('image')); |
|
| 30 | + static::deleting(function(Denomination $model) { |
|
| 31 | + Storage::delete(Denomination::IMAGE_PATH.'/'.$model->getRawOriginal('image')); |
|
| 32 | 32 | }); |
| 33 | 33 | } |
| 34 | 34 | } |
@@ -133,49 +133,3 @@ |
||
| 133 | 133 | public function getTypeBadgeAttribute(): string |
| 134 | 134 | { |
| 135 | 135 | return sprintf(<<<'html' |
| 136 | - <span class="badge badge-%s"> |
|
| 137 | - <i class="fa fa-%s"></i> %s |
|
| 138 | - </span> |
|
| 139 | - html, |
|
| 140 | - $this->type->isCoin() ? 'danger' : 'success', |
|
| 141 | - $this->type->isCoin() ? 'coins' : 'money-bill', |
|
| 142 | - $this->type->label |
|
| 143 | - ); |
|
| 144 | - } |
|
| 145 | - |
|
| 146 | - /** |
|
| 147 | - * Return "can_order_custom_quantity_badge" attribute value. |
|
| 148 | - * |
|
| 149 | - * @return string |
|
| 150 | - */ |
|
| 151 | - public function getCanOrderCustomQuantityBadgeAttribute(): string |
|
| 152 | - { |
|
| 153 | - return sprintf(<<<'html' |
|
| 154 | - <span class="badge badge-%s"> |
|
| 155 | - <i class="fa fa-%s"></i> %s |
|
| 156 | - </span> |
|
| 157 | - html, |
|
| 158 | - $this->can_order_custom_quantity ? 'success' : 'danger', |
|
| 159 | - $this->can_order_custom_quantity ? 'check-circle' : 'times-circle', |
|
| 160 | - $this->can_order_custom_quantity ? trans('Yes') : trans('No') |
|
| 161 | - ); |
|
| 162 | - } |
|
| 163 | - |
|
| 164 | - /** |
|
| 165 | - * Return "is_visible_badge" attribute value. |
|
| 166 | - * |
|
| 167 | - * @return string |
|
| 168 | - */ |
|
| 169 | - public function getIsVisibleBadgeAttribute(): string |
|
| 170 | - { |
|
| 171 | - return sprintf(<<<'html' |
|
| 172 | - <span class="badge badge-%s"> |
|
| 173 | - <i class="fa fa-%s"></i> %s |
|
| 174 | - </span> |
|
| 175 | - html, |
|
| 176 | - $this->is_visible ? 'success' : 'danger', |
|
| 177 | - $this->is_visible ? 'check-circle' : 'times-circle', |
|
| 178 | - $this->is_visible ? trans('Yes') : trans('No') |
|
| 179 | - ); |
|
| 180 | - } |
|
| 181 | -} |
|
@@ -133,49 +133,3 @@ |
||
| 133 | 133 | public function getTypeBadgeAttribute(): string |
| 134 | 134 | { |
| 135 | 135 | return sprintf(<<<'html' |
| 136 | - <span class="badge badge-%s"> |
|
| 137 | - <i class="fa fa-%s"></i> %s |
|
| 138 | - </span> |
|
| 139 | - html, |
|
| 140 | - $this->type->isCoin() ? 'danger' : 'success', |
|
| 141 | - $this->type->isCoin() ? 'coins' : 'money-bill', |
|
| 142 | - $this->type->label |
|
| 143 | - ); |
|
| 144 | - } |
|
| 145 | - |
|
| 146 | - /** |
|
| 147 | - * Return "can_order_custom_quantity_badge" attribute value. |
|
| 148 | - * |
|
| 149 | - * @return string |
|
| 150 | - */ |
|
| 151 | - public function getCanOrderCustomQuantityBadgeAttribute(): string |
|
| 152 | - { |
|
| 153 | - return sprintf(<<<'html' |
|
| 154 | - <span class="badge badge-%s"> |
|
| 155 | - <i class="fa fa-%s"></i> %s |
|
| 156 | - </span> |
|
| 157 | - html, |
|
| 158 | - $this->can_order_custom_quantity ? 'success' : 'danger', |
|
| 159 | - $this->can_order_custom_quantity ? 'check-circle' : 'times-circle', |
|
| 160 | - $this->can_order_custom_quantity ? trans('Yes') : trans('No') |
|
| 161 | - ); |
|
| 162 | - } |
|
| 163 | - |
|
| 164 | - /** |
|
| 165 | - * Return "is_visible_badge" attribute value. |
|
| 166 | - * |
|
| 167 | - * @return string |
|
| 168 | - */ |
|
| 169 | - public function getIsVisibleBadgeAttribute(): string |
|
| 170 | - { |
|
| 171 | - return sprintf(<<<'html' |
|
| 172 | - <span class="badge badge-%s"> |
|
| 173 | - <i class="fa fa-%s"></i> %s |
|
| 174 | - </span> |
|
| 175 | - html, |
|
| 176 | - $this->is_visible ? 'success' : 'danger', |
|
| 177 | - $this->is_visible ? 'check-circle' : 'times-circle', |
|
| 178 | - $this->is_visible ? trans('Yes') : trans('No') |
|
| 179 | - ); |
|
| 180 | - } |
|
| 181 | -} |
|
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | return asset('img/dummy.png'); |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | - return Storage::url(static::IMAGE_PATH . '/' . $value); |
|
| 75 | + return Storage::url(static::IMAGE_PATH.'/'.$value); |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | /** |
@@ -133,49 +133,3 @@ discard block |
||
| 133 | 133 | public function getTypeBadgeAttribute(): string |
| 134 | 134 | { |
| 135 | 135 | return sprintf(<<<'html' |
| 136 | - <span class="badge badge-%s"> |
|
| 137 | - <i class="fa fa-%s"></i> %s |
|
| 138 | - </span> |
|
| 139 | - html, |
|
| 140 | - $this->type->isCoin() ? 'danger' : 'success', |
|
| 141 | - $this->type->isCoin() ? 'coins' : 'money-bill', |
|
| 142 | - $this->type->label |
|
| 143 | - ); |
|
| 144 | - } |
|
| 145 | - |
|
| 146 | - /** |
|
| 147 | - * Return "can_order_custom_quantity_badge" attribute value. |
|
| 148 | - * |
|
| 149 | - * @return string |
|
| 150 | - */ |
|
| 151 | - public function getCanOrderCustomQuantityBadgeAttribute(): string |
|
| 152 | - { |
|
| 153 | - return sprintf(<<<'html' |
|
| 154 | - <span class="badge badge-%s"> |
|
| 155 | - <i class="fa fa-%s"></i> %s |
|
| 156 | - </span> |
|
| 157 | - html, |
|
| 158 | - $this->can_order_custom_quantity ? 'success' : 'danger', |
|
| 159 | - $this->can_order_custom_quantity ? 'check-circle' : 'times-circle', |
|
| 160 | - $this->can_order_custom_quantity ? trans('Yes') : trans('No') |
|
| 161 | - ); |
|
| 162 | - } |
|
| 163 | - |
|
| 164 | - /** |
|
| 165 | - * Return "is_visible_badge" attribute value. |
|
| 166 | - * |
|
| 167 | - * @return string |
|
| 168 | - */ |
|
| 169 | - public function getIsVisibleBadgeAttribute(): string |
|
| 170 | - { |
|
| 171 | - return sprintf(<<<'html' |
|
| 172 | - <span class="badge badge-%s"> |
|
| 173 | - <i class="fa fa-%s"></i> %s |
|
| 174 | - </span> |
|
| 175 | - html, |
|
| 176 | - $this->is_visible ? 'success' : 'danger', |
|
| 177 | - $this->is_visible ? 'check-circle' : 'times-circle', |
|
| 178 | - $this->is_visible ? trans('Yes') : trans('No') |
|
| 179 | - ); |
|
| 180 | - } |
|
| 181 | -} |
|
@@ -133,49 +133,3 @@ |
||
| 133 | 133 | public function getTypeBadgeAttribute(): string |
| 134 | 134 | { |
| 135 | 135 | return sprintf(<<<'html' |
| 136 | - <span class="badge badge-%s"> |
|
| 137 | - <i class="fa fa-%s"></i> %s |
|
| 138 | - </span> |
|
| 139 | - html, |
|
| 140 | - $this->type->isCoin() ? 'danger' : 'success', |
|
| 141 | - $this->type->isCoin() ? 'coins' : 'money-bill', |
|
| 142 | - $this->type->label |
|
| 143 | - ); |
|
| 144 | - } |
|
| 145 | - |
|
| 146 | - /** |
|
| 147 | - * Return "can_order_custom_quantity_badge" attribute value. |
|
| 148 | - * |
|
| 149 | - * @return string |
|
| 150 | - */ |
|
| 151 | - public function getCanOrderCustomQuantityBadgeAttribute(): string |
|
| 152 | - { |
|
| 153 | - return sprintf(<<<'html' |
|
| 154 | - <span class="badge badge-%s"> |
|
| 155 | - <i class="fa fa-%s"></i> %s |
|
| 156 | - </span> |
|
| 157 | - html, |
|
| 158 | - $this->can_order_custom_quantity ? 'success' : 'danger', |
|
| 159 | - $this->can_order_custom_quantity ? 'check-circle' : 'times-circle', |
|
| 160 | - $this->can_order_custom_quantity ? trans('Yes') : trans('No') |
|
| 161 | - ); |
|
| 162 | - } |
|
| 163 | - |
|
| 164 | - /** |
|
| 165 | - * Return "is_visible_badge" attribute value. |
|
| 166 | - * |
|
| 167 | - * @return string |
|
| 168 | - */ |
|
| 169 | - public function getIsVisibleBadgeAttribute(): string |
|
| 170 | - { |
|
| 171 | - return sprintf(<<<'html' |
|
| 172 | - <span class="badge badge-%s"> |
|
| 173 | - <i class="fa fa-%s"></i> %s |
|
| 174 | - </span> |
|
| 175 | - html, |
|
| 176 | - $this->is_visible ? 'success' : 'danger', |
|
| 177 | - $this->is_visible ? 'check-circle' : 'times-circle', |
|
| 178 | - $this->is_visible ? trans('Yes') : trans('No') |
|
| 179 | - ); |
|
| 180 | - } |
|
| 181 | -} |
|
@@ -133,49 +133,3 @@ |
||
| 133 | 133 | public function getTypeBadgeAttribute(): string |
| 134 | 134 | { |
| 135 | 135 | return sprintf(<<<'html' |
| 136 | - <span class="badge badge-%s"> |
|
| 137 | - <i class="fa fa-%s"></i> %s |
|
| 138 | - </span> |
|
| 139 | - html, |
|
| 140 | - $this->type->isCoin() ? 'danger' : 'success', |
|
| 141 | - $this->type->isCoin() ? 'coins' : 'money-bill', |
|
| 142 | - $this->type->label |
|
| 143 | - ); |
|
| 144 | - } |
|
| 145 | - |
|
| 146 | - /** |
|
| 147 | - * Return "can_order_custom_quantity_badge" attribute value. |
|
| 148 | - * |
|
| 149 | - * @return string |
|
| 150 | - */ |
|
| 151 | - public function getCanOrderCustomQuantityBadgeAttribute(): string |
|
| 152 | - { |
|
| 153 | - return sprintf(<<<'html' |
|
| 154 | - <span class="badge badge-%s"> |
|
| 155 | - <i class="fa fa-%s"></i> %s |
|
| 156 | - </span> |
|
| 157 | - html, |
|
| 158 | - $this->can_order_custom_quantity ? 'success' : 'danger', |
|
| 159 | - $this->can_order_custom_quantity ? 'check-circle' : 'times-circle', |
|
| 160 | - $this->can_order_custom_quantity ? trans('Yes') : trans('No') |
|
| 161 | - ); |
|
| 162 | - } |
|
| 163 | - |
|
| 164 | - /** |
|
| 165 | - * Return "is_visible_badge" attribute value. |
|
| 166 | - * |
|
| 167 | - * @return string |
|
| 168 | - */ |
|
| 169 | - public function getIsVisibleBadgeAttribute(): string |
|
| 170 | - { |
|
| 171 | - return sprintf(<<<'html' |
|
| 172 | - <span class="badge badge-%s"> |
|
| 173 | - <i class="fa fa-%s"></i> %s |
|
| 174 | - </span> |
|
| 175 | - html, |
|
| 176 | - $this->is_visible ? 'success' : 'danger', |
|
| 177 | - $this->is_visible ? 'check-circle' : 'times-circle', |
|
| 178 | - $this->is_visible ? trans('Yes') : trans('No') |
|
| 179 | - ); |
|
| 180 | - } |
|
| 181 | -} |
|
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | */ |
| 20 | 20 | protected static function bootEvent() |
| 21 | 21 | { |
| 22 | - static::saving(function (Item $model) { |
|
| 22 | + static::saving(function(Item $model) { |
|
| 23 | 23 | if (is_null($model->getAttributeFromArray('quantity_per_bundle'))) { |
| 24 | 24 | $model->quantity_per_bundle = $model->getDenominationRelationValue()->quantity_per_bundle; |
| 25 | 25 | } |
@@ -69,13 +69,3 @@ |
||
| 69 | 69 | public function getIsOrderCustomQuantityBadgeAttribute(): string |
| 70 | 70 | { |
| 71 | 71 | return sprintf(<<<'html' |
| 72 | - <span class="badge badge-%s"> |
|
| 73 | - <i class="fa fa-%s"></i> %s |
|
| 74 | - </span> |
|
| 75 | - html, |
|
| 76 | - $this->is_order_custom_quantity ? 'success' : 'danger', |
|
| 77 | - $this->is_order_custom_quantity ? 'check-circle' : 'times-circle', |
|
| 78 | - $this->is_order_custom_quantity ? trans('Yes') : trans('No') |
|
| 79 | - ); |
|
| 80 | - } |
|
| 81 | -} |
|
@@ -69,13 +69,3 @@ |
||
| 69 | 69 | public function getIsOrderCustomQuantityBadgeAttribute(): string |
| 70 | 70 | { |
| 71 | 71 | return sprintf(<<<'html' |
| 72 | - <span class="badge badge-%s"> |
|
| 73 | - <i class="fa fa-%s"></i> %s |
|
| 74 | - </span> |
|
| 75 | - html, |
|
| 76 | - $this->is_order_custom_quantity ? 'success' : 'danger', |
|
| 77 | - $this->is_order_custom_quantity ? 'check-circle' : 'times-circle', |
|
| 78 | - $this->is_order_custom_quantity ? trans('Yes') : trans('No') |
|
| 79 | - ); |
|
| 80 | - } |
|
| 81 | -} |
|
@@ -69,13 +69,3 @@ |
||
| 69 | 69 | public function getIsOrderCustomQuantityBadgeAttribute(): string |
| 70 | 70 | { |
| 71 | 71 | return sprintf(<<<'html' |
| 72 | - <span class="badge badge-%s"> |
|
| 73 | - <i class="fa fa-%s"></i> %s |
|
| 74 | - </span> |
|
| 75 | - html, |
|
| 76 | - $this->is_order_custom_quantity ? 'success' : 'danger', |
|
| 77 | - $this->is_order_custom_quantity ? 'check-circle' : 'times-circle', |
|
| 78 | - $this->is_order_custom_quantity ? trans('Yes') : trans('No') |
|
| 79 | - ); |
|
| 80 | - } |
|
| 81 | -} |
|
@@ -69,13 +69,3 @@ |
||
| 69 | 69 | public function getIsOrderCustomQuantityBadgeAttribute(): string |
| 70 | 70 | { |
| 71 | 71 | return sprintf(<<<'html' |
| 72 | - <span class="badge badge-%s"> |
|
| 73 | - <i class="fa fa-%s"></i> %s |
|
| 74 | - </span> |
|
| 75 | - html, |
|
| 76 | - $this->is_order_custom_quantity ? 'success' : 'danger', |
|
| 77 | - $this->is_order_custom_quantity ? 'check-circle' : 'times-circle', |
|
| 78 | - $this->is_order_custom_quantity ? trans('Yes') : trans('No') |
|
| 79 | - ); |
|
| 80 | - } |
|
| 81 | -} |
|
@@ -69,13 +69,3 @@ |
||
| 69 | 69 | public function getIsOrderCustomQuantityBadgeAttribute(): string |
| 70 | 70 | { |
| 71 | 71 | return sprintf(<<<'html' |
| 72 | - <span class="badge badge-%s"> |
|
| 73 | - <i class="fa fa-%s"></i> %s |
|
| 74 | - </span> |
|
| 75 | - html, |
|
| 76 | - $this->is_order_custom_quantity ? 'success' : 'danger', |
|
| 77 | - $this->is_order_custom_quantity ? 'check-circle' : 'times-circle', |
|
| 78 | - $this->is_order_custom_quantity ? trans('Yes') : trans('No') |
|
| 79 | - ); |
|
| 80 | - } |
|
| 81 | -} |
|