@@ -493,7 +493,7 @@ |
||
| 493 | 493 | |
| 494 | 494 | public function isSortableByWeight() |
| 495 | 495 | { |
| 496 | - return (bool) $this->getSortableWeightFieldName(); |
|
| 496 | + return (bool)$this->getSortableWeightFieldName(); |
|
| 497 | 497 | } |
| 498 | 498 | |
| 499 | 499 | public function isSortableByWeightActive() |
@@ -5,18 +5,18 @@ discard block |
||
| 5 | 5 | use Illuminate\Http\Request; |
| 6 | 6 | use Yaro\Jarboe\Table\CRUD; |
| 7 | 7 | |
| 8 | -class MassDeleteTool extends AbstractTool |
|
| 9 | -{
|
|
| 8 | +class MassDeleteTool extends AbstractTool |
|
| 9 | +{ |
|
| 10 | 10 | /** |
| 11 | 11 | * Set CRUD object. |
| 12 | 12 | * |
| 13 | 13 | * @param CRUD $crud |
| 14 | 14 | */ |
| 15 | - public function setCrud(CRUD $crud) |
|
| 16 | - {
|
|
| 15 | + public function setCrud(CRUD $crud) |
|
| 16 | + { |
|
| 17 | 17 | parent::setCrud($crud); |
| 18 | 18 | |
| 19 | - if ($this->check()) {
|
|
| 19 | + if ($this->check()) { |
|
| 20 | 20 | $this->crud()->enableBatchCheckboxes(true); |
| 21 | 21 | } |
| 22 | 22 | } |
@@ -24,8 +24,8 @@ discard block |
||
| 24 | 24 | /** |
| 25 | 25 | * Position where should tool be placed. |
| 26 | 26 | */ |
| 27 | - public function position() |
|
| 28 | - {
|
|
| 27 | + public function position() |
|
| 28 | + { |
|
| 29 | 29 | return self::POSITION_BODY_TOP; |
| 30 | 30 | } |
| 31 | 31 | |
@@ -40,8 +40,8 @@ discard block |
||
| 40 | 40 | /** |
| 41 | 41 | * Tool's view. |
| 42 | 42 | */ |
| 43 | - public function render() |
|
| 44 | - {
|
|
| 43 | + public function render() |
|
| 44 | + { |
|
| 45 | 45 | return view('jarboe::crud.toolbar.mass_delete', [
|
| 46 | 46 | 'tool' => $this, |
| 47 | 47 | 'crud' => $this->crud(), |
@@ -55,24 +55,24 @@ discard block |
||
| 55 | 55 | * |
| 56 | 56 | * @return \Illuminate\Http\JsonResponse |
| 57 | 57 | */ |
| 58 | - public function handle(Request $request) |
|
| 59 | - {
|
|
| 58 | + public function handle(Request $request) |
|
| 59 | + { |
|
| 60 | 60 | $errors = []; |
| 61 | 61 | $hidden = []; |
| 62 | 62 | $removed = []; |
| 63 | - foreach ($request->get('ids') as $id) {
|
|
| 64 | - try {
|
|
| 65 | - if (!$this->crud()->repo()->delete($id)) {
|
|
| 63 | + foreach ($request->get('ids') as $id) { |
|
| 64 | + try { |
|
| 65 | + if (!$this->crud()->repo()->delete($id)) { |
|
| 66 | 66 | throw new \Exception(__('jarboe::toolbar.mass_delete.delete_event_failed'));
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | - try {
|
|
| 69 | + try { |
|
| 70 | 70 | $this->crud()->repo()->find($id); |
| 71 | 71 | $hidden[] = $id; |
| 72 | - } catch (\Exception $e) {
|
|
| 72 | + } catch (\Exception $e) { |
|
| 73 | 73 | $removed[] = $id; |
| 74 | 74 | } |
| 75 | - } catch (\Exception $e) {
|
|
| 75 | + } catch (\Exception $e) { |
|
| 76 | 76 | $errors[$id] = $e->getMessage(); |
| 77 | 77 | } |
| 78 | 78 | } |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | $query->where( |
| 43 | 43 | $this->field()->getRelationTitleField(), |
| 44 | 44 | $sign, |
| 45 | - $leftPart . $value . $rightPart |
|
| 45 | + $leftPart.$value.$rightPart |
|
| 46 | 46 | ); |
| 47 | 47 | }); |
| 48 | 48 | return; |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | $query->where( |
| 52 | 52 | $this->field->name(), |
| 53 | 53 | $sign, |
| 54 | - $leftPart . $value . $rightPart |
|
| 54 | + $leftPart.$value.$rightPart |
|
| 55 | 55 | ); |
| 56 | 56 | } |
| 57 | 57 | } |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | $view .= '_range'; |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | - return view('jarboe::crud.filters.'. $view, [ |
|
| 28 | + return view('jarboe::crud.filters.'.$view, [ |
|
| 29 | 29 | 'filter' => $this, |
| 30 | 30 | ])->render(); |
| 31 | 31 | } |
@@ -38,10 +38,10 @@ discard block |
||
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | if ($this->isRange()) { |
| 41 | - $model->when($value['from'] ?? null, function ($query, $value) { |
|
| 41 | + $model->when($value['from'] ?? null, function($query, $value) { |
|
| 42 | 42 | return $query->whereDate($this->field()->name(), '>=', $value); |
| 43 | 43 | }); |
| 44 | - $model->when($value['to'] ?? null, function ($query, $value) { |
|
| 44 | + $model->when($value['to'] ?? null, function($query, $value) { |
|
| 45 | 45 | return $query->whereDate($this->field()->name(), '<=', $value); |
| 46 | 46 | }); |
| 47 | 47 | return; |
@@ -40,7 +40,7 @@ |
||
| 40 | 40 | $model->where( |
| 41 | 41 | $this->field()->name(), |
| 42 | 42 | $sign, |
| 43 | - $leftPart . $this->value() . $rightPart |
|
| 43 | + $leftPart.$this->value().$rightPart |
|
| 44 | 44 | ); |
| 45 | 45 | } |
| 46 | 46 | } |
| 47 | 47 | \ No newline at end of file |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | $query->where( |
| 44 | 44 | $this->field()->getRelationTitleField(), |
| 45 | 45 | $sign, |
| 46 | - $leftPart . $value . $rightPart |
|
| 46 | + $leftPart.$value.$rightPart |
|
| 47 | 47 | ); |
| 48 | 48 | }); |
| 49 | 49 | return; |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | $query->where( |
| 53 | 53 | $this->field()->name(), |
| 54 | 54 | $sign, |
| 55 | - $leftPart . $value . $rightPart |
|
| 55 | + $leftPart.$value.$rightPart |
|
| 56 | 56 | ); |
| 57 | 57 | } |
| 58 | 58 | } |
| 59 | 59 | \ No newline at end of file |
@@ -49,7 +49,7 @@ |
||
| 49 | 49 | |
| 50 | 50 | public function getCurrentLocale($tableIdentifier) |
| 51 | 51 | { |
| 52 | - $key = sprintf('%s.%s.locale',self::PREFIX, $tableIdentifier); |
|
| 52 | + $key = sprintf('%s.%s.locale', self::PREFIX, $tableIdentifier); |
|
| 53 | 53 | |
| 54 | 54 | return session($key); |
| 55 | 55 | } |
@@ -57,7 +57,7 @@ |
||
| 57 | 57 | { |
| 58 | 58 | $template = $this->isReadonly() ? 'readonly' : 'edit'; |
| 59 | 59 | |
| 60 | - return view('jarboe::crud.fields.file.'. $template, [ |
|
| 60 | + return view('jarboe::crud.fields.file.'.$template, [ |
|
| 61 | 61 | 'model' => $model, |
| 62 | 62 | 'field' => $this, |
| 63 | 63 | ])->render(); |
@@ -41,7 +41,7 @@ |
||
| 41 | 41 | { |
| 42 | 42 | $template = $this->isReadonly() ? 'readonly' : 'edit'; |
| 43 | 43 | |
| 44 | - return view('jarboe::crud.fields.number.'. $template, [ |
|
| 44 | + return view('jarboe::crud.fields.number.'.$template, [ |
|
| 45 | 45 | 'model' => $model, |
| 46 | 46 | 'field' => $this, |
| 47 | 47 | ])->render(); |