diff --git a/app/Http/Controllers/Customer/HomeController.php b/app/Http/Controllers/Customer/HomeController.php index c06ae18..cfef46e 100644 --- a/app/Http/Controllers/Customer/HomeController.php +++ b/app/Http/Controllers/Customer/HomeController.php @@ -14,14 +14,14 @@ use Illuminate\Http\Request; class HomeController extends Controller { - const LIMIT = 2; + const LIMIT = 10; public function index(Request $request) { - if ($request->direct != '') { + if ($request->direct != '' && auth()->guard('customer')->check()) { $customer = Customer::find(auth()->id()); if ($request->location_ids == '' && $customer->locationFavorites()->count() > 0) { - return redirect()->route('customer.home.favorite'); + return redirect()->route('home.favorite'); } } @@ -46,7 +46,7 @@ class HomeController extends Controller $vouchers = tap($vouchers->paginate(self::LIMIT))->setHidden(['username', 'password']); } - if (auth()->guard('customer')->guest() && $request->location_ids != '') { + if (auth()->guard('customer')->guest() && $request->location_ids == '') { $vouchers = tap($vouchers->paginate(self::LIMIT))->setHidden(['username', 'password']); } diff --git a/resources/js/Customer/Index/Index.jsx b/resources/js/Customer/Index/Index.jsx index e7afc09..ae18fe8 100644 --- a/resources/js/Customer/Index/Index.jsx +++ b/resources/js/Customer/Index/Index.jsx @@ -44,16 +44,16 @@ export default function Index(props) { const isStatus = (s) => { if (s === _status) { - return 'px-2 py-1 rounded-2xl text-white bg-blue-600 border border-blue-800' + return 'px-2 py-1 rounded-2xl hover:bg-blue-800 text-white bg-blue-600 border border-blue-800' } - return 'px-2 py-1 rounded-2xl bg-blue-100 border border-blue-200' + return 'px-2 py-1 rounded-2xl hover:bg-blue-800 hover:text-white bg-blue-100 border border-blue-200' } const handleFavorite = () => { if (user === null) { router.visit(route('customer.login')) } - router.visit(route('customer.home.favorite')) + router.visit(route('home.favorite')) } const handleAll = () => { diff --git a/resources/js/Layouts/CustomerLayout.jsx b/resources/js/Layouts/CustomerLayout.jsx index 8330dae..4ba4600 100644 --- a/resources/js/Layouts/CustomerLayout.jsx +++ b/resources/js/Layouts/CustomerLayout.jsx @@ -45,7 +45,7 @@ export default function CustomerLayout({ children }) {
handleOnClick('home.index')} > diff --git a/routes/web.php b/routes/web.php index 2813f22..f033957 100644 --- a/routes/web.php +++ b/routes/web.php @@ -31,7 +31,7 @@ Route::middleware(['http_secure_aware', 'guard_should_customer', 'inertia.custom Route::middleware('auth:customer')->group(function () { // location to favorite Route::post('/locations/{location}/add-favorite', [HomeController::class, 'addFavorite'])->name('customer.location.favorite'); - Route::get('/favorites', [HomeController::class, 'favorite'])->name('customer.home.favorite'); + Route::get('/favorites', [HomeController::class, 'favorite'])->name('home.favorite'); // profile Route::get('profile', [ProfileController::class, 'index'])->name('customer.profile.index');