forked from eatvio/eatvio-infra
make static analyse part
This commit is contained in:
@@ -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');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user