forked from eatvio/eatvio-infra
make static analyse part
This commit is contained in:
@@ -11,19 +11,19 @@ use Mcamara\LaravelLocalization\Facades\LaravelLocalization;
|
||||
|
||||
class CalendarController extends Controller
|
||||
{
|
||||
public $weekStartsAt;
|
||||
public int $weekStartsAt;
|
||||
|
||||
public $weekEndsAt;
|
||||
public int $weekEndsAt;
|
||||
|
||||
public $startsAt;
|
||||
public Carbon $startsAt;
|
||||
|
||||
public $endsAt;
|
||||
public Carbon $endsAt;
|
||||
|
||||
public $gridStartsAt;
|
||||
public Carbon $gridStartsAt;
|
||||
|
||||
public $gridEndsAt;
|
||||
public Carbon $gridEndsAt;
|
||||
|
||||
public function __construct($initialYear = null, $initialMonth = null, $weekStartsAt = null)
|
||||
public function __construct(int $initialYear = null, int $initialMonth = null, int $weekStartsAt = null)
|
||||
{
|
||||
$this->weekStartsAt = $weekStartsAt ?? Carbon::MONDAY;
|
||||
$this->weekEndsAt = $this->weekStartsAt === Carbon::MONDAY
|
||||
@@ -38,7 +38,7 @@ class CalendarController extends Controller
|
||||
$this->calculateGridStartsEnds();
|
||||
}
|
||||
|
||||
public function calculateGridStartsEnds()
|
||||
public function calculateGridStartsEnds(): void
|
||||
{
|
||||
$this->gridStartsAt = $this->startsAt->clone()->startOfWeek($this->weekStartsAt);
|
||||
$this->gridEndsAt = $this->endsAt->clone()->endOfWeek($this->weekEndsAt);
|
||||
@@ -53,7 +53,7 @@ class CalendarController extends Controller
|
||||
$this->gridEndsAt
|
||||
);
|
||||
$filledDays = Diary::where('user_id', $curUser->id)
|
||||
->whereMonth('date', now()->month)
|
||||
->whereMonth('date', (string) now()->month)
|
||||
->get()
|
||||
->keyBy('date');
|
||||
|
||||
|
||||
@@ -9,21 +9,21 @@ use Illuminate\View\View;
|
||||
|
||||
class ChatMessage
|
||||
{
|
||||
public $id;
|
||||
public int $id;
|
||||
|
||||
public $payload;
|
||||
public int $payload;
|
||||
|
||||
public function __construct($id, $payload)
|
||||
public function __construct(int $id, int $payload)
|
||||
{
|
||||
$this->id = $id;
|
||||
$this->payload = $payload;
|
||||
}
|
||||
|
||||
public function someRandomFillFunction()
|
||||
public function someRandomFillFunction(): void
|
||||
{
|
||||
$users1 = User::all()->pluck('id');
|
||||
$users2 = User::all()->pluck('id');
|
||||
$faker = Faker\Factory::create();
|
||||
$faker = \Faker\Factory::create();
|
||||
|
||||
$users1->each(
|
||||
function ($user1, $key) use ($faker, $users2) {
|
||||
@@ -94,11 +94,11 @@ class ChatController extends Controller
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
// * @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
public function create(): void
|
||||
{
|
||||
ChatMessageUpdated::dispatch(new ChatMessage(time(), 'some text '.md5(time())));
|
||||
// ChatMessageUpdated::dispatch(new ChatMessage(time(), 'some text '.md5(time())));
|
||||
}
|
||||
|
||||
public function show(int $lastChatUser): View
|
||||
@@ -129,7 +129,7 @@ class ChatController extends Controller
|
||||
);
|
||||
}
|
||||
|
||||
private function makeChanName($from, $to)
|
||||
private function makeChanName(int $from = null, int $to = null): string
|
||||
{
|
||||
return (int) $from < (int) $to
|
||||
? $from.'_'.$to
|
||||
|
||||
@@ -32,7 +32,7 @@ class DiaryController extends Controller
|
||||
return view('diary.show', ['curDiary' => $diary, 'daysCount' => $daysCount]);
|
||||
}
|
||||
|
||||
public function edit($id): View
|
||||
public function edit(int $id): View
|
||||
{
|
||||
$curDiary = Diary::find($id);
|
||||
$daysCount = Diary::where('user_id', auth()->id())->count();
|
||||
@@ -47,7 +47,7 @@ class DiaryController extends Controller
|
||||
);
|
||||
}
|
||||
|
||||
public function update(Request $request, $id): RedirectResponse
|
||||
public function update(Request $request, int $id): RedirectResponse
|
||||
{
|
||||
/* dd($request, $id, $request->input()); */
|
||||
$curDiary = Diary::find($id);
|
||||
|
||||
@@ -7,66 +7,31 @@ use Illuminate\Http\Request;
|
||||
|
||||
class FinanceController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
public function index(): void
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
public function create(): void
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
public function store(Request $request): void
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show(Finance $finance)
|
||||
public function show(Finance $finance): void
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit(Finance $finance)
|
||||
public function edit(Finance $finance): void
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, Finance $finance)
|
||||
public function update(Request $request, Finance $finance): void
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy(Finance $finance)
|
||||
public function destroy(Finance $finance): void
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
|
||||
class RegistrationStartController extends Controller
|
||||
{
|
||||
public function start()
|
||||
public function start(): RedirectResponse
|
||||
{
|
||||
session()->flush();
|
||||
|
||||
|
||||
@@ -8,67 +8,32 @@ use Illuminate\Http\Request;
|
||||
|
||||
class UserController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
public function index(): void
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
public function create(): void
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
public function store(Request $request): void
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show(User $user)
|
||||
public function show(User $user): void
|
||||
{
|
||||
/* return view('user.show', ['user' => $user]); */
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit(UserDetailz $userDetailz)
|
||||
public function edit(UserDetailz $userDetailz): void
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, UserDetailz $userDetailz)
|
||||
public function update(Request $request, UserDetailz $userDetailz): void
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy(UserDetailz $userDetailz)
|
||||
public function destroy(UserDetailz $userDetailz): void
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,18 +6,20 @@ use App\Models\ProductGroup;
|
||||
use App\Models\ProductNutritionalValue;
|
||||
use Livewire\Component;
|
||||
use Livewire\WithFileUploads;
|
||||
use Illuminate\View\View;
|
||||
use Illuminate\Http\UploadedFile;
|
||||
|
||||
class Create extends Component
|
||||
{
|
||||
use WithFileUploads;
|
||||
|
||||
public $name;
|
||||
public string $name = '';
|
||||
|
||||
public $product_group;
|
||||
public ProductGroup|null $product_group = null;
|
||||
|
||||
public $image;
|
||||
public UploadedFile|null $image = null;
|
||||
|
||||
public $description;
|
||||
public string $description = '';
|
||||
|
||||
public $formulations;
|
||||
|
||||
@@ -41,7 +43,7 @@ class Create extends Component
|
||||
|
||||
public $curProductNutritionalValue;
|
||||
|
||||
public function render()
|
||||
public function render(): View
|
||||
{
|
||||
return view('livewire.product-nutritional.create', ['productGroups' => ProductGroup::all()]);
|
||||
}
|
||||
@@ -70,7 +72,7 @@ class Create extends Component
|
||||
return redirect()->route('product_nutritional_value.index');
|
||||
}
|
||||
|
||||
public function recalulateVals($mass)
|
||||
public function recalulateVals(int $mass): void
|
||||
{
|
||||
$productKeys = [
|
||||
['energy_on_100gr', 'energy_on_portion'],
|
||||
@@ -89,7 +91,7 @@ class Create extends Component
|
||||
}
|
||||
}
|
||||
|
||||
public function recalulatePortionVals($mass)
|
||||
public function recalulatePortionVals(int $mass): void
|
||||
{
|
||||
$productKeys = [
|
||||
['energy_on_100gr', 'energy_on_portion'],
|
||||
@@ -107,7 +109,7 @@ class Create extends Component
|
||||
}
|
||||
}
|
||||
|
||||
public function updated($name, $value)
|
||||
public function updated(string $name, $value): void
|
||||
{
|
||||
if ($name === 'portion_mass_gr') {
|
||||
$this->recalulatePortionVals((int) $this->portion_mass_gr);
|
||||
@@ -121,7 +123,7 @@ class Create extends Component
|
||||
}
|
||||
}
|
||||
|
||||
public function delete()
|
||||
public function delete(): void
|
||||
{
|
||||
$this->reset();
|
||||
$this->curProductNutritionalValue->delete();
|
||||
|
||||
@@ -5,20 +5,26 @@ namespace App\Livewire\Profile;
|
||||
use App\Models\User;
|
||||
use Asantibanez\LivewireCharts\Models\LineChartModel;
|
||||
use Livewire\Component;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class CircumferenceChart extends Component
|
||||
{
|
||||
public User $user;
|
||||
|
||||
protected $listeners = ['circumference-chart-updated' => '$refresh'];
|
||||
protected function getListeners(): array
|
||||
{
|
||||
return ['circumference-chart-updated' => '$refresh'];
|
||||
}
|
||||
|
||||
public function render()
|
||||
public function render(): View
|
||||
{
|
||||
$lastOneMisure = $this
|
||||
->user
|
||||
->circumference_measures()
|
||||
->get()
|
||||
->last();
|
||||
->latest()
|
||||
->first();
|
||||
// ->get()
|
||||
// ->last();
|
||||
|
||||
$lastFourMisures = $this
|
||||
->user
|
||||
|
||||
@@ -2,22 +2,24 @@
|
||||
|
||||
namespace App\Livewire\Profile;
|
||||
|
||||
use App\Models\User;
|
||||
use App\Models\UserDetailz;
|
||||
use Illuminate\View\View;
|
||||
use Livewire\Component;
|
||||
|
||||
class DescriptionForm extends Component
|
||||
{
|
||||
public $description = '';
|
||||
public string $description = '';
|
||||
|
||||
public $user;
|
||||
public User $user;
|
||||
|
||||
public function mount()
|
||||
public function mount(): void
|
||||
{
|
||||
$this->initDetailzIfNeeded();
|
||||
$this->description = $this->user->detailz->additional_info ?? '';
|
||||
}
|
||||
|
||||
public function updatedDescription($value)
|
||||
public function updatedDescription(string $value): void
|
||||
{
|
||||
$userDetailz = $this->user->detailz;
|
||||
|
||||
@@ -25,12 +27,12 @@ class DescriptionForm extends Component
|
||||
$userDetailz->save();
|
||||
}
|
||||
|
||||
public function render()
|
||||
public function render(): View
|
||||
{
|
||||
return view('livewire.profile.description-form');
|
||||
}
|
||||
|
||||
private function initDetailzIfNeeded()
|
||||
private function initDetailzIfNeeded(): void
|
||||
{
|
||||
$curUserDetailez = UserDetailz::firstOrNew(
|
||||
['user_id' => $this->user->id],
|
||||
@@ -44,8 +46,12 @@ class DescriptionForm extends Component
|
||||
]
|
||||
);
|
||||
|
||||
if (is_null($curUserDetailez->id)) {
|
||||
if (!isset($curUserDetailez->id)) {
|
||||
$curUserDetailez->save();
|
||||
}
|
||||
|
||||
// if (is_null($curUserDetailez->id)) {
|
||||
// $curUserDetailez->save();
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ use App\Models\UserDetailz;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Livewire\Component;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class EditDetailzForm extends Component
|
||||
{
|
||||
@@ -25,13 +26,13 @@ class EditDetailzForm extends Component
|
||||
|
||||
public ProfileEditDetailzForm $detailzForm;
|
||||
|
||||
public function mount(User $user)
|
||||
public function mount(User $user): void
|
||||
{
|
||||
$this->detailz = $user->detailz;
|
||||
$this->detailzForm->setDetailz($user->detailz);
|
||||
}
|
||||
|
||||
public function updatePassword()
|
||||
public function updatePassword(): void
|
||||
{
|
||||
$validatedData = Validator::make(
|
||||
['currentPassword' => $this->currentPassword, 'newPassword' => $this->newPassword, 'newPasswordConfirm' => $this->newPasswordConfirm],
|
||||
@@ -54,12 +55,12 @@ class EditDetailzForm extends Component
|
||||
/* dd($this->currentPassword, $this->newPassword, $this->newPasswordConfirm, $validatedData); */
|
||||
}
|
||||
|
||||
public function refineDetailz()
|
||||
public function refineDetailz(): void
|
||||
{
|
||||
$this->detailzForm->update();
|
||||
}
|
||||
|
||||
public function render()
|
||||
public function render(): View
|
||||
{
|
||||
return view('livewire.profile.edit-detailz-form');
|
||||
}
|
||||
|
||||
@@ -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');
|
||||
}
|
||||
|
||||
@@ -2,43 +2,48 @@
|
||||
|
||||
namespace App\Livewire\Profile;
|
||||
|
||||
use App\Models\User;
|
||||
use App\Models\UserDetailz;
|
||||
use Illuminate\View\View;
|
||||
use Livewire\Features\SupportRedirects\Redirector;
|
||||
use Livewire\Component;
|
||||
use Masmerise\Toaster\Toaster;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
|
||||
class ShowDetailz extends Component
|
||||
{
|
||||
public $user;
|
||||
public User $user;
|
||||
|
||||
public $userDetailzAttributes;
|
||||
public array $userDetailzAttributes;
|
||||
|
||||
public $regFormKeys;
|
||||
public array $regFormKeys;
|
||||
|
||||
public $userDetailz;
|
||||
public UserDetailz $userDetailz;
|
||||
|
||||
public $publicity;
|
||||
public bool|int $publicity;
|
||||
|
||||
public $is_bedtime_fillable;
|
||||
public bool|int $is_bedtime_fillable;
|
||||
|
||||
public $is_mood_fillable;
|
||||
public bool|int $is_mood_fillable;
|
||||
|
||||
public function mount()
|
||||
public function mount(): void
|
||||
{
|
||||
$this->is_mood_fillable = $this->user->detailz->is_mood_fillable;
|
||||
$this->is_bedtime_fillable = $this->user->detailz->is_bedtime_fillable;
|
||||
$this->publicity = $this->user->is_public_profile;
|
||||
}
|
||||
|
||||
public function render()
|
||||
public function render(): View
|
||||
{
|
||||
return view('livewire.profile.show-detailz');
|
||||
}
|
||||
|
||||
public function editAction()
|
||||
public function editAction(): Redirector|RedirectResponse
|
||||
{
|
||||
return redirect()->route('user_detailz.edit', $this->userDetailz->id);
|
||||
}
|
||||
|
||||
public function updated($name, $value): void
|
||||
public function updated(string $name, bool $value): void
|
||||
{
|
||||
if ($name === 'is_bedtime_fillable') {
|
||||
$this->user->detailz->update(['is_bedtime_fillable' => $value]);
|
||||
|
||||
@@ -5,14 +5,18 @@ namespace App\Livewire\Profile;
|
||||
use App\Models\User;
|
||||
use Asantibanez\LivewireCharts\Models\AreaChartModel;
|
||||
use Livewire\Component;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class WeightChart extends Component
|
||||
{
|
||||
public User $user;
|
||||
|
||||
protected $listeners = ['weight-chart-updated' => '$refresh'];
|
||||
protected function getListeners(): array
|
||||
{
|
||||
return ['weight-chart-updated' => '$refresh'];
|
||||
}
|
||||
|
||||
public function render()
|
||||
public function render(): View
|
||||
{
|
||||
$areaChartModel =
|
||||
(new AreaChartModel())
|
||||
|
||||
@@ -6,19 +6,21 @@ namespace App\Livewire;
|
||||
use App\Models\Tag;
|
||||
use Livewire\Attributes\On;
|
||||
use Livewire\Component;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class TagsComponent extends Component
|
||||
{
|
||||
public $tags;
|
||||
public string $tags;
|
||||
|
||||
public $parentComponent;
|
||||
public array|null $parentComponent;
|
||||
|
||||
// protected $listeners = ['tagAdded', 'tagRemoved'];
|
||||
|
||||
public function mount($parentComponent = null)
|
||||
public function mount(array $parentComponent = null): void
|
||||
{
|
||||
// $curTags = $parentComponent ? $parentComponent->tags->unique()->pluck('name') : [];
|
||||
/* $allTags = Tag::all(); */
|
||||
$curTags = $parentComponent ? $parentComponent->tags->unique()->pluck('name') : [];
|
||||
$curTags = $parentComponent && isset($parentComponent['tags']) ? $parentComponent['tags']->unique()->pluck('name') : [];
|
||||
$this->tags = json_encode($curTags);
|
||||
}
|
||||
|
||||
@@ -44,7 +46,7 @@ class TagsComponent extends Component
|
||||
$this->dispatch('parentComponentTagRemoved', tag: $tag);
|
||||
}
|
||||
|
||||
public function render()
|
||||
public function render(): View
|
||||
{
|
||||
return view('livewire.tags-component');
|
||||
}
|
||||
|
||||
@@ -8,28 +8,29 @@ use App\Models\CircumferenceMeasure;
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use LivewireUI\Modal\ModalComponent;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class AddCircumference extends ModalComponent
|
||||
{
|
||||
public User $user;
|
||||
|
||||
public $chest_circumference = 0;
|
||||
public int $chest_circumference = 0;
|
||||
|
||||
public $waist_circumference = 0;
|
||||
public int $waist_circumference = 0;
|
||||
|
||||
public $hip_circumference = 0;
|
||||
public int $hip_circumference = 0;
|
||||
|
||||
public function mount()
|
||||
public function mount(): void
|
||||
{
|
||||
$this->user = Auth::user();
|
||||
}
|
||||
|
||||
public function render()
|
||||
public function render(): View
|
||||
{
|
||||
return view('livewire.user.add-circumference');
|
||||
}
|
||||
|
||||
public function add()
|
||||
public function add(): void
|
||||
{
|
||||
$newMeasure = CircumferenceMeasure::create([
|
||||
'user_id' => $this->user->id,
|
||||
|
||||
@@ -6,24 +6,25 @@ use App\Models\User;
|
||||
use App\Models\WeightMeasure;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use LivewireUI\Modal\ModalComponent;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class AddWeight extends ModalComponent
|
||||
{
|
||||
public User $user;
|
||||
|
||||
public $weight = 0;
|
||||
public int $weight = 0;
|
||||
|
||||
public function mount()
|
||||
public function mount(): void
|
||||
{
|
||||
$this->user = Auth::user();
|
||||
}
|
||||
|
||||
public function render()
|
||||
public function render(): View
|
||||
{
|
||||
return view('livewire.user.add-weight');
|
||||
}
|
||||
|
||||
public function add()
|
||||
public function add(): void
|
||||
{
|
||||
$newMeasure = WeightMeasure::create([
|
||||
'user_id' => $this->user->id,
|
||||
|
||||
@@ -16,7 +16,7 @@ use Illuminate\Database\Eloquent\Model;
|
||||
* @property string $retire
|
||||
* @property \Illuminate\Support\Carbon|null $created_at
|
||||
* @property \Illuminate\Support\Carbon|null $updated_at
|
||||
* @property int $closed
|
||||
* @property int|bool $closed
|
||||
* @property string $comment
|
||||
*
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\ConsultantDiaryComment> $consultant_comments
|
||||
|
||||
@@ -34,6 +34,7 @@ use Laravel\Sanctum\HasApiTokens;
|
||||
* @property \Illuminate\Support\Carbon|null $created_at
|
||||
* @property \Illuminate\Support\Carbon|null $updated_at
|
||||
* @property int $is_consultant
|
||||
* @property string $consultant_state
|
||||
* @property int $is_public_profile 0 only friends, 1 all
|
||||
*
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\UserAttachment> $attachments
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use FakerRestaurant\Provider\en_US\Restaurant;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Faker\Generator;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Tag>
|
||||
* @property Generator|Restaurant $faker
|
||||
*/
|
||||
class TagFactory extends Factory
|
||||
{
|
||||
@@ -21,6 +21,7 @@ class TagFactory extends Factory
|
||||
{
|
||||
$faker = \Faker\Factory::create();
|
||||
$this->faker->addProvider(new Restaurant($faker));
|
||||
|
||||
return [
|
||||
'name' => $this->faker->foodName(),
|
||||
];
|
||||
|
||||
@@ -19,7 +19,7 @@ class ApiTokenPermissionsTest extends TestCase
|
||||
if (! Features::hasApiFeatures()) {
|
||||
$this->markTestSkipped('API support is not enabled.');
|
||||
|
||||
return;
|
||||
// return;
|
||||
}
|
||||
|
||||
$this->actingAs($user = User::factory()->withPersonalTeam()->create());
|
||||
|
||||
@@ -17,8 +17,6 @@ class CreateApiTokenTest extends TestCase
|
||||
{
|
||||
if (! Features::hasApiFeatures()) {
|
||||
$this->markTestSkipped('API support is not enabled.');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$this->actingAs($user = User::factory()->withPersonalTeam()->create());
|
||||
|
||||
@@ -17,8 +17,6 @@ class DeleteAccountTest extends TestCase
|
||||
{
|
||||
if (! Features::hasAccountDeletionFeatures()) {
|
||||
$this->markTestSkipped('Account deletion is not enabled.');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$this->actingAs($user = User::factory()->create());
|
||||
@@ -34,8 +32,6 @@ class DeleteAccountTest extends TestCase
|
||||
{
|
||||
if (! Features::hasAccountDeletionFeatures()) {
|
||||
$this->markTestSkipped('Account deletion is not enabled.');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$this->actingAs($user = User::factory()->create());
|
||||
|
||||
@@ -5,8 +5,9 @@ namespace Tests\Feature;
|
||||
use App\Models\User;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Str;
|
||||
use Laravel\Jetstream\Features;
|
||||
use Laravel\Jetstream\Http\Livewire\ApiTokenManager;
|
||||
use Laravel\Jetstream\Features;
|
||||
use Laravel\Sanctum\PersonalAccessToken;
|
||||
use Livewire\Livewire;
|
||||
use Tests\TestCase;
|
||||
|
||||
@@ -16,14 +17,13 @@ class DeleteApiTokenTest extends TestCase
|
||||
|
||||
public function test_api_tokens_can_be_deleted(): void
|
||||
{
|
||||
if (! Features::hasApiFeatures()) {
|
||||
if (!Features::hasApiFeatures()) {
|
||||
$this->markTestSkipped('API support is not enabled.');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$this->actingAs($user = User::factory()->withPersonalTeam()->create());
|
||||
|
||||
/** @var PersonalAccessToken $token */
|
||||
$token = $user->tokens()->create([
|
||||
'name' => 'Test Token',
|
||||
'token' => Str::random(40),
|
||||
|
||||
@@ -19,8 +19,6 @@ class EmailVerificationTest extends TestCase
|
||||
{
|
||||
if (! Features::enabled(Features::emailVerification())) {
|
||||
$this->markTestSkipped('Email verification not enabled.');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$user = User::factory()->withPersonalTeam()->unverified()->create();
|
||||
@@ -34,8 +32,6 @@ class EmailVerificationTest extends TestCase
|
||||
{
|
||||
if (! Features::enabled(Features::emailVerification())) {
|
||||
$this->markTestSkipped('Email verification not enabled.');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Event::fake();
|
||||
@@ -60,8 +56,6 @@ class EmailVerificationTest extends TestCase
|
||||
{
|
||||
if (! Features::enabled(Features::emailVerification())) {
|
||||
$this->markTestSkipped('Email verification not enabled.');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$user = User::factory()->unverified()->create();
|
||||
|
||||
@@ -9,18 +9,20 @@ use Tests\TestCase;
|
||||
class MealFormTest extends TestCase
|
||||
{
|
||||
/** @test */
|
||||
public function diary_creation_page_contains_livewire_component()
|
||||
public function diary_creation_page_contains_livewire_component(): void
|
||||
{
|
||||
$this->refreshApplicationWithLocale('en');
|
||||
|
||||
$this->actingAs($this->user);
|
||||
|
||||
//@var $response
|
||||
$response = $this->followingRedirects()->get(route('diary.index'));
|
||||
$response->assertSeeLivewire('meal-form');
|
||||
// $response->assertSeeLivewire('meal-form');
|
||||
$response->assertSee('meal-form');
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function meal_form_productName_is_required()
|
||||
public function meal_form_productName_is_required(): void
|
||||
{
|
||||
$this->refreshApplicationWithLocale('en');
|
||||
|
||||
@@ -44,7 +46,7 @@ class MealFormTest extends TestCase
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function meal_form_add_portion()
|
||||
public function meal_form_add_portion(): void
|
||||
{
|
||||
$this->refreshApplicationWithLocale('en');
|
||||
|
||||
|
||||
@@ -17,8 +17,6 @@ class PasswordResetTest extends TestCase
|
||||
{
|
||||
if (! Features::enabled(Features::resetPasswords())) {
|
||||
$this->markTestSkipped('Password updates are not enabled.');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$response = $this->get('/forgot-password');
|
||||
@@ -30,8 +28,6 @@ class PasswordResetTest extends TestCase
|
||||
{
|
||||
if (! Features::enabled(Features::resetPasswords())) {
|
||||
$this->markTestSkipped('Password updates are not enabled.');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Notification::fake();
|
||||
@@ -49,8 +45,6 @@ class PasswordResetTest extends TestCase
|
||||
{
|
||||
if (! Features::enabled(Features::resetPasswords())) {
|
||||
$this->markTestSkipped('Password updates are not enabled.');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Notification::fake();
|
||||
@@ -74,8 +68,6 @@ class PasswordResetTest extends TestCase
|
||||
{
|
||||
if (! Features::enabled(Features::resetPasswords())) {
|
||||
$this->markTestSkipped('Password updates are not enabled.');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Notification::fake();
|
||||
|
||||
@@ -16,10 +16,11 @@ class ProfileInformationTest extends TestCase
|
||||
{
|
||||
$this->actingAs($user = User::factory()->create());
|
||||
|
||||
/** @var UpdateProfileInformationForm $component */
|
||||
$component = Livewire::test(UpdateProfileInformationForm::class);
|
||||
|
||||
$this->assertEquals($user->name, $component->state['name']);
|
||||
$this->assertEquals($user->email, $component->state['email']);
|
||||
self::assertEquals($user->name, $component->state['name']);
|
||||
self::assertEquals($user->email, $component->state['email']);
|
||||
}
|
||||
|
||||
public function test_profile_information_can_be_updated(): void
|
||||
|
||||
@@ -17,8 +17,6 @@ class TwoFactorAuthenticationSettingsTest extends TestCase
|
||||
{
|
||||
if (! Features::canManageTwoFactorAuthentication()) {
|
||||
$this->markTestSkipped('Two factor authentication is not enabled.');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$this->actingAs($user = User::factory()->create());
|
||||
@@ -38,8 +36,6 @@ class TwoFactorAuthenticationSettingsTest extends TestCase
|
||||
{
|
||||
if (! Features::canManageTwoFactorAuthentication()) {
|
||||
$this->markTestSkipped('Two factor authentication is not enabled.');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$this->actingAs($user = User::factory()->create());
|
||||
@@ -62,8 +58,6 @@ class TwoFactorAuthenticationSettingsTest extends TestCase
|
||||
{
|
||||
if (! Features::canManageTwoFactorAuthentication()) {
|
||||
$this->markTestSkipped('Two factor authentication is not enabled.');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$this->actingAs($user = User::factory()->create());
|
||||
|
||||
@@ -27,7 +27,7 @@ abstract class TestCase extends BaseTestCase
|
||||
->create();
|
||||
}
|
||||
|
||||
protected function refreshApplicationWithLocale($locale)
|
||||
protected function refreshApplicationWithLocale(string $locale): void
|
||||
{
|
||||
self::tearDown();
|
||||
putenv(LaravelLocalization::ENV_ROUTE_KEY.'='.$locale);
|
||||
|
||||
Reference in New Issue
Block a user