dev
Aji Kamaludin 1 year ago
parent ff819b40c0
commit 38b3ba28d2
No known key found for this signature in database
GPG Key ID: 19058F67F0083AD3

@ -52,4 +52,4 @@ VITE_PUSHER_PORT="${PUSHER_PORT}"
VITE_PUSHER_SCHEME="${PUSHER_SCHEME}"
VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
HTTP_SECURE=false
HTTPS_AWARE=false

@ -1,14 +1,15 @@
# Laravel Template - Flowbite
# Voucher App
This online shop to purchase wifi voucher for WISP/Small ISP Based
This just a laravel template with breeze react, user role based access crud with setup flowbite admin template
## Support me
<a href="https://trakteer.id/ajikamaludin" target="_blank"><img id="wse-buttons-preview" src="https://cdn.trakteer.id/images/embed/trbtn-blue-2.png" height="40" style="border:0px;height:40px;" alt="Trakteer Saya"></a>
## Requirements
- PHP 8.1 or latest
- Node 16+ or latest
- PHP 8.1 or latest
- Node 16+ or latest
## How to run
@ -32,3 +33,9 @@ password : password
```bash
npm run build
```
## Rsync
```bash
rsync -arP -e 'ssh -p 224' --exclude=node_modules --exclude=.git --exclude=.env --exclude=storage --exclude=public/hot . arm@ajikamaludin.id:/home/arm/projects/voucher
```

@ -23,8 +23,8 @@ class AuthController extends Controller
public function update(Request $request)
{
$request->validate([
'username' => 'string|required|alpha_dash',
'password' => 'string|required',
'username' => 'required|string|alpha_dash',
'password' => 'required|string',
]);
$isAuth = Auth::guard('customer')->attempt(['username' => $request->username, 'password' => $request->password]);
@ -51,7 +51,14 @@ class AuthController extends Controller
public function callback_google()
{
$user = Socialite::driver('google')->user();
$config = new Config(
env('GOOGLE_CLIENT_ID'),
env('GOOGLE_CLIENT_SECRET'),
route('customer.login.callback_google')
);
$user = Socialite::driver('google')
->setConfig($config)
->user();
$customer = Customer::where('google_id', $user->id)->first();
if ($customer == null) {
DB::beginTransaction();
@ -87,12 +94,12 @@ class AuthController extends Controller
public function store(Request $request)
{
$request->validate([
'fullname' => 'string|required',
'name' => 'string|required',
'address' => 'string|required',
'phone' => 'string|required|numeric',
'username' => 'string|required|min:5|alpha_dash|unique:customers,username',
'password' => 'string|required|min:8|confirmed',
'fullname' => 'required|string',
'name' => 'required|string',
'address' => 'required|string',
'phone' => 'required|string|numeric',
'username' => 'required|string|min:5|alpha_dash|unique:customers,username',
'password' => 'required|string|min:8|confirmed',
]);
DB::beginTransaction();

@ -69,5 +69,6 @@ class Kernel extends HttpKernel
'inertia.admin' => \App\Http\Middleware\HandleInertiaRequests::class,
'inertia.customer' => \App\Http\Middleware\HandleInertiaCustomerRequests::class,
'guard_should_customer' => \App\Http\Middleware\GuardCustomer::class,
'http_secure_aware' => \App\Http\Middleware\HttpSecureAware::class,
];
}

@ -31,7 +31,7 @@ class HandleInertiaCustomerRequests extends Middleware
{
return array_merge(parent::share($request), [
'auth' => [
'user' => auth('customer')->user()->load(['level']),
'user' => auth('customer')->user()?->load(['level']),
],
'flash' => [
'message' => fn () => $request->session()->get('message') ?? ['type' => null, 'message' => null],

@ -26,49 +26,47 @@ export default function CustomerLayout({ children }) {
}
return (
<div className="min-h-screen flex flex-col sm:justify-center items-center">
<div className="flex flex-col w-full min-h-screen max-w-md bg-white shadow-md">
<div className="mb-10">{children}</div>
<div className="sticky bottom-0 flex flex-row justify-evenly w-full max-w-md bg-gray-50">
<div className="min-h-screen flex flex-col sm:justify-center items-center max-w-md">
<div className="flex flex-col w-full bg-white shadow pb-20 min-h-[calc(90dvh)]">
<div>{children}</div>
</div>
<div className="fixed bottom-0 flex flex-row justify-around w-full bg-gray-50">
<div
className="py-2 px-5 hover:bg-blue-200"
onClick={() => handleOnClick('home.index')}
>
<HiOutlineHome className={isActive('home.index')} />
</div>
<div className="py-2 px-5 hover:bg-blue-200 flex flex-row">
<HiOutlineShoppingCart className="text-gray-600 h-8 w-8" />
<div>
<div className="bg-blue-300 text-blue-600 rounded-lg px-1 text-xs -ml-2">
1
</div>
</div>
</div>
<div className="py-2 px-5 hover:bg-blue-200">
<HiArrowPathRoundedSquare className="text-gray-600 h-8 w-8" />
</div>
{user !== null ? (
<div
className="py-2 px-10 hover:bg-blue-200"
onClick={() => handleOnClick('home.index')}
className="py-2 px-5 hover:bg-blue-200"
onClick={() => handleOnClick('customer.profile.index')}
>
<HiOutlineHome className={isActive('home.index')} />
<HiOutlineUserCircle
className={isActive('customer.profile.*')}
/>
</div>
<div className="py-2 px-10 hover:bg-blue-200 flex flex-row">
<HiOutlineShoppingCart className="text-gray-600 h-8 w-8" />
<div>
<div className="bg-blue-300 text-blue-600 rounded-lg px-1 text-xs -ml-2">
1
</div>
</div>
</div>
<div className="py-2 px-10 hover:bg-blue-200">
<HiArrowPathRoundedSquare className="text-gray-600 h-8 w-8" />
) : (
<div
className="py-2 px-5 hover:bg-blue-200"
onClick={() => handleOnClick('customer.login')}
>
<HiOutlineUserCircle
className={isActive('customer.login')}
/>
</div>
{user !== null ? (
<div
className="py-2 px-10 hover:bg-blue-200"
onClick={() =>
handleOnClick('customer.profile.index')
}
>
<HiOutlineUserCircle
className={isActive('customer.profile.*')}
/>
</div>
) : (
<div
className="py-2 px-10 hover:bg-blue-200"
onClick={() => handleOnClick('customer.login')}
>
<HiOutlineUserCircle
className={isActive('customer.login')}
/>
</div>
)}
</div>
)}
</div>
</div>
)

@ -41,7 +41,7 @@ export default function Index({ app_name, flash }) {
return (
<CustomerLayout>
<Head title="Login" />
<div className="flex flex-col justify-center min-h-screen">
<div className="flex flex-col justify-center min-h-[calc(90dvh)]">
<div className="m-4 border shadow-md p-6 pt-4">
<div className="text-2xl font-bold mb-4">Sign in</div>
<Alert type={flash.message.type}>
@ -85,7 +85,7 @@ export default function Index({ app_name, flash }) {
</div>
<div className="flex flex-row w-full justify-center">
<div
className="flex flex-row items-center space-x-2 border-2 border-blue-600 px-4 py-2 hover:bg-blue-500 hover:text-white rounded"
className="flex flex-row items-center space-x-2 border-2 border-blue-600 px-4 py-2 hover:bg-blue-500 hover:text-white rounded select-none"
onClick={handleLoginWithGoogle}
>
<FcGoogle className="h-6 w-6" />

@ -47,8 +47,8 @@ export default function Index({ app_name, flash }) {
return (
<CustomerLayout>
<Head title="Login" />
<div className="flex flex-col justify-center min-h-screen">
<Head title="Register" />
<div className="flex flex-col justify-center min-h-[calc(90dvh)]">
<div className="m-4 border shadow-md p-6 pt-4">
<div className="text-2xl font-bold mb-4">Register</div>
<Alert type={flash.message.type}>

@ -49,8 +49,8 @@ export default function Index({ auth: { user }, flash }) {
console.log(user)
return (
<CustomerLayout>
<Head title="Login" />
<div className="flex flex-col min-h-screen">
<Head title="Update Profile" />
<div className="flex flex-col min-h-[calc(90dvh)]">
<div className="m-4 p-2">
<div className="text-2xl font-bold mb-4">Profile</div>
<Alert type={flash.message.type}>

@ -24,8 +24,8 @@ export default function Index({ auth: { user } }) {
return (
<CustomerLayout>
<Head title="Login" />
<div className="flex flex-col min-h-screen">
<Head title="Profile" />
<div className="flex flex-col min-h-[calc(90dvh)]">
<div>
{/* user */}
<div className="flex flex-row justify-between items-center px-5 py-6 text-lg bg-blue-600">

@ -3,6 +3,8 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="mobile-web-app-capable" content="yes">
<title inertia>{{ config('app.name', 'Laravel') }}</title>

@ -7,7 +7,7 @@ use App\Http\Controllers\RoleController;
use App\Http\Controllers\UserController;
use Illuminate\Support\Facades\Route;
Route::middleware(['inertia.admin'])
Route::middleware(['http_secure_aware', 'inertia.admin'])
->prefix('admin')
->group(function () {
Route::get('/', fn () => redirect()->route('admin.login'));

@ -17,7 +17,7 @@ use Illuminate\Support\Facades\Route;
|
*/
Route::middleware(['guard_should_customer', 'inertia.customer'])->group(function () {
Route::middleware(['http_secure_aware', 'guard_should_customer', 'inertia.customer'])->group(function () {
Route::get('/', [HomeController::class, 'index'])->name('home.index');
Route::middleware('auth:customer')->group(function () {

Loading…
Cancel
Save