make static analyse part

This commit is contained in:
2024-01-14 13:11:41 +03:00
parent 5e24ef3555
commit 38666bd460
29 changed files with 152 additions and 240 deletions

View File

@@ -7,35 +7,24 @@ use Illuminate\Support\Facades\DB;
use Laravel\Fortify\Contracts\UpdatesUserProfileInformation;
use Livewire\Component;
use Livewire\WithFileUploads;
use Illuminate\Http\UploadedFile;
use App\Models\User;
use Illuminate\View\View;
use Livewire\Features\SupportFileUploads\TemporaryUploadedFile;
class PhotoForm extends Component
{
use WithFileUploads;
/**
* The component's state.
*
* @var array
*/
public $state = [];
public array $state = [];
/**
* The new avatar for the user.
*
* @var mixed
*/
public $photo;
public UploadedFile|string $photo = '';
public $isOnline = false;
public bool|int $isOnline = false;
public $user;
public User $user;
/**
* Prepare the component.
*
* @return void
*/
public function mount()
public function mount(): void
{
$this->state = $this->user->withoutRelations()->toArray();
@@ -51,12 +40,7 @@ class PhotoForm extends Component
$this->isOnline = now()->unix() - $lastActivity < 150;
}
/**
* Update the user's profile information.
*
* @return void
*/
public function updateProfileInformation(UpdatesUserProfileInformation $updater)
public function updateProfileInformation(UpdatesUserProfileInformation $updater): void
{
$this->resetErrorBag();
@@ -70,36 +54,26 @@ class PhotoForm extends Component
$this->dispatch('saved');
}
public function updatedPhoto($newPhoto)
public function updatedPhoto(TemporaryUploadedFile $newPhoto): void
{
Auth::user()->updateProfilePhoto($newPhoto);
$this->dispatch('saved');
}
/**
* Delete user's profile photo.
*
* @return void
*/
public function deleteProfilePhoto()
public function deleteProfilePhoto(): void
{
Auth::user()->deleteProfilePhoto();
$this->dispatch('refresh-navigation-menu');
}
/**
* Get the current user of the application.
*
* @return mixed
*/
public function getUserProperty()
public function getUserProperty(): User
{
return $this->user;
}
public function render()
public function render(): View
{
return view('livewire.profile.photo-form');
}