Skip to content

Commit af21743

Browse files
rappasoftStyleCIBot
authored andcommitted
Apply fixes from StyleCI
1 parent 23244ff commit af21743

File tree

12 files changed

+105
-131
lines changed

12 files changed

+105
-131
lines changed

src/Http/Livewire/Column.php

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,10 @@
55
use Illuminate\Support\Str;
66

77
/**
8-
* Class Column
9-
*
10-
* @package App\Http\Livewire
8+
* Class Column.
119
*/
1210
class Column
1311
{
14-
1512
/**
1613
* @var
1714
*/
@@ -53,7 +50,7 @@ class Column
5350
protected $html = false;
5451

5552
/**
56-
* This column is a custom attribute on the model and not a column in the database
53+
* This column is a custom attribute on the model and not a column in the database.
5754
*
5855
* @var bool
5956
*/
@@ -102,17 +99,19 @@ public static function make($text = null, $attribute = null)
10299
*
103100
* @return $this
104101
*/
105-
public function searchable(callable $callable = null) : self
102+
public function searchable(callable $callable = null): self
106103
{
107104
$this->searchCallback = $callable;
108105
$this->searchable = true;
106+
109107
return $this;
110108
}
111109

112110
/**
113111
* @return bool
114112
*/
115-
public function isSearchable() : bool {
113+
public function isSearchable(): bool
114+
{
116115
return $this->searchable;
117116
}
118117

@@ -121,64 +120,73 @@ public function isSearchable() : bool {
121120
*
122121
* @return $this
123122
*/
124-
public function sortable(callable $callable = null) : self
123+
public function sortable(callable $callable = null): self
125124
{
126125
$this->sortCallback = $callable;
127126
$this->sortable = true;
127+
128128
return $this;
129129
}
130130

131131
/**
132132
* @return bool
133133
*/
134-
public function isSortable() : bool {
134+
public function isSortable(): bool
135+
{
135136
return $this->sortable;
136137
}
137138

138139
/**
139140
* @return $this
140141
*/
141-
public function unescaped() : self
142+
public function unescaped(): self
142143
{
143144
$this->unescaped = true;
145+
144146
return $this;
145147
}
146148

147149
/**
148150
* @return bool
149151
*/
150-
public function isUnescaped() : bool {
152+
public function isUnescaped(): bool
153+
{
151154
return $this->unescaped;
152155
}
153156

154157
/**
155158
* @return $this
156159
*/
157-
public function html() : self
160+
public function html(): self
158161
{
159162
$this->html = true;
163+
160164
return $this;
161165
}
162166

163167
/**
164168
* @return bool
165169
*/
166-
public function isHtml() : bool {
170+
public function isHtml(): bool
171+
{
167172
return $this->html;
168173
}
169174

170175
/**
171176
* @return $this
172177
*/
173-
public function customAttribute() : self {
178+
public function customAttribute(): self
179+
{
174180
$this->customAttribute = true;
181+
175182
return $this;
176183
}
177184

178185
/**
179186
* @return bool
180187
*/
181-
public function isCustomAttribute() : bool {
188+
public function isCustomAttribute(): bool
189+
{
182190
return $this->customAttribute;
183191
}
184192

@@ -187,16 +195,18 @@ public function isCustomAttribute() : bool {
187195
*
188196
* @return $this
189197
*/
190-
public function view($view) : self
198+
public function view($view): self
191199
{
192200
$this->view = $view;
201+
193202
return $this;
194203
}
195204

196205
/**
197206
* @return bool
198207
*/
199-
public function isView() : bool {
208+
public function isView(): bool
209+
{
200210
return view()->exists($this->view);
201211
}
202212
}

src/Http/Livewire/TableComponent.php

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
namespace Rappasoft\LivewireTables\Http\Livewire;
44

5+
use Illuminate\Database\Eloquent\Builder;
6+
use Illuminate\Support\Str;
57
use Illuminate\View\View;
68
use Livewire\Component;
7-
use Illuminate\Support\Str;
89
use Livewire\WithPagination;
9-
use Illuminate\Database\Eloquent\Builder;
1010
use Rappasoft\LivewireTables\Http\Livewire\Traits\Checkboxes;
1111
use Rappasoft\LivewireTables\Http\Livewire\Traits\Loading;
1212
use Rappasoft\LivewireTables\Http\Livewire\Traits\Offline;
@@ -17,13 +17,10 @@
1717
use Rappasoft\LivewireTables\Http\Livewire\Traits\Yajra;
1818

1919
/**
20-
* Class TableComponent
21-
*
22-
* @package App\Http\Livewire
20+
* Class TableComponent.
2321
*/
2422
abstract class TableComponent extends Component
2523
{
26-
2724
use Checkboxes,
2825
Loading,
2926
Offline,
@@ -35,7 +32,7 @@ abstract class TableComponent extends Component
3532
Yajra;
3633

3734
/**
38-
* The classes applied to the wrapper div
35+
* The classes applied to the wrapper div.
3936
*
4037
* @var string
4138
*/
@@ -45,23 +42,25 @@ abstract class TableComponent extends Component
4542
* Whether or not to refresh the table at a certain interval
4643
* false is off
4744
* If it's an integer it will be treated as milliseconds (2000 = refresh every 2 seconds)
48-
* If it's a string it will call that function every 5 seconds
45+
* If it's a string it will call that function every 5 seconds.
4946
*
5047
* @var bool|string
5148
*/
5249
public $refresh = false;
5350

5451
/**
55-
* Constructor
52+
* Constructor.
5653
*/
57-
public function mount() {
54+
public function mount()
55+
{
5856
$this->setTranslationStrings();
5957
}
6058

6159
/**
62-
* Sets the initial translations of these items
60+
* Sets the initial translations of these items.
6361
*/
64-
public function setTranslationStrings() {
62+
public function setTranslationStrings()
63+
{
6564
$this->loadingMessage = __('Loading...');
6665
$this->offlineMessage = __('You are not currently connected to the internet.');
6766
$this->noResultsMessage = __('There are no results to display for this query.');
@@ -72,24 +71,25 @@ public function setTranslationStrings() {
7271
/**
7372
* @return mixed
7473
*/
75-
abstract public function query() : Builder;
74+
abstract public function query(): Builder;
7675

7776
/**
7877
* @return mixed
7978
*/
80-
abstract public function columns() : array ;
79+
abstract public function columns(): array;
8180

8281
/**
8382
* @return string
8483
*/
85-
public function view() : string {
84+
public function view(): string
85+
{
8686
return 'laravel-livewire-tables::table';
8787
}
8888

8989
/**
9090
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
9191
*/
92-
public function render() : View
92+
public function render(): View
9393
{
9494
return view($this->view(), [
9595
'columns' => $this->columns(),
@@ -100,7 +100,7 @@ public function render() : View
100100
/**
101101
* @return Builder
102102
*/
103-
public function models() : Builder
103+
public function models(): Builder
104104
{
105105
$models = $this->query();
106106

@@ -112,12 +112,12 @@ public function models() : Builder
112112
$query = app()->call($column->searchCallback, ['builder' => $query, 'term' => $this->search]);
113113
} elseif (Str::contains($column->attribute, '.')) {
114114
$relationship = $this->relationship($column->attribute);
115-
115+
116116
$query->orWhereHas($relationship->name, function (Builder $query) use ($relationship) {
117-
$query->where($relationship->attribute, 'like', '%' . $this->search . '%');
117+
$query->where($relationship->attribute, 'like', '%'.$this->search.'%');
118118
});
119119
} else {
120-
$query->orWhere($query->getModel()->getTable() . '.' . $column->attribute, 'like', '%' . $this->search . '%');
120+
$query->orWhere($query->getModel()->getTable().'.'.$column->attribute, 'like', '%'.$this->search.'%');
121121
}
122122
}
123123
}

src/Http/Livewire/Traits/Checkboxes.php

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,69 +3,60 @@
33
namespace Rappasoft\LivewireTables\Http\Livewire\Traits;
44

55
/**
6-
* Trait Checkboxes
7-
*
8-
* @package Rappasoft\LivewireTables\Http\Livewire\Traits
6+
* Trait Checkboxes.
97
*/
108
trait Checkboxes
119
{
12-
1310
/**
14-
* Checboxes
11+
* Checboxes.
1512
*/
1613

1714
/**
18-
* Whether or not checkboxes are enabled
15+
* Whether or not checkboxes are enabled.
1916
*
2017
* @var bool
2118
*/
2219
public $checkbox = false;
2320

2421
/**
25-
* The side to put the checkboxes on
22+
* The side to put the checkboxes on.
2623
*
2724
* @var string
2825
*/
2926
public $checkboxLocation = 'left';
3027

3128
/**
32-
* The model attribute to bind to the checkbox array
29+
* The model attribute to bind to the checkbox array.
3330
*
3431
* @var string
3532
*/
3633
public $checkboxAttribute = 'id';
3734

3835
/**
39-
* Whether or not all checkboxes are currently selected
36+
* Whether or not all checkboxes are currently selected.
4037
*
4138
* @var bool
4239
*/
4340
public $checkboxAll = false;
4441

4542
/**
46-
* The currently selected values of the checkboxes
43+
* The currently selected values of the checkboxes.
4744
*
4845
* @var array
4946
*/
5047
public $checkboxValues = [];
5148

52-
/**
53-
*
54-
*/
5549
public function updatedCheckboxAll()
5650
{
5751
$this->checkboxValues = [];
5852

5953
if ($this->checkboxAll) {
6054
$this->models()->each(function ($model) {
61-
$this->checkboxValues[] = (string)$model->{$this->checkboxAttribute};
55+
$this->checkboxValues[] = (string) $model->{$this->checkboxAttribute};
6256
});
6357
}
6458
}
6559

66-
/**
67-
*
68-
*/
6960
public function updatedCheckboxValues()
7061
{
7162
$this->checkboxAll = false;

src/Http/Livewire/Traits/Loading.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,23 @@
33
namespace Rappasoft\LivewireTables\Http\Livewire\Traits;
44

55
/**
6-
* Trait Loading
7-
*
8-
* @package Rappasoft\LivewireTables\Http\Livewire\Traits
6+
* Trait Loading.
97
*/
108
trait Loading
119
{
12-
1310
/**
14-
* Loading
11+
* Loading.
1512
*/
1613

1714
/**
18-
* Whether or not to show a loading indicator when searching
15+
* Whether or not to show a loading indicator when searching.
1916
*
2017
* @var bool
2118
*/
2219
public $loadingIndicator = false;
2320

2421
/**
25-
* The loading message that gets displayed
22+
* The loading message that gets displayed.
2623
*
2724
* @var string
2825
*/

0 commit comments

Comments
 (0)