mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-02 14:36:17 +00:00
Add phpstan level 7(#544)
This commit is contained in:
@ -10,22 +10,31 @@ class SelectProject extends Widget
|
||||
{
|
||||
protected static string $view = 'widgets.select-project';
|
||||
|
||||
public ?Project $currentProject;
|
||||
public ?Project $currentProject = null;
|
||||
|
||||
/**
|
||||
* @var Collection<int, Project>
|
||||
*/
|
||||
public Collection $projects;
|
||||
|
||||
public int|string|null $project;
|
||||
public int|string|null $project = null;
|
||||
|
||||
public function mount(): void
|
||||
{
|
||||
$this->currentProject = auth()->user()->currentProject;
|
||||
$this->projects = auth()->user()->allProjects()->get();
|
||||
/** @var \App\Models\User $user */
|
||||
$user = auth()->user();
|
||||
|
||||
$this->currentProject = $user->currentProject;
|
||||
$this->projects = $user->allProjects()->get();
|
||||
}
|
||||
|
||||
public function updateProject(Project $project): void
|
||||
{
|
||||
/** @var \App\Models\User $user */
|
||||
$user = auth()->user();
|
||||
|
||||
$this->authorize('view', $project);
|
||||
auth()->user()->update(['current_project_id' => $project->id]);
|
||||
$user->update(['current_project_id' => $project->id]);
|
||||
|
||||
$this->redirect('/');
|
||||
}
|
||||
|
Reference in New Issue
Block a user