refactor: Add return type hints to Livewire methods
This commit is contained in:
parent
de6b1aced4
commit
5cd4a98b09
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Livewire\Home\Article;
|
namespace App\Livewire\Home\Article;
|
||||||
|
|
||||||
|
use Illuminate\Contracts\View\View;
|
||||||
use Livewire\Attributes\Layout;
|
use Livewire\Attributes\Layout;
|
||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
|
|
||||||
@ -14,7 +15,7 @@ class Index extends Component
|
|||||||
|
|
||||||
public ?string $slug = null;
|
public ?string $slug = null;
|
||||||
|
|
||||||
public function mount(?string $slug = null)
|
public function mount(?string $slug = null): void
|
||||||
{
|
{
|
||||||
if ($slug) {
|
if ($slug) {
|
||||||
$this->isDetail = true;
|
$this->isDetail = true;
|
||||||
@ -22,7 +23,7 @@ public function mount(?string $slug = null)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function render()
|
public function render(): View
|
||||||
{
|
{
|
||||||
return view(
|
return view(
|
||||||
$this->isDetail
|
$this->isDetail
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Livewire\Home\Cart;
|
namespace App\Livewire\Home\Cart;
|
||||||
|
|
||||||
|
use Illuminate\Contracts\View\View;
|
||||||
use Livewire\Attributes\Layout;
|
use Livewire\Attributes\Layout;
|
||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
|
|
||||||
@ -10,7 +11,7 @@
|
|||||||
])]
|
])]
|
||||||
class Index extends Component
|
class Index extends Component
|
||||||
{
|
{
|
||||||
public function render()
|
public function render(): View
|
||||||
{
|
{
|
||||||
return view('livewire.home.cart.index');
|
return view('livewire.home.cart.index');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Livewire\Home\Faq;
|
namespace App\Livewire\Home\Faq;
|
||||||
|
|
||||||
|
use Illuminate\Contracts\View\View;
|
||||||
use Livewire\Attributes\Layout;
|
use Livewire\Attributes\Layout;
|
||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
|
|
||||||
@ -10,7 +11,7 @@
|
|||||||
])]
|
])]
|
||||||
class Index extends Component
|
class Index extends Component
|
||||||
{
|
{
|
||||||
public function render()
|
public function render(): View
|
||||||
{
|
{
|
||||||
return view('livewire.home.faq.index');
|
return view('livewire.home.faq.index');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,6 +7,8 @@
|
|||||||
use App\Models\Customer;
|
use App\Models\Customer;
|
||||||
use App\Models\Faq;
|
use App\Models\Faq;
|
||||||
use App\Models\PerfumeFeature;
|
use App\Models\PerfumeFeature;
|
||||||
|
use Illuminate\Contracts\View\View;
|
||||||
|
use Illuminate\Http\RedirectResponse;
|
||||||
use Illuminate\Support\Facades\Storage;
|
use Illuminate\Support\Facades\Storage;
|
||||||
use Livewire\Attributes\Layout;
|
use Livewire\Attributes\Layout;
|
||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
@ -28,7 +30,7 @@ class Index extends Component
|
|||||||
|
|
||||||
public $latestMembers = [];
|
public $latestMembers = [];
|
||||||
|
|
||||||
public function mount()
|
public function mount(): void
|
||||||
{
|
{
|
||||||
$this->brands = Brand::orderBy('sort_order')
|
$this->brands = Brand::orderBy('sort_order')
|
||||||
->get()
|
->get()
|
||||||
@ -70,19 +72,19 @@ public function mount()
|
|||||||
->get();
|
->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function render()
|
public function render(): View
|
||||||
{
|
{
|
||||||
return view('livewire.home.index', [
|
return view('livewire.home.index', [
|
||||||
'pageTitle' => 'Beranda',
|
'pageTitle' => 'Beranda',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function goToProduct()
|
public function goToProduct(): RedirectResponse
|
||||||
{
|
{
|
||||||
return redirect('/product');
|
return redirect('/product');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function goToVoucher()
|
public function goToVoucher(): RedirectResponse
|
||||||
{
|
{
|
||||||
return redirect('/voucher');
|
return redirect('/voucher');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Livewire\Home;
|
namespace App\Livewire\Home;
|
||||||
|
|
||||||
|
use Illuminate\Contracts\View\View;
|
||||||
use Livewire\Attributes\Layout;
|
use Livewire\Attributes\Layout;
|
||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
|
|
||||||
@ -10,7 +11,7 @@
|
|||||||
])]
|
])]
|
||||||
class Outlet extends Component
|
class Outlet extends Component
|
||||||
{
|
{
|
||||||
public function render()
|
public function render(): View
|
||||||
{
|
{
|
||||||
return view('livewire.home.outlets');
|
return view('livewire.home.outlets');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Livewire\Home\Product;
|
namespace App\Livewire\Home\Product;
|
||||||
|
|
||||||
|
use Illuminate\Contracts\View\View;
|
||||||
use Livewire\Attributes\Layout;
|
use Livewire\Attributes\Layout;
|
||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
|
|
||||||
@ -14,7 +15,7 @@ class Index extends Component
|
|||||||
|
|
||||||
public ?string $slug = null;
|
public ?string $slug = null;
|
||||||
|
|
||||||
public function mount(?string $slug = null)
|
public function mount(?string $slug = null): void
|
||||||
{
|
{
|
||||||
if ($slug) {
|
if ($slug) {
|
||||||
$this->isDetail = true;
|
$this->isDetail = true;
|
||||||
@ -22,7 +23,7 @@ public function mount(?string $slug = null)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function render()
|
public function render(): View
|
||||||
{
|
{
|
||||||
return view(
|
return view(
|
||||||
$this->isDetail
|
$this->isDetail
|
||||||
|
|||||||
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
use App\Models\Outlet;
|
use App\Models\Outlet;
|
||||||
use App\Models\Voucher as VoucherModel;
|
use App\Models\Voucher as VoucherModel;
|
||||||
|
use Illuminate\Contracts\View\View;
|
||||||
use Livewire\Attributes\Layout;
|
use Livewire\Attributes\Layout;
|
||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
use Livewire\WithPagination;
|
use Livewire\WithPagination;
|
||||||
@ -23,27 +24,27 @@ class Voucher extends Component
|
|||||||
|
|
||||||
public ?string $sort = null;
|
public ?string $sort = null;
|
||||||
|
|
||||||
public function mount()
|
public function mount(): void
|
||||||
{
|
{
|
||||||
$this->outlets = Outlet::query()->operational()->pluck('name', 'id');
|
$this->outlets = Outlet::query()->operational()->pluck('name', 'id');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function updatedSearch()
|
public function updatedSearch(): void
|
||||||
{
|
{
|
||||||
$this->resetPage();
|
$this->resetPage();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function updatedOutletId()
|
public function updatedOutletId(): void
|
||||||
{
|
{
|
||||||
$this->resetPage();
|
$this->resetPage();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function updatedSort()
|
public function updatedSort(): void
|
||||||
{
|
{
|
||||||
$this->resetPage();
|
$this->resetPage();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function render()
|
public function render(): View
|
||||||
{
|
{
|
||||||
$vouchers = VoucherModel::where(function ($query) {
|
$vouchers = VoucherModel::where(function ($query) {
|
||||||
$query->where('name', 'like', '%'.$this->search.'%')
|
$query->where('name', 'like', '%'.$this->search.'%')
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user