mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-04 15:32:35 +00:00
Add phpstan level 7(#544)
This commit is contained in:
@ -14,16 +14,22 @@
|
||||
|
||||
class ServersList extends Widget
|
||||
{
|
||||
/**
|
||||
* @return Builder<Server>
|
||||
*/
|
||||
protected function getTableQuery(): Builder
|
||||
{
|
||||
return Server::query()->where('project_id', auth()->user()->current_project_id);
|
||||
/** @var \App\Models\User $user */
|
||||
$user = auth()->user();
|
||||
|
||||
return Server::query()->where('project_id', $user->current_project_id);
|
||||
}
|
||||
|
||||
protected function getTableColumns(): array
|
||||
{
|
||||
return [
|
||||
IconColumn::make('provider')
|
||||
->icon(fn (Server $record) => 'icon-'.$record->provider)
|
||||
->icon(fn (Server $record): string => 'icon-'.$record->provider)
|
||||
->tooltip(fn (Server $record) => $record->provider)
|
||||
->width(24),
|
||||
TextColumn::make('name')
|
||||
@ -53,17 +59,20 @@ protected function getTableColumns(): array
|
||||
|
||||
public function table(Table $table): Table
|
||||
{
|
||||
/** @var \App\Models\User $user */
|
||||
$user = auth()->user();
|
||||
|
||||
return $table
|
||||
->heading(null)
|
||||
->query($this->getTableQuery())
|
||||
->columns($this->getTableColumns())
|
||||
->recordUrl(fn (Server $record) => View::getUrl(parameters: ['server' => $record]))
|
||||
->recordUrl(fn (Server $record): string => View::getUrl(parameters: ['server' => $record]))
|
||||
->actions([
|
||||
Action::make('settings')
|
||||
->label('Settings')
|
||||
->icon('heroicon-o-cog-6-tooth')
|
||||
->authorize(fn ($record) => auth()->user()->can('update', $record))
|
||||
->url(fn (Server $record) => Settings::getUrl(parameters: ['server' => $record])),
|
||||
->authorize(fn ($record) => $user->can('update', $record))
|
||||
->url(fn (Server $record): string => Settings::getUrl(parameters: ['server' => $record])),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user