Initial commit - Tabeley Backend

This commit is contained in:
Zaki-Malla
2026-02-17 19:33:49 +03:00
commit 3c885722f3
109 changed files with 14520 additions and 0 deletions
+11
View File
@@ -0,0 +1,11 @@
.git
.gitignore
node_modules
vendor
storage/logs
storage/framework/cache/*
storage/framework/sessions/*
storage/framework/views/*
.env
.vscode
README.md
+18
View File
@@ -0,0 +1,18 @@
root = true
[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
[*.md]
trim_trailing_whitespace = false
[*.{yml,yaml}]
indent_size = 2
[compose.yaml]
indent_size = 4
+11
View File
@@ -0,0 +1,11 @@
* text=auto eol=lf
*.blade.php diff=html
*.css diff=css
*.html diff=html
*.md diff=markdown
*.php diff=php
/.github export-ignore
CHANGELOG.md export-ignore
.styleci.yml export-ignore
+35
View File
@@ -0,0 +1,35 @@
name: Deploy Backend
on:
push:
branches:
- main
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Configure SSH
shell: bash
run: |
mkdir -p ~/.ssh
echo "${{ secrets.SERVER_SSH_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan -p "${{ secrets.SERVER_PORT }}" -H "${{ secrets.SERVER_HOST }}" >> ~/.ssh/known_hosts
- name: Deploy on Server
shell: bash
run: |
ssh -p "${{ secrets.SERVER_PORT }}" "${{ secrets.SERVER_USER }}@${{ secrets.SERVER_HOST }}" << 'EOF'
set -e
cd "${{ secrets.APP_DIR }}"
git fetch origin
git checkout main
git pull --ff-only origin main
docker compose up -d --build
docker compose ps
EOF
+24
View File
@@ -0,0 +1,24 @@
*.log
.DS_Store
.env
.env.backup
.env.production
.phpactor.json
.phpunit.result.cache
/.fleet
/.idea
/.nova
/.phpunit.cache
/.vscode
/.zed
/auth.json
/node_modules
/public/build
/public/hot
/public/storage
/storage/*.key
/storage/pail
/vendor
Homestead.json
Homestead.yaml
Thumbs.db
+23
View File
@@ -0,0 +1,23 @@
FROM php:8.3-cli
RUN apt-get update && apt-get install -y \
libpq-dev \
libicu-dev \
libpng-dev \
unzip \
git \
curl
RUN docker-php-ext-install pdo_pgsql pgsql intl gd
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
WORKDIR /var/www
COPY . .
RUN composer install --no-dev --optimize-autoloader
EXPOSE 8000
CMD php artisan serve --host=0.0.0.0 --port=8000
+59
View File
@@ -0,0 +1,59 @@
<p align="center"><a href="https://laravel.com" target="_blank"><img src="https://raw.githubusercontent.com/laravel/art/master/logo-lockup/5%20SVG/2%20CMYK/1%20Full%20Color/laravel-logolockup-cmyk-red.svg" width="400" alt="Laravel Logo"></a></p>
<p align="center">
<a href="https://github.com/laravel/framework/actions"><img src="https://github.com/laravel/framework/workflows/tests/badge.svg" alt="Build Status"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/dt/laravel/framework" alt="Total Downloads"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/v/laravel/framework" alt="Latest Stable Version"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/l/laravel/framework" alt="License"></a>
</p>
## About Laravel
Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as:
- [Simple, fast routing engine](https://laravel.com/docs/routing).
- [Powerful dependency injection container](https://laravel.com/docs/container).
- Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage.
- Expressive, intuitive [database ORM](https://laravel.com/docs/eloquent).
- Database agnostic [schema migrations](https://laravel.com/docs/migrations).
- [Robust background job processing](https://laravel.com/docs/queues).
- [Real-time event broadcasting](https://laravel.com/docs/broadcasting).
Laravel is accessible, powerful, and provides tools required for large, robust applications.
## Learning Laravel
Laravel has the most extensive and thorough [documentation](https://laravel.com/docs) and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework. You can also check out [Laravel Learn](https://laravel.com/learn), where you will be guided through building a modern Laravel application.
If you don't feel like reading, [Laracasts](https://laracasts.com) can help. Laracasts contains thousands of video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library.
## Laravel Sponsors
We would like to extend our thanks to the following sponsors for funding Laravel development. If you are interested in becoming a sponsor, please visit the [Laravel Partners program](https://partners.laravel.com).
### Premium Partners
- **[Vehikl](https://vehikl.com)**
- **[Tighten Co.](https://tighten.co)**
- **[Kirschbaum Development Group](https://kirschbaumdevelopment.com)**
- **[64 Robots](https://64robots.com)**
- **[Curotec](https://www.curotec.com/services/technologies/laravel)**
- **[DevSquad](https://devsquad.com/hire-laravel-developers)**
- **[Redberry](https://redberry.international/laravel-development)**
- **[Active Logic](https://activelogic.com)**
## Contributing
Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions).
## Code of Conduct
In order to ensure that the Laravel community is welcoming to all, please review and abide by the [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct).
## Security Vulnerabilities
If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via [taylor@laravel.com](mailto:taylor@laravel.com). All security vulnerabilities will be promptly addressed.
## License
The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).
@@ -0,0 +1,65 @@
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use App\Models\Reservation;
use App\Models\ReservationReminder;
use App\Models\Notification;
use Illuminate\Support\Carbon;
class SendReservationReminders extends Command
{
protected $signature = 'reservations:send-reminders';
protected $description = 'Send reservation reminders before the reservation time';
public function handle(): int
{
$minutes = (int) env('RESERVATION_REMINDER_MINUTES', 60);
if ($minutes < 1) {
$minutes = 60;
}
$now = now();
$windowEnd = $now->copy()->addMinutes($minutes);
$reservations = Reservation::query()
->where('status', 'approved')
->whereRaw(
"STR_TO_DATE(CONCAT(reservation_date,' ',reservation_time), '%Y-%m-%d %H:%i:%s') BETWEEN ? AND ?",
[$now->format('Y-m-d H:i:s'), $windowEnd->format('Y-m-d H:i:s')]
)
->get();
foreach ($reservations as $reservation) {
$exists = ReservationReminder::where('reservation_id', $reservation->id)->exists();
if ($exists) {
continue;
}
$reservationDateTime = Carbon::parse($reservation->reservation_date . ' ' . $reservation->reservation_time);
$sendAt = $reservationDateTime->copy()->subMinutes($minutes);
ReservationReminder::create([
'reservation_id' => $reservation->id,
'send_at' => $sendAt,
'sent_at' => now(),
]);
Notification::create([
'user_id' => $reservation->customer_id,
'type' => 'reservation_reminder',
'title' => 'Reservation reminder',
'body' => 'Your reservation is coming up in about ' . $minutes . ' minutes.',
'data_json' => [
'reservation_id' => $reservation->id,
'venue_id' => $reservation->venue_id,
'reservation_date' => $reservation->reservation_date,
'reservation_time' => $reservation->reservation_time,
],
]);
}
return Command::SUCCESS;
}
}
@@ -0,0 +1,102 @@
<?php
namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller;
use App\Models\Reservation;
use App\Models\User;
use Illuminate\Http\Request;
class AdminController extends Controller
{
// LIST USERS (admin)
public function users(Request $request)
{
$validated = $request->validate([
'per_page' => 'nullable|integer|min:1|max:200',
]);
$perPage = $validated['per_page'] ?? 50;
$paginator = User::query()
->with(['roles:id,name'])
->orderByDesc('id')
->paginate($perPage);
$data = collect($paginator->items())->map(function (User $user) {
return [
'id' => $user->id,
'first_name' => $user->first_name,
'last_name' => $user->last_name,
'email' => $user->email,
'phone' => $user->phone,
'roles' => $user->roles->pluck('name')->values(),
'created_at' => $user->created_at,
];
});
return response()->json([
'data' => $data,
'meta' => [
'current_page' => $paginator->currentPage(),
'per_page' => $paginator->perPage(),
'total' => $paginator->total(),
'last_page' => $paginator->lastPage(),
],
]);
}
// LIST RESERVATIONS (admin)
public function reservations(Request $request)
{
$validated = $request->validate([
'per_page' => 'nullable|integer|min:1|max:200',
]);
$perPage = $validated['per_page'] ?? 50;
$paginator = Reservation::query()
->with([
'venue:id,name,type,address_text',
'customer:id,first_name,last_name,email,phone',
])
->orderByDesc('id')
->paginate($perPage);
$data = collect($paginator->items())->map(function (Reservation $reservation) {
return [
'id' => $reservation->id,
'code' => $reservation->code,
'reservation_date' => $reservation->reservation_date,
'reservation_time' => $reservation->reservation_time,
'party_size' => $reservation->party_size,
'status' => $reservation->status,
'rejection_reason' => $reservation->rejection_reason,
'created_at' => $reservation->created_at,
'venue' => $reservation->venue ? [
'id' => $reservation->venue->id,
'name' => $reservation->venue->name,
'type' => $reservation->venue->type,
'address_text' => $reservation->venue->address_text,
] : null,
'customer' => $reservation->customer ? [
'id' => $reservation->customer->id,
'first_name' => $reservation->customer->first_name,
'last_name' => $reservation->customer->last_name,
'email' => $reservation->customer->email,
'phone' => $reservation->customer->phone,
] : null,
];
});
return response()->json([
'data' => $data,
'meta' => [
'current_page' => $paginator->currentPage(),
'per_page' => $paginator->perPage(),
'total' => $paginator->total(),
'last_page' => $paginator->lastPage(),
],
]);
}
}
@@ -0,0 +1,154 @@
<?php
namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller;
use App\Models\User;
use App\Models\Role;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Auth;
use Illuminate\Validation\ValidationException;
class AuthController extends Controller
{
// REGISTER
public function register(Request $request)
{
$validated = $request->validate([
'first_name' => 'nullable|string|max:255',
'last_name' => 'nullable|string|max:255',
'email' => 'required|email|unique:users',
'phone' => 'required|string|unique:users',
'password' => 'required|string|min:6',
]);
$emailPrefix = explode('@', $validated['email'])[0] ?? 'User';
$firstName = trim($validated['first_name'] ?? '');
$lastName = trim($validated['last_name'] ?? '');
if ($firstName === '') {
$firstName = 'User';
}
if ($lastName === '') {
$lastName = $emailPrefix;
}
$user = User::create([
'first_name' => $firstName,
'last_name' => $lastName,
'email' => $validated['email'],
'phone' => $validated['phone'],
'password_hash' => Hash::make($validated['password']),
]);
$token = $user->createToken('mobile_token')->plainTextToken;
$defaultRole = Role::firstOrCreate(['name' => 'customer']);
$user->roles()->syncWithoutDetaching([$defaultRole->id]);
return response()->json([
'message' => 'User registered successfully',
'token' => $token,
'user' => [
...$user->toArray(),
'roles' => $user->roles()->pluck('name')->values(),
],
]);
}
// LOGIN
public function login(Request $request)
{
$request->validate([
'email' => 'required|email',
'password' => 'required|string',
]);
$user = User::where('email', $request->email)->first();
if (!$user || !Hash::check($request->password, $user->password_hash)) {
return response()->json([
'message' => 'Invalid credentials'
], 401);
}
// Backfill customer role for legacy users that were created before roles assignment.
if (! $user->roles()->exists()) {
$defaultRole = Role::firstOrCreate(['name' => 'customer']);
$user->roles()->syncWithoutDetaching([$defaultRole->id]);
}
$token = $user->createToken('auth_token')->plainTextToken;
return response()->json([
'message' => 'Login successful',
'token' => $token,
'user' => [
...$user->toArray(),
'roles' => $user->roles()->pluck('name')->values(),
],
]);
}
// LOGOUT
public function logout(Request $request)
{
$user = $request->user();
if (! $user) {
return response()->json(['message' => 'Unauthenticated.'], 401);
}
$token = $user->currentAccessToken();
if ($token) {
$token->delete();
}
return response()->json([
'message' => 'Logout successful',
]);
}
public function me(Request $request)
{
$user = $request->user();
if (! $user) {
return response()->json(['message' => 'Unauthenticated.'], 401);
}
return response()->json([
'user' => [
...$user->toArray(),
'roles' => $user->roles()->pluck('name')->values(),
],
]);
}
public function updateProfile(Request $request)
{
$user = $request->user();
if (! $user) {
return response()->json(['message' => 'Unauthenticated.'], 401);
}
$validated = $request->validate([
'first_name' => 'required|string|max:255',
'last_name' => 'required|string|max:255',
'phone' => 'required|string|max:50|unique:users,phone,' . $user->id,
]);
$user->first_name = $validated['first_name'];
$user->last_name = $validated['last_name'];
$user->phone = $validated['phone'];
$user->save();
return response()->json([
'message' => 'Profile updated successfully',
'user' => [
...$user->toArray(),
'roles' => $user->roles()->pluck('name')->values(),
],
]);
}
}
@@ -0,0 +1,69 @@
<?php
namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller;
use App\Models\UserFeedback;
use Illuminate\Http\Request;
class FeedbackController extends Controller
{
// CREATE FEEDBACK (customer)
public function store(Request $request)
{
$validated = $request->validate([
'message' => 'required|string|min:5|max:2000',
]);
$feedback = UserFeedback::create([
'user_id' => $request->user()->id,
'message' => $validated['message'],
]);
return response()->json([
'message' => 'Feedback sent successfully',
'data' => [
'id' => $feedback->id,
'created_at' => $feedback->created_at,
],
], 201);
}
// LIST FEEDBACK (admin)
public function adminIndex(Request $request)
{
$validated = $request->validate([
'per_page' => 'nullable|integer|min:1|max:100',
]);
$perPage = $validated['per_page'] ?? 20;
$paginator = UserFeedback::query()
->with(['user:id,first_name,last_name,email'])
->orderByDesc('id')
->paginate($perPage);
$data = collect($paginator->items())->map(function (UserFeedback $item) {
return [
'id' => $item->id,
'message' => $item->message,
'created_at' => $item->created_at,
'user' => [
'id' => $item->user?->id,
'first_name' => $item->user?->first_name,
'last_name' => $item->user?->last_name,
'email' => $item->user?->email,
],
];
});
return response()->json([
'data' => $data,
'meta' => [
'current_page' => $paginator->currentPage(),
'per_page' => $paginator->perPage(),
'total' => $paginator->total(),
'last_page' => $paginator->lastPage(),
],
]);
}
}
@@ -0,0 +1,47 @@
<?php
namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller;
use App\Models\Notification;
use Illuminate\Http\Request;
class NotificationController extends Controller
{
// LIST NOTIFICATIONS (auth)
public function index(Request $request)
{
$validated = $request->validate([
'per_page' => 'nullable|integer|min:1|max:50',
]);
$perPage = $validated['per_page'] ?? 10;
$paginator = Notification::query()
->where('user_id', $request->user()->id)
->orderByDesc('id')
->paginate($perPage);
$data = collect($paginator->items())->map(function ($notification) {
return [
'id' => $notification->id,
'type' => $notification->type,
'title' => $notification->title,
'body' => $notification->body,
'data' => $notification->data_json,
'is_read' => $notification->is_read,
'created_at' => $notification->created_at,
];
});
return response()->json([
'data' => $data,
'meta' => [
'current_page' => $paginator->currentPage(),
'per_page' => $paginator->perPage(),
'total' => $paginator->total(),
'last_page' => $paginator->lastPage(),
],
]);
}
}
@@ -0,0 +1,617 @@
<?php
namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller;
use App\Models\Reservation;
use App\Models\Notification;
use App\Models\ReservationStatusHistory;
use App\Models\ReservationFee;
use App\Models\PricingRule;
use App\Models\ReservationTableAssignment;
use App\Models\VenueTable;
use App\Models\ReservationReminder;
use App\Models\Venue;
use Illuminate\Http\Request;
use Illuminate\Support\Str;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\DB;
class ReservationController extends Controller
{
// LIST VENDOR RESERVATIONS (vendor)
public function vendorReservations(Request $request)
{
$validated = $request->validate([
'per_page' => 'nullable|integer|min:1|max:50',
]);
$perPage = $validated['per_page'] ?? 10;
$query = Reservation::query()
->whereHas('venue', function ($q) use ($request) {
$q->where('vendor_id', $request->user()->id);
})
->with([
'venue:id,name,type,address_text',
'customer:id,first_name,last_name,phone',
])
->orderByDesc('id');
$paginator = $query->paginate($perPage);
$data = collect($paginator->items())->map(function ($reservation) {
return [
'id' => $reservation->id,
'code' => $reservation->code,
'reservation_date' => $reservation->reservation_date,
'reservation_time' => $reservation->reservation_time,
'party_size' => $reservation->party_size,
'status' => $reservation->status,
'rejection_reason' => $reservation->rejection_reason,
'venue' => $reservation->venue ? [
'id' => $reservation->venue->id,
'name' => $reservation->venue->name,
'type' => $reservation->venue->type,
'address_text' => $reservation->venue->address_text,
] : null,
'customer' => $reservation->customer ? [
'id' => $reservation->customer->id,
'first_name' => $reservation->customer->first_name,
'last_name' => $reservation->customer->last_name,
'phone' => $reservation->customer->phone,
] : null,
];
});
return response()->json([
'data' => $data,
'meta' => [
'current_page' => $paginator->currentPage(),
'per_page' => $paginator->perPage(),
'total' => $paginator->total(),
'last_page' => $paginator->lastPage(),
],
]);
}
// APPROVE RESERVATION (vendor)
public function approve(Request $request, int $id)
{
$reservation = null;
$table = null;
try {
DB::transaction(function () use ($request, $id, &$reservation, &$table) {
$reservation = Reservation::query()
->where('id', $id)
->whereHas('venue', function ($q) use ($request) {
$q->where('vendor_id', $request->user()->id);
})
->lockForUpdate()
->first();
if (! $reservation) {
throw new \RuntimeException('Reservation not found.', 404);
}
$table = $reservation->tableAssignment?->table;
if (! $table) {
$table = $this->findAvailableTable($reservation, true, true);
if (! $table) {
throw new \RuntimeException('No available table for this reservation.', 409);
}
ReservationTableAssignment::create([
'reservation_id' => $reservation->id,
'venue_table_id' => $table->id,
]);
}
$this->updateStatus($reservation, 'approved', $request->user()->id);
$this->notifyCustomer(
$reservation,
'reservation_approved',
'Reservation approved',
'Your reservation has been approved.'
);
});
} catch (\RuntimeException $e) {
$status = $e->getCode() >= 400 ? $e->getCode() : 409;
return response()->json(['message' => $e->getMessage()], $status);
}
return response()->json([
'message' => 'Reservation approved successfully',
'reservation' => [
'id' => $reservation->id,
'status' => $reservation->status,
'rejection_reason' => $reservation->rejection_reason,
'table' => [
'id' => $table->id,
'name' => $table->name,
'capacity' => $table->capacity,
],
],
]);
}
// REJECT RESERVATION (vendor)
public function reject(Request $request, int $id)
{
$validated = $request->validate([
'reason' => 'required|string|max:255',
]);
$reservation = $this->findVendorReservation($request, $id);
if (! $reservation) {
return response()->json(['message' => 'Reservation not found.'], 404);
}
$this->updateStatus($reservation, 'rejected', $request->user()->id, $validated['reason']);
$this->notifyCustomer(
$reservation,
'reservation_rejected',
'Reservation rejected',
$validated['reason']
);
return response()->json([
'message' => 'Reservation rejected',
'reservation' => [
'id' => $reservation->id,
'status' => $reservation->status,
'rejection_reason' => $reservation->rejection_reason,
],
]);
}
// CANCEL RESERVATION (customer)
public function cancelByCustomer(Request $request, int $id)
{
$reservation = Reservation::query()
->where('customer_id', $request->user()->id)
->findOrFail($id);
if (! $this->canCancel($reservation)) {
return response()->json([
'message' => 'Reservation cannot be cancelled.',
], 422);
}
if (! in_array($reservation->status, ['pending', 'approved'], true)) {
return response()->json([
'message' => 'Reservation cannot be cancelled.',
], 422);
}
$this->updateStatus($reservation, 'cancelled_by_customer', $request->user()->id);
return response()->json([
'message' => 'Reservation cancelled successfully',
'reservation' => [
'id' => $reservation->id,
'status' => $reservation->status,
],
]);
}
// CANCEL RESERVATION (vendor)
public function cancelByVendor(Request $request, int $id)
{
$reservation = $this->findVendorReservation($request, $id);
if (! $reservation) {
return response()->json(['message' => 'Reservation not found.'], 404);
}
if ($reservation->status === 'completed') {
return response()->json([
'message' => 'Reservation cannot be cancelled.',
], 422);
}
$this->updateStatus($reservation, 'cancelled_by_venue', $request->user()->id);
return response()->json([
'message' => 'Reservation cancelled by venue',
'reservation' => [
'id' => $reservation->id,
'status' => $reservation->status,
],
]);
}
private function findVendorReservation(Request $request, int $id): ?Reservation
{
return Reservation::query()
->whereHas('venue', function ($q) use ($request) {
$q->where('vendor_id', $request->user()->id);
})
->find($id);
}
// LIST MY RESERVATIONS (customer)
public function myReservations(Request $request)
{
$validated = $request->validate([
'per_page' => 'nullable|integer|min:1|max:50',
]);
$perPage = $validated['per_page'] ?? 10;
$query = Reservation::query()
->where('customer_id', $request->user()->id)
->with([
'venue:id,name,type,description,address_text,lat,lng',
])
->orderByDesc('id');
$paginator = $query->paginate($perPage);
$data = collect($paginator->items())->map(function ($reservation) {
return [
'id' => $reservation->id,
'code' => $reservation->code,
'reservation_date' => $reservation->reservation_date,
'reservation_time' => $reservation->reservation_time,
'party_size' => $reservation->party_size,
'status' => $reservation->status,
'venue' => $reservation->venue ? [
'id' => $reservation->venue->id,
'name' => $reservation->venue->name,
'type' => $reservation->venue->type,
'address_text' => $reservation->venue->address_text,
] : null,
];
});
return response()->json([
'data' => $data,
'meta' => [
'current_page' => $paginator->currentPage(),
'per_page' => $paginator->perPage(),
'total' => $paginator->total(),
'last_page' => $paginator->lastPage(),
],
]);
}
// CREATE RESERVATION (customer)
public function store(Request $request)
{
$user = $request->user();
if ($user->isBlocked()) {
return response()->json(['message' => 'You are temporarily blocked from making reservations.'], 403);
}
$validated = $request->validate([
'venue_id' => 'required|integer|exists:venues,id',
'reservation_date' => 'required|date_format:Y-m-d',
'reservation_time' => 'required|date_format:H:i',
'party_size' => 'required|integer|min:1|max:50',
]);
$venue = Venue::where('id', $validated['venue_id'])
->where('is_active', true)
->first();
if (! $venue) {
return response()->json(['message' => 'Venue not found.'], 404);
}
$reservation = null;
$fee = null;
$table = null;
$reminder = null;
try {
DB::transaction(function () use ($validated, $user, &$reservation, &$fee, &$table, &$reminder) {
$reservation = Reservation::create([
'code' => $this->generateCode(),
'customer_id' => $user->id,
'venue_id' => $validated['venue_id'],
'reservation_date' => $validated['reservation_date'],
'reservation_time' => $validated['reservation_time'],
'party_size' => $validated['party_size'],
'status' => 'pending',
'rejection_reason' => null,
]);
$table = $this->findAvailableTable($reservation, true, true);
if (! $table) {
throw new \RuntimeException('No available table for this reservation.');
}
ReservationTableAssignment::create([
'reservation_id' => $reservation->id,
'venue_table_id' => $table->id,
]);
$fee = $this->createReservationFee($reservation);
$reminder = $this->createReservationReminder($reservation);
$this->logStatusChange($reservation, null, 'pending', $user->id);
});
} catch (\RuntimeException $e) {
return response()->json(['message' => $e->getMessage()], 409);
}
return response()->json([
'data' => [
'reservation' => [
'id' => $reservation->id,
'code' => $reservation->code,
'status' => $reservation->status,
'reservation_date' => $reservation->reservation_date,
'reservation_time' => $reservation->reservation_time,
'party_size' => $reservation->party_size,
],
'fee' => [
'price_per_person' => $fee->price_per_person,
'party_size' => $fee->party_size,
'total_amount' => $fee->total_amount,
'currency' => $fee->currency,
],
'table' => [
'id' => $table->id,
'name' => $table->name,
'capacity' => $table->capacity,
],
'reminder' => [
'send_at' => $reminder->send_at,
],
],
], 201);
}
private function generateCode(): string
{
do {
$code = Str::upper(Str::random(8));
} while (Reservation::where('code', $code)->exists());
return $code;
}
private function createReservationFee(Reservation $reservation): ReservationFee
{
$venue = $reservation->venue ?: Venue::find($reservation->venue_id);
$rule = $this->getPricingRule($venue);
$pricePerPerson = $rule ? (float) $rule->price_per_person : 0.0;
$total = $pricePerPerson * (int) $reservation->party_size;
$currency = env('APP_CURRENCY', 'USD');
return ReservationFee::create([
'reservation_id' => $reservation->id,
'pricing_rule_id' => $rule?->id,
'price_per_person' => $pricePerPerson,
'party_size' => $reservation->party_size,
'total_amount' => $total,
'currency' => $currency,
]);
}
private function getPricingRule(?Venue $venue): ?PricingRule
{
if (! $venue) {
return PricingRule::where('scope', 'global')->where('is_active', true)->latest('id')->first();
}
$venueRule = PricingRule::where('scope', 'venue')
->where('venue_id', $venue->id)
->where('is_active', true)
->latest('id')
->first();
if ($venueRule) {
return $venueRule;
}
$typeRule = PricingRule::where('scope', 'type')
->where('venue_type', $venue->type)
->where('is_active', true)
->latest('id')
->first();
if ($typeRule) {
return $typeRule;
}
return PricingRule::where('scope', 'global')->where('is_active', true)->latest('id')->first();
}
private function findAvailableTable(Reservation $reservation, bool $includePending, bool $lockRows = false): ?VenueTable
{
$durationMinutes = (int) env('RESERVATION_DURATION_MINUTES', 90);
if ($durationMinutes < 30) {
$durationMinutes = 90;
}
$start = Carbon::parse($reservation->reservation_date . ' ' . $reservation->reservation_time);
$end = $start->copy()->addMinutes($durationMinutes);
$tablesQuery = VenueTable::query()
->where('venue_id', $reservation->venue_id)
->where('is_active', true)
->where('capacity', '>=', $reservation->party_size)
->orderBy('capacity');
if ($lockRows) {
$tablesQuery->lockForUpdate();
}
$tables = $tablesQuery->get();
if ($tables->isEmpty()) {
return null;
}
$tableIds = $tables->pluck('id')->all();
$assignedQuery = ReservationTableAssignment::query()
->whereIn('venue_table_id', $tableIds)
->whereHas('reservation', function ($q) use ($reservation, $includePending) {
$statuses = ['approved', 'completed'];
if ($includePending) {
$statuses[] = 'pending';
}
$q->where('venue_id', $reservation->venue_id)
->whereIn('status', $statuses);
})
->with('reservation');
if ($lockRows) {
$assignedQuery->lockForUpdate();
}
$assigned = $assignedQuery->get();
foreach ($tables as $table) {
$conflict = false;
foreach ($assigned as $assign) {
if ($assign->venue_table_id !== $table->id) {
continue;
}
$rStart = Carbon::parse($assign->reservation->reservation_date . ' ' . $assign->reservation->reservation_time);
$rEnd = $rStart->copy()->addMinutes($durationMinutes);
if ($start < $rEnd && $end > $rStart) {
$conflict = true;
break;
}
}
if (! $conflict) {
return $table;
}
}
return null;
}
private function createReservationReminder(Reservation $reservation): ReservationReminder
{
$minutes = (int) env('RESERVATION_REMINDER_MINUTES', 60);
if ($minutes < 1) {
$minutes = 60;
}
$dateTime = Carbon::parse($reservation->reservation_date . ' ' . $reservation->reservation_time);
$sendAt = $dateTime->copy()->subMinutes($minutes);
return ReservationReminder::create([
'reservation_id' => $reservation->id,
'send_at' => $sendAt,
'sent_at' => null,
]);
}
// MARK NO-SHOW (vendor)
public function markNoShow(Request $request, int $id)
{
$reservation = $this->findVendorReservation($request, $id);
if (! $reservation) {
return response()->json(['message' => 'Reservation not found.'], 404);
}
$this->updateStatus($reservation, 'no_show', $request->user()->id);
return response()->json([
'message' => 'Reservation marked as no_show',
'reservation' => [
'id' => $reservation->id,
'status' => $reservation->status,
],
]);
}
// MARK COMPLETED (vendor)
public function markCompleted(Request $request, int $id)
{
$reservation = $this->findVendorReservation($request, $id);
if (! $reservation) {
return response()->json(['message' => 'Reservation not found.'], 404);
}
$this->updateStatus($reservation, 'completed', $request->user()->id);
return response()->json([
'message' => 'Reservation marked as completed',
'reservation' => [
'id' => $reservation->id,
'status' => $reservation->status,
],
]);
}
private function updateStatus(Reservation $reservation, string $newStatus, int $changedByUserId, ?string $rejectionReason = null): void
{
$oldStatus = $reservation->status;
$reservation->status = $newStatus;
$reservation->rejection_reason = $newStatus === 'rejected' ? $rejectionReason : null;
$reservation->save();
$this->logStatusChange($reservation, $oldStatus, $newStatus, $changedByUserId);
if ($this->isFakeBooking($newStatus)) {
$this->applyStrike($reservation->customer);
}
}
private function notifyCustomer(Reservation $reservation, string $type, string $title, string $body): void
{
Notification::create([
'user_id' => $reservation->customer_id,
'type' => $type,
'title' => $title,
'body' => $body,
'data_json' => [
'reservation_id' => $reservation->id,
'venue_id' => $reservation->venue_id,
'status' => $reservation->status,
],
]);
}
private function logStatusChange(Reservation $reservation, ?string $oldStatus, string $newStatus, int $changedByUserId): void
{
ReservationStatusHistory::create([
'reservation_id' => $reservation->id,
'old_status' => $oldStatus,
'new_status' => $newStatus,
'changed_by_user_id' => $changedByUserId,
'created_at' => now(),
]);
}
private function isFakeBooking(string $status): bool
{
return in_array($status, ['no_show'], true);
}
private function applyStrike($customer): void
{
if (! $customer) {
return;
}
$customer->strike_count = $customer->strike_count + 1;
if ($customer->strike_count >= 9) {
$customer->blocked_permanent = true;
} elseif ($customer->strike_count >= 6) {
$customer->blocked_until = now()->addDays(30);
} elseif ($customer->strike_count >= 3) {
$customer->blocked_until = now()->addDays(7);
}
$customer->save();
}
private function canCancel(Reservation $reservation): bool
{
$dateTime = Carbon::parse($reservation->reservation_date . ' ' . $reservation->reservation_time);
return now()->lt($dateTime->subHour());
}
}
@@ -0,0 +1,429 @@
<?php
namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller;
use App\Models\Role;
use App\Models\User;
use App\Models\Venue;
use App\Models\VenueTable;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Hash;
use Illuminate\Validation\ValidationException;
class VenueController extends Controller
{
// LIST VENUES (customer)
public function index(Request $request)
{
$validated = $request->validate([
'type' => 'nullable|in:restaurant,cafe',
'search' => 'nullable|string|max:255',
'per_page' => 'nullable|integer|min:1|max:50',
]);
$query = Venue::query()
->select([
'id',
'name',
'type',
'description',
'address_text',
'lat',
'lng',
'amenities',
'image_urls',
'offers',
]);
$query->where('is_active', true);
if (! empty($validated['type'])) {
$query->where('type', $validated['type']);
}
if (! empty($validated['search'])) {
$query->where('name', 'like', '%' . $validated['search'] . '%');
}
$perPage = $validated['per_page'] ?? 10;
$paginator = $query->orderByDesc('id')->paginate($perPage);
return response()->json([
'data' => $paginator->items(),
'meta' => [
'current_page' => $paginator->currentPage(),
'per_page' => $paginator->perPage(),
'total' => $paginator->total(),
'last_page' => $paginator->lastPage(),
],
]);
}
// SHOW VENUE (public)
public function show(int $id)
{
$venue = Venue::query()
->select([
'id',
'name',
'type',
'description',
'address_text',
'lat',
'lng',
'amenities',
'image_urls',
'offers',
])
->where('is_active', true)
->findOrFail($id);
return response()->json([
'data' => $venue,
]);
}
// CREATE VENUE (vendor only)
public function store(Request $request)
{
$user = $request->user();
$validated = $request->validate([
'name' => 'required|string|max:255',
'type' => 'required|in:restaurant,cafe',
'description' => 'nullable|string',
'address_text' => 'nullable|string|max:255',
'lat' => 'nullable|numeric',
'lng' => 'nullable|numeric',
'phone' => 'nullable|string|max:50',
'amenities' => 'nullable|array',
'amenities.*' => 'string|max:100',
'image_urls' => 'nullable|array|max:10',
'image_urls.*' => 'url|max:2048',
'offers' => 'nullable|array|max:20',
'offers.*.title' => 'required_with:offers|string|max:120',
'offers.*.description' => 'nullable|string|max:500',
'offers.*.image_url' => 'nullable|url|max:2048',
'offers.*.is_active' => 'nullable|boolean',
]);
$venue = Venue::create([
'vendor_id' => $user->id,
'name' => $validated['name'],
'type' => $validated['type'],
'description' => $validated['description'] ?? null,
'address_text' => $validated['address_text'] ?? null,
'lat' => $validated['lat'] ?? null,
'lng' => $validated['lng'] ?? null,
'is_active' => true,
'phone' => $validated['phone'] ?? null,
'amenities' => $validated['amenities'] ?? [],
'image_urls' => $validated['image_urls'] ?? [],
'offers' => $this->sanitizeOffers($validated['offers'] ?? []),
]);
return response()->json([
'message' => 'Venue created successfully',
'venue' => $venue,
], 201);
}
// LIST VENUES (admin)
public function adminIndex(Request $request)
{
$validated = $request->validate([
'search' => 'nullable|string|max:255',
'per_page' => 'nullable|integer|min:1|max:100',
]);
$query = Venue::query()
->select([
'id',
'vendor_id',
'name',
'type',
'description',
'address_text',
'lat',
'lng',
'is_active',
'phone',
'amenities',
'image_urls',
'offers',
])
->withCount([
'tables as table_count' => function ($q) {
$q->where('is_active', true);
},
]);
if (! empty($validated['search'])) {
$query->where('name', 'like', '%' . $validated['search'] . '%');
}
$perPage = $validated['per_page'] ?? 20;
$paginator = $query->orderByDesc('id')->paginate($perPage);
return response()->json([
'data' => $paginator->items(),
'meta' => [
'current_page' => $paginator->currentPage(),
'per_page' => $paginator->perPage(),
'total' => $paginator->total(),
'last_page' => $paginator->lastPage(),
],
]);
}
// CREATE VENUE (admin)
public function adminStore(Request $request)
{
$validated = $request->validate([
'vendor_id' => 'nullable|integer|exists:users,id',
'name' => 'required|string|max:255',
'type' => 'required|in:restaurant,cafe',
'description' => 'nullable|string',
'address_text' => 'nullable|string|max:255',
'lat' => 'nullable|numeric',
'lng' => 'nullable|numeric',
'is_active' => 'nullable|boolean',
'phone' => 'nullable|string|max:50',
'amenities' => 'nullable|array',
'amenities.*' => 'string|max:100',
'image_urls' => 'nullable|array|max:10',
'image_urls.*' => 'url|max:2048',
'images' => 'nullable|array|max:10',
'images.*' => 'file|image|max:5120',
'offers' => 'nullable|array|max:20',
'offers.*.title' => 'required_with:offers|string|max:120',
'offers.*.description' => 'nullable|string|max:500',
'offers.*.image_url' => 'nullable|url|max:2048',
'offers.*.is_active' => 'nullable|boolean',
'table_count' => 'nullable|integer|min:1|max:300',
'vendor_email' => 'nullable|email|unique:users,email',
'vendor_phone' => 'nullable|string|unique:users,phone',
'vendor_password' => 'nullable|string|min:6',
]);
$vendorId = $validated['vendor_id'] ?? null;
if (! $vendorId) {
$hasVendorCreds = ! empty($validated['vendor_email']) &&
! empty($validated['vendor_phone']) &&
! empty($validated['vendor_password']);
if ($hasVendorCreds) {
$vendorRole = Role::firstOrCreate(['name' => 'vendor']);
$vendor = User::create([
'first_name' => 'Vendor',
'last_name' => 'User',
'email' => $validated['vendor_email'],
'phone' => $validated['vendor_phone'],
'password' => Hash::make($validated['vendor_password']),
]);
$vendor->roles()->syncWithoutDetaching([$vendorRole->id]);
$vendorId = $vendor->id;
} else {
$vendorId = $this->resolveVendorId();
}
}
if (! $vendorId) {
return response()->json([
'message' => 'Provide vendor account data (email, phone, password) or vendor_id.',
], 422);
}
$venue = null;
DB::transaction(function () use ($validated, $vendorId, &$venue, $request) {
$imageUrls = $validated['image_urls'] ?? [];
$imageUrls = $this->appendUploadedImages($request, $imageUrls);
$venue = Venue::create([
'vendor_id' => $vendorId,
'name' => $validated['name'],
'type' => $validated['type'],
'description' => $validated['description'] ?? null,
'address_text' => $validated['address_text'] ?? null,
'lat' => $validated['lat'] ?? null,
'lng' => $validated['lng'] ?? null,
'is_active' => $validated['is_active'] ?? true,
'phone' => $validated['phone'] ?? null,
'amenities' => $validated['amenities'] ?? [],
'image_urls' => $imageUrls,
'offers' => $this->sanitizeOffers($validated['offers'] ?? []),
]);
$this->syncVenueTables($venue, (int) ($validated['table_count'] ?? 4));
});
return response()->json([
'message' => 'Venue created successfully',
'venue' => $venue->loadCount([
'tables as table_count' => function ($q) {
$q->where('is_active', true);
},
]),
], 201);
}
// UPDATE VENUE (admin)
public function adminUpdate(Request $request, int $id)
{
$validated = $request->validate([
'vendor_id' => 'nullable|integer|exists:users,id',
'name' => 'sometimes|required|string|max:255',
'type' => 'sometimes|required|in:restaurant,cafe',
'description' => 'nullable|string',
'address_text' => 'nullable|string|max:255',
'lat' => 'nullable|numeric',
'lng' => 'nullable|numeric',
'is_active' => 'nullable|boolean',
'phone' => 'nullable|string|max:50',
'amenities' => 'nullable|array',
'amenities.*' => 'string|max:100',
'image_urls' => 'nullable|array|max:10',
'image_urls.*' => 'url|max:2048',
'images' => 'nullable|array|max:10',
'images.*' => 'file|image|max:5120',
'offers' => 'nullable|array|max:20',
'offers.*.title' => 'required_with:offers|string|max:120',
'offers.*.description' => 'nullable|string|max:500',
'offers.*.image_url' => 'nullable|url|max:2048',
'offers.*.is_active' => 'nullable|boolean',
'table_count' => 'nullable|integer|min:1|max:300',
]);
$venue = Venue::findOrFail($id);
DB::transaction(function () use (&$venue, $validated, $request) {
if (array_key_exists('offers', $validated)) {
$validated['offers'] = $this->sanitizeOffers($validated['offers'] ?? []);
}
$baseImageUrls = array_key_exists('image_urls', $validated)
? ($validated['image_urls'] ?? [])
: ($venue->image_urls ?? []);
$validated['image_urls'] = $this->appendUploadedImages($request, $baseImageUrls);
$venue->fill($validated);
$venue->save();
if (array_key_exists('table_count', $validated)) {
$this->syncVenueTables($venue, (int) $validated['table_count']);
}
});
return response()->json([
'message' => 'Venue updated successfully',
'venue' => $venue->loadCount([
'tables as table_count' => function ($q) {
$q->where('is_active', true);
},
]),
]);
}
// DELETE VENUE (admin)
public function adminDestroy(int $id)
{
$venue = Venue::findOrFail($id);
$venue->delete();
return response()->json([
'message' => 'Venue deleted successfully',
]);
}
private function resolveVendorId(): ?int
{
$vendor = User::query()
->whereHas('roles', function ($q) {
$q->where('name', 'vendor');
})
->first();
return $vendor?->id;
}
private function syncVenueTables(Venue $venue, int $targetCount): void
{
$targetCount = max(1, min($targetCount, 300));
$activeTables = VenueTable::query()
->where('venue_id', $venue->id)
->where('is_active', true)
->orderBy('id')
->get();
$currentCount = $activeTables->count();
if ($currentCount < $targetCount) {
for ($i = $currentCount + 1; $i <= $targetCount; $i++) {
VenueTable::create([
'venue_id' => $venue->id,
'seating_area_id' => null,
'name' => 'Table ' . $i,
'capacity' => 4,
'is_active' => true,
]);
}
return;
}
if ($currentCount > $targetCount) {
$toDisable = $activeTables->slice($targetCount);
foreach ($toDisable as $table) {
$table->is_active = false;
$table->save();
}
}
}
private function sanitizeOffers(array $offers): array
{
return collect($offers)
->filter(fn ($offer) => is_array($offer))
->map(function (array $offer) {
return [
'title' => trim((string) ($offer['title'] ?? '')),
'description' => trim((string) ($offer['description'] ?? '')),
'image_url' => trim((string) ($offer['image_url'] ?? '')),
'is_active' => array_key_exists('is_active', $offer)
? (bool) $offer['is_active']
: true,
];
})
->filter(fn (array $offer) => $offer['title'] !== '')
->values()
->all();
}
private function appendUploadedImages(Request $request, array $imageUrls): array
{
$urls = collect($imageUrls)
->map(fn ($url) => trim((string) $url))
->filter(fn ($url) => $url !== '')
->values()
->all();
if ($request->hasFile('images')) {
foreach ($request->file('images') as $image) {
$path = $image->store('venues', 'public');
$urls[] = rtrim($request->getSchemeAndHttpHost(), '/') . '/storage/' . ltrim($path, '/');
}
}
$urls = collect($urls)->unique()->values()->all();
if (count($urls) > 10) {
throw ValidationException::withMessages([
'images' => ['Maximum 10 images allowed per venue.'],
]);
}
return $urls;
}
}
@@ -0,0 +1,8 @@
<?php
namespace App\Http\Controllers;
abstract class Controller
{
//
}
@@ -0,0 +1,31 @@
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Symfony\Component\HttpFoundation\Response;
class RoleMiddleware
{
public function handle(Request $request, Closure $next, ...$roles): Response
{
$user = $request->user();
if (! $user) {
return response()->json(['message' => 'Unauthenticated.'], 401);
}
if (empty($roles)) {
return response()->json(['message' => 'Forbidden.'], 403);
}
foreach ($roles as $role) {
if ($user->hasRole($role)) {
return $next($request);
}
}
return response()->json(['message' => 'Forbidden.'], 403);
}
}
+30
View File
@@ -0,0 +1,30 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
class Notification extends Model
{
use HasFactory;
protected $fillable = [
'user_id',
'type',
'title',
'body',
'data_json',
'is_read',
];
protected $casts = [
'data_json' => 'array',
'is_read' => 'boolean',
];
public function user()
{
return $this->belongsTo(User::class);
}
}
+24
View File
@@ -0,0 +1,24 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
class PricingRule extends Model
{
use HasFactory;
protected $fillable = [
'scope',
'venue_type',
'venue_id',
'price_per_person',
'is_active',
];
public function venue()
{
return $this->belongsTo(Venue::class);
}
}
+50
View File
@@ -0,0 +1,50 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use App\Models\ReservationStatusHistory;
use App\Models\ReservationFee;
use App\Models\ReservationTableAssignment;
class Reservation extends Model
{
use HasFactory;
protected $fillable = [
'code',
'customer_id',
'venue_id',
'reservation_date',
'reservation_time',
'party_size',
'status',
'rejection_reason',
];
public function customer()
{
return $this->belongsTo(User::class, 'customer_id');
}
public function venue()
{
return $this->belongsTo(Venue::class);
}
public function statusHistory()
{
return $this->hasMany(ReservationStatusHistory::class);
}
public function fee()
{
return $this->hasOne(ReservationFee::class);
}
public function tableAssignment()
{
return $this->hasOne(ReservationTableAssignment::class);
}
}
@@ -0,0 +1,30 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
class ReservationFee extends Model
{
use HasFactory;
protected $fillable = [
'reservation_id',
'pricing_rule_id',
'price_per_person',
'party_size',
'total_amount',
'currency',
];
public function reservation()
{
return $this->belongsTo(Reservation::class);
}
public function pricingRule()
{
return $this->belongsTo(PricingRule::class);
}
}
@@ -0,0 +1,27 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
class ReservationReminder extends Model
{
use HasFactory;
protected $fillable = [
'reservation_id',
'send_at',
'sent_at',
];
protected $casts = [
'send_at' => 'datetime',
'sent_at' => 'datetime',
];
public function reservation()
{
return $this->belongsTo(Reservation::class);
}
}
@@ -0,0 +1,31 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
class ReservationStatusHistory extends Model
{
use HasFactory;
public $timestamps = false;
protected $fillable = [
'reservation_id',
'old_status',
'new_status',
'changed_by_user_id',
'created_at',
];
public function reservation()
{
return $this->belongsTo(Reservation::class);
}
public function changedBy()
{
return $this->belongsTo(User::class, 'changed_by_user_id');
}
}
@@ -0,0 +1,33 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
class ReservationTableAssignment extends Model
{
use HasFactory;
public $timestamps = false;
protected $fillable = [
'reservation_id',
'venue_table_id',
'assigned_at',
];
protected $casts = [
'assigned_at' => 'datetime',
];
public function reservation()
{
return $this->belongsTo(Reservation::class);
}
public function table()
{
return $this->belongsTo(VenueTable::class, 'venue_table_id');
}
}
+20
View File
@@ -0,0 +1,20 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
class Role extends Model
{
use HasFactory;
protected $fillable = [
'name',
];
public function users()
{
return $this->belongsToMany(User::class, 'user_roles');
}
}
+27
View File
@@ -0,0 +1,27 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
class SeatingArea extends Model
{
use HasFactory;
protected $fillable = [
'venue_id',
'name',
'description',
];
public function venue()
{
return $this->belongsTo(Venue::class);
}
public function tables()
{
return $this->hasMany(VenueTable::class);
}
}
+99
View File
@@ -0,0 +1,99 @@
<?php
namespace App\Models;
use Laravel\Sanctum\HasApiTokens;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use App\Models\Role;
use App\Models\Venue;
use App\Models\Reservation;
use Illuminate\Support\Carbon;
use App\Models\Notification;
use App\Models\UserFeedback;
class User extends Authenticatable
{
use HasApiTokens, HasFactory, Notifiable;
/**
* The attributes that are mass assignable.
*
* @var list<string>
*/
protected $fillable = [
'first_name',
'last_name',
'email',
'phone',
'password_hash',
];
/**
* The attributes that should be hidden for serialization.
*
* @var list<string>
*/
protected $hidden = [
'password_hash',
'remember_token',
];
/**
* Get the attributes that should be cast.
*
* @return array<string, string>
*/
protected function casts(): array
{
return [
'email_verified_at' => 'datetime',
'password_hash' => 'hashed',
];
}
public function roles()
{
return $this->belongsToMany(Role::class, 'user_roles');
}
public function hasRole(string $role): bool
{
return $this->roles()->where('name', $role)->exists();
}
public function venues()
{
return $this->hasMany(Venue::class, 'vendor_id');
}
public function reservations()
{
return $this->hasMany(Reservation::class, 'customer_id');
}
public function notifications()
{
return $this->hasMany(Notification::class);
}
public function feedbacks()
{
return $this->hasMany(UserFeedback::class, 'user_id');
}
public function isBlocked(): bool
{
if ($this->blocked_permanent) {
return true;
}
if ($this->blocked_until && Carbon::parse($this->blocked_until)->isFuture()) {
return true;
}
return false;
}
}
+23
View File
@@ -0,0 +1,23 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class UserFeedback extends Model
{
use HasFactory;
protected $table = 'user_feedback';
protected $fillable = [
'user_id',
'message',
];
public function user()
{
return $this->belongsTo(User::class);
}
}
+56
View File
@@ -0,0 +1,56 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use App\Models\Reservation;
use App\Models\SeatingArea;
use App\Models\VenueTable;
class Venue extends Model
{
use HasFactory;
protected $fillable = [
'vendor_id',
'name',
'type',
'description',
'address_text',
'lat',
'lng',
'is_active',
'address',
'phone',
'amenities',
'image_urls',
'offers',
];
protected $casts = [
'amenities' => 'array',
'image_urls' => 'array',
'offers' => 'array',
];
public function vendor()
{
return $this->belongsTo(User::class, 'vendor_id');
}
public function reservations()
{
return $this->hasMany(Reservation::class);
}
public function seatingAreas()
{
return $this->hasMany(SeatingArea::class);
}
public function tables()
{
return $this->hasMany(VenueTable::class);
}
}
+34
View File
@@ -0,0 +1,34 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
class VenueTable extends Model
{
use HasFactory;
protected $fillable = [
'venue_id',
'seating_area_id',
'name',
'capacity',
'is_active',
];
public function venue()
{
return $this->belongsTo(Venue::class);
}
public function seatingArea()
{
return $this->belongsTo(SeatingArea::class);
}
public function assignments()
{
return $this->hasMany(ReservationTableAssignment::class);
}
}
@@ -0,0 +1,24 @@
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*/
public function register(): void
{
//
}
/**
* Bootstrap any application services.
*/
public function boot(): void
{
//
}
}
+18
View File
@@ -0,0 +1,18 @@
#!/usr/bin/env php
<?php
use Illuminate\Foundation\Application;
use Symfony\Component\Console\Input\ArgvInput;
define('LARAVEL_START', microtime(true));
// Register the Composer autoloader...
require __DIR__.'/vendor/autoload.php';
// Bootstrap Laravel and handle the command...
/** @var Application $app */
$app = require_once __DIR__.'/bootstrap/app.php';
$status = $app->handleCommand(new ArgvInput);
exit($status);
+28
View File
@@ -0,0 +1,28 @@
<?php
use Illuminate\Foundation\Application;
use Illuminate\Foundation\Configuration\Exceptions;
use Illuminate\Foundation\Configuration\Middleware;
use Illuminate\Auth\AuthenticationException;
use Illuminate\Http\Request;
return Application::configure(basePath: dirname(__DIR__))
->withRouting(
web: __DIR__.'/../routes/web.php',
api: __DIR__.'/../routes/api.php',
commands: __DIR__.'/../routes/console.php',
)
->withMiddleware(function (Middleware $middleware): void {
// Treat all requests as API-style: don't redirect guests, return 401/403.
$middleware->redirectGuestsTo(fn () => null);
$middleware->alias([
'role' => \App\Http\Middleware\RoleMiddleware::class,
]);
})
->withExceptions(function (Exceptions $exceptions): void {
$exceptions->renderable(function (AuthenticationException $e, Request $request) {
if ($request->is('api/*') || $request->expectsJson()) {
return response()->json(['message' => 'Unauthenticated.'], 401);
}
});
})->create();
+2
View File
@@ -0,0 +1,2 @@
*
!.gitignore
+5
View File
@@ -0,0 +1,5 @@
<?php
return [
App\Providers\AppServiceProvider::class,
];
+86
View File
@@ -0,0 +1,86 @@
{
"$schema": "https://getcomposer.org/schema.json",
"name": "laravel/laravel",
"type": "project",
"description": "The skeleton application for the Laravel framework.",
"keywords": ["laravel", "framework"],
"license": "MIT",
"require": {
"php": "^8.2",
"laravel/framework": "^12.0",
"laravel/sanctum": "^4.3",
"laravel/tinker": "^2.10.1"
},
"require-dev": {
"fakerphp/faker": "^1.23",
"laravel/pail": "^1.2.2",
"laravel/pint": "^1.24",
"laravel/sail": "^1.41",
"mockery/mockery": "^1.6",
"nunomaduro/collision": "^8.6",
"phpunit/phpunit": "^11.5.3"
},
"autoload": {
"psr-4": {
"App\\": "app/",
"Database\\Factories\\": "database/factories/",
"Database\\Seeders\\": "database/seeders/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"scripts": {
"setup": [
"composer install",
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\"",
"@php artisan key:generate",
"@php artisan migrate --force",
"npm install",
"npm run build"
],
"dev": [
"Composer\\Config::disableProcessTimeout",
"npx concurrently -c \"#93c5fd,#c4b5fd,#fb7185,#fdba74\" \"php artisan serve\" \"php artisan queue:listen --tries=1 --timeout=0\" \"php artisan pail --timeout=0\" \"npm run dev\" --names=server,queue,logs,vite --kill-others"
],
"test": [
"@php artisan config:clear --ansi",
"@php artisan test"
],
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover --ansi"
],
"post-update-cmd": [
"@php artisan vendor:publish --tag=laravel-assets --ansi --force"
],
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"@php artisan key:generate --ansi",
"@php artisan migrate --graceful --ansi"
],
"pre-package-uninstall": [
"Illuminate\\Foundation\\ComposerScripts::prePackageUninstall"
]
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true,
"allow-plugins": {
"pestphp/pest-plugin": true,
"php-http/discovery": true
}
},
"minimum-stability": "stable",
"prefer-stable": true
}
+8459
View File
File diff suppressed because it is too large Load Diff
+126
View File
@@ -0,0 +1,126 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Application Name
|--------------------------------------------------------------------------
|
| This value is the name of your application, which will be used when the
| framework needs to place the application's name in a notification or
| other UI elements where an application name needs to be displayed.
|
*/
'name' => env('APP_NAME', 'Laravel'),
/*
|--------------------------------------------------------------------------
| Application Environment
|--------------------------------------------------------------------------
|
| This value determines the "environment" your application is currently
| running in. This may determine how you prefer to configure various
| services the application utilizes. Set this in your ".env" file.
|
*/
'env' => env('APP_ENV', 'production'),
/*
|--------------------------------------------------------------------------
| Application Debug Mode
|--------------------------------------------------------------------------
|
| When your application is in debug mode, detailed error messages with
| stack traces will be shown on every error that occurs within your
| application. If disabled, a simple generic error page is shown.
|
*/
'debug' => (bool) env('APP_DEBUG', false),
/*
|--------------------------------------------------------------------------
| Application URL
|--------------------------------------------------------------------------
|
| This URL is used by the console to properly generate URLs when using
| the Artisan command line tool. You should set this to the root of
| the application so that it's available within Artisan commands.
|
*/
'url' => env('APP_URL', 'http://localhost'),
/*
|--------------------------------------------------------------------------
| Application Timezone
|--------------------------------------------------------------------------
|
| Here you may specify the default timezone for your application, which
| will be used by the PHP date and date-time functions. The timezone
| is set to "UTC" by default as it is suitable for most use cases.
|
*/
'timezone' => 'UTC',
/*
|--------------------------------------------------------------------------
| Application Locale Configuration
|--------------------------------------------------------------------------
|
| The application locale determines the default locale that will be used
| by Laravel's translation / localization methods. This option can be
| set to any locale for which you plan to have translation strings.
|
*/
'locale' => env('APP_LOCALE', 'en'),
'fallback_locale' => env('APP_FALLBACK_LOCALE', 'en'),
'faker_locale' => env('APP_FAKER_LOCALE', 'en_US'),
/*
|--------------------------------------------------------------------------
| Encryption Key
|--------------------------------------------------------------------------
|
| This key is utilized by Laravel's encryption services and should be set
| to a random, 32 character string to ensure that all encrypted values
| are secure. You should do this prior to deploying the application.
|
*/
'cipher' => 'AES-256-CBC',
'key' => env('APP_KEY'),
'previous_keys' => [
...array_filter(
explode(',', (string) env('APP_PREVIOUS_KEYS', ''))
),
],
/*
|--------------------------------------------------------------------------
| Maintenance Mode Driver
|--------------------------------------------------------------------------
|
| These configuration options determine the driver used to determine and
| manage Laravel's "maintenance mode" status. The "cache" driver will
| allow maintenance mode to be controlled across multiple machines.
|
| Supported drivers: "file", "cache"
|
*/
'maintenance' => [
'driver' => env('APP_MAINTENANCE_DRIVER', 'file'),
'store' => env('APP_MAINTENANCE_STORE', 'database'),
],
];
+115
View File
@@ -0,0 +1,115 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Authentication Defaults
|--------------------------------------------------------------------------
|
| This option defines the default authentication "guard" and password
| reset "broker" for your application. You may change these values
| as required, but they're a perfect start for most applications.
|
*/
'defaults' => [
'guard' => env('AUTH_GUARD', 'web'),
'passwords' => env('AUTH_PASSWORD_BROKER', 'users'),
],
/*
|--------------------------------------------------------------------------
| Authentication Guards
|--------------------------------------------------------------------------
|
| Next, you may define every authentication guard for your application.
| Of course, a great default configuration has been defined for you
| which utilizes session storage plus the Eloquent user provider.
|
| All authentication guards have a user provider, which defines how the
| users are actually retrieved out of your database or other storage
| system used by the application. Typically, Eloquent is utilized.
|
| Supported: "session"
|
*/
'guards' => [
'web' => [
'driver' => 'session',
'provider' => 'users',
],
],
/*
|--------------------------------------------------------------------------
| User Providers
|--------------------------------------------------------------------------
|
| All authentication guards have a user provider, which defines how the
| users are actually retrieved out of your database or other storage
| system used by the application. Typically, Eloquent is utilized.
|
| If you have multiple user tables or models you may configure multiple
| providers to represent the model / table. These providers may then
| be assigned to any extra authentication guards you have defined.
|
| Supported: "database", "eloquent"
|
*/
'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => env('AUTH_MODEL', App\Models\User::class),
],
// 'users' => [
// 'driver' => 'database',
// 'table' => 'users',
// ],
],
/*
|--------------------------------------------------------------------------
| Resetting Passwords
|--------------------------------------------------------------------------
|
| These configuration options specify the behavior of Laravel's password
| reset functionality, including the table utilized for token storage
| and the user provider that is invoked to actually retrieve users.
|
| The expiry time is the number of minutes that each reset token will be
| considered valid. This security feature keeps tokens short-lived so
| they have less time to be guessed. You may change this as needed.
|
| The throttle setting is the number of seconds a user must wait before
| generating more password reset tokens. This prevents the user from
| quickly generating a very large amount of password reset tokens.
|
*/
'passwords' => [
'users' => [
'provider' => 'users',
'table' => env('AUTH_PASSWORD_RESET_TOKEN_TABLE', 'password_reset_tokens'),
'expire' => 60,
'throttle' => 60,
],
],
/*
|--------------------------------------------------------------------------
| Password Confirmation Timeout
|--------------------------------------------------------------------------
|
| Here you may define the number of seconds before a password confirmation
| window expires and users are asked to re-enter their password via the
| confirmation screen. By default, the timeout lasts for three hours.
|
*/
'password_timeout' => env('AUTH_PASSWORD_TIMEOUT', 10800),
];
+117
View File
@@ -0,0 +1,117 @@
<?php
use Illuminate\Support\Str;
return [
/*
|--------------------------------------------------------------------------
| Default Cache Store
|--------------------------------------------------------------------------
|
| This option controls the default cache store that will be used by the
| framework. This connection is utilized if another isn't explicitly
| specified when running a cache operation inside the application.
|
*/
'default' => env('CACHE_STORE', 'database'),
/*
|--------------------------------------------------------------------------
| Cache Stores
|--------------------------------------------------------------------------
|
| Here you may define all of the cache "stores" for your application as
| well as their drivers. You may even define multiple stores for the
| same cache driver to group types of items stored in your caches.
|
| Supported drivers: "array", "database", "file", "memcached",
| "redis", "dynamodb", "octane",
| "failover", "null"
|
*/
'stores' => [
'array' => [
'driver' => 'array',
'serialize' => false,
],
'database' => [
'driver' => 'database',
'connection' => env('DB_CACHE_CONNECTION'),
'table' => env('DB_CACHE_TABLE', 'cache'),
'lock_connection' => env('DB_CACHE_LOCK_CONNECTION'),
'lock_table' => env('DB_CACHE_LOCK_TABLE'),
],
'file' => [
'driver' => 'file',
'path' => storage_path('framework/cache/data'),
'lock_path' => storage_path('framework/cache/data'),
],
'memcached' => [
'driver' => 'memcached',
'persistent_id' => env('MEMCACHED_PERSISTENT_ID'),
'sasl' => [
env('MEMCACHED_USERNAME'),
env('MEMCACHED_PASSWORD'),
],
'options' => [
// Memcached::OPT_CONNECT_TIMEOUT => 2000,
],
'servers' => [
[
'host' => env('MEMCACHED_HOST', '127.0.0.1'),
'port' => env('MEMCACHED_PORT', 11211),
'weight' => 100,
],
],
],
'redis' => [
'driver' => 'redis',
'connection' => env('REDIS_CACHE_CONNECTION', 'cache'),
'lock_connection' => env('REDIS_CACHE_LOCK_CONNECTION', 'default'),
],
'dynamodb' => [
'driver' => 'dynamodb',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
'table' => env('DYNAMODB_CACHE_TABLE', 'cache'),
'endpoint' => env('DYNAMODB_ENDPOINT'),
],
'octane' => [
'driver' => 'octane',
],
'failover' => [
'driver' => 'failover',
'stores' => [
'database',
'array',
],
],
],
/*
|--------------------------------------------------------------------------
| Cache Key Prefix
|--------------------------------------------------------------------------
|
| When utilizing the APC, database, memcached, Redis, and DynamoDB cache
| stores, there might be other applications using the same cache. For
| that reason, you may prefix every cache key to avoid collisions.
|
*/
'prefix' => env('CACHE_PREFIX', Str::slug((string) env('APP_NAME', 'laravel')).'-cache-'),
];
+183
View File
@@ -0,0 +1,183 @@
<?php
use Illuminate\Support\Str;
return [
/*
|--------------------------------------------------------------------------
| Default Database Connection Name
|--------------------------------------------------------------------------
|
| Here you may specify which of the database connections below you wish
| to use as your default connection for database operations. This is
| the connection which will be utilized unless another connection
| is explicitly specified when you execute a query / statement.
|
*/
'default' => env('DB_CONNECTION', 'pgsql'),
/*
|--------------------------------------------------------------------------
| Database Connections
|--------------------------------------------------------------------------
|
| Below are all of the database connections defined for your application.
| An example configuration is provided for each database system which
| is supported by Laravel. You're free to add / remove connections.
|
*/
'connections' => [
'sqlite' => [
'driver' => 'sqlite',
'url' => env('DB_URL'),
'database' => env('DB_DATABASE', database_path('database.sqlite')),
'prefix' => '',
'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
'busy_timeout' => null,
'journal_mode' => null,
'synchronous' => null,
'transaction_mode' => 'DEFERRED',
],
'mysql' => [
'driver' => 'mysql',
'url' => env('DB_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'laravel'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => env('DB_CHARSET', 'utf8mb4'),
'collation' => env('DB_COLLATION', 'utf8mb4_unicode_ci'),
'prefix' => '',
'prefix_indexes' => true,
'strict' => true,
'engine' => null,
'options' => extension_loaded('pdo_mysql') ? array_filter([
(PHP_VERSION_ID >= 80500 ? \Pdo\Mysql::ATTR_SSL_CA : \PDO::MYSQL_ATTR_SSL_CA) => env('MYSQL_ATTR_SSL_CA'),
]) : [],
],
'mariadb' => [
'driver' => 'mariadb',
'url' => env('DB_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'laravel'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => env('DB_CHARSET', 'utf8mb4'),
'collation' => env('DB_COLLATION', 'utf8mb4_unicode_ci'),
'prefix' => '',
'prefix_indexes' => true,
'strict' => true,
'engine' => null,
'options' => extension_loaded('pdo_mysql') ? array_filter([
(PHP_VERSION_ID >= 80500 ? \Pdo\Mysql::ATTR_SSL_CA : \PDO::MYSQL_ATTR_SSL_CA) => env('MYSQL_ATTR_SSL_CA'),
]) : [],
],
'pgsql' => [
'driver' => 'pgsql',
'url' => env('DB_URL', env('DATABASE_URL')),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '5432'),
'database' => env('DB_DATABASE', 'laravel'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'charset' => env('DB_CHARSET', 'utf8'),
'prefix' => '',
'prefix_indexes' => true,
'search_path' => 'public',
'sslmode' => env('DB_SSLMODE', 'prefer'),
],
'sqlsrv' => [
'driver' => 'sqlsrv',
'url' => env('DB_URL'),
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', '1433'),
'database' => env('DB_DATABASE', 'laravel'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'charset' => env('DB_CHARSET', 'utf8'),
'prefix' => '',
'prefix_indexes' => true,
// 'encrypt' => env('DB_ENCRYPT', 'yes'),
// 'trust_server_certificate' => env('DB_TRUST_SERVER_CERTIFICATE', 'false'),
],
],
/*
|--------------------------------------------------------------------------
| Migration Repository Table
|--------------------------------------------------------------------------
|
| This table keeps track of all the migrations that have already run for
| your application. Using this information, we can determine which of
| the migrations on disk haven't actually been run on the database.
|
*/
'migrations' => [
'table' => 'migrations',
'update_date_on_publish' => true,
],
/*
|--------------------------------------------------------------------------
| Redis Databases
|--------------------------------------------------------------------------
|
| Redis is an open source, fast, and advanced key-value store that also
| provides a richer body of commands than a typical key-value system
| such as Memcached. You may define your connection settings here.
|
*/
'redis' => [
'client' => env('REDIS_CLIENT', 'phpredis'),
'options' => [
'cluster' => env('REDIS_CLUSTER', 'redis'),
'prefix' => env('REDIS_PREFIX', Str::slug((string) env('APP_NAME', 'laravel')).'-database-'),
'persistent' => env('REDIS_PERSISTENT', false),
],
'default' => [
'url' => env('REDIS_URL'),
'host' => env('REDIS_HOST', '127.0.0.1'),
'username' => env('REDIS_USERNAME'),
'password' => env('REDIS_PASSWORD'),
'port' => env('REDIS_PORT', '6379'),
'database' => env('REDIS_DB', '0'),
'max_retries' => env('REDIS_MAX_RETRIES', 3),
'backoff_algorithm' => env('REDIS_BACKOFF_ALGORITHM', 'decorrelated_jitter'),
'backoff_base' => env('REDIS_BACKOFF_BASE', 100),
'backoff_cap' => env('REDIS_BACKOFF_CAP', 1000),
],
'cache' => [
'url' => env('REDIS_URL'),
'host' => env('REDIS_HOST', '127.0.0.1'),
'username' => env('REDIS_USERNAME'),
'password' => env('REDIS_PASSWORD'),
'port' => env('REDIS_PORT', '6379'),
'database' => env('REDIS_CACHE_DB', '1'),
'max_retries' => env('REDIS_MAX_RETRIES', 3),
'backoff_algorithm' => env('REDIS_BACKOFF_ALGORITHM', 'decorrelated_jitter'),
'backoff_base' => env('REDIS_BACKOFF_BASE', 100),
'backoff_cap' => env('REDIS_BACKOFF_CAP', 1000),
],
],
];
+80
View File
@@ -0,0 +1,80 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Filesystem Disk
|--------------------------------------------------------------------------
|
| Here you may specify the default filesystem disk that should be used
| by the framework. The "local" disk, as well as a variety of cloud
| based disks are available to your application for file storage.
|
*/
'default' => env('FILESYSTEM_DISK', 'local'),
/*
|--------------------------------------------------------------------------
| Filesystem Disks
|--------------------------------------------------------------------------
|
| Below you may configure as many filesystem disks as necessary, and you
| may even configure multiple disks for the same driver. Examples for
| most supported storage drivers are configured here for reference.
|
| Supported drivers: "local", "ftp", "sftp", "s3"
|
*/
'disks' => [
'local' => [
'driver' => 'local',
'root' => storage_path('app/private'),
'serve' => true,
'throw' => false,
'report' => false,
],
'public' => [
'driver' => 'local',
'root' => storage_path('app/public'),
'url' => rtrim(env('APP_URL', 'http://localhost'), '/').'/storage',
'visibility' => 'public',
'throw' => false,
'report' => false,
],
's3' => [
'driver' => 's3',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION'),
'bucket' => env('AWS_BUCKET'),
'url' => env('AWS_URL'),
'endpoint' => env('AWS_ENDPOINT'),
'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false),
'throw' => false,
'report' => false,
],
],
/*
|--------------------------------------------------------------------------
| Symbolic Links
|--------------------------------------------------------------------------
|
| Here you may configure the symbolic links that will be created when the
| `storage:link` Artisan command is executed. The array keys should be
| the locations of the links and the values should be their targets.
|
*/
'links' => [
public_path('storage') => storage_path('app/public'),
],
];
+132
View File
@@ -0,0 +1,132 @@
<?php
use Monolog\Handler\NullHandler;
use Monolog\Handler\StreamHandler;
use Monolog\Handler\SyslogUdpHandler;
use Monolog\Processor\PsrLogMessageProcessor;
return [
/*
|--------------------------------------------------------------------------
| Default Log Channel
|--------------------------------------------------------------------------
|
| This option defines the default log channel that is utilized to write
| messages to your logs. The value provided here should match one of
| the channels present in the list of "channels" configured below.
|
*/
'default' => env('LOG_CHANNEL', 'stack'),
/*
|--------------------------------------------------------------------------
| Deprecations Log Channel
|--------------------------------------------------------------------------
|
| This option controls the log channel that should be used to log warnings
| regarding deprecated PHP and library features. This allows you to get
| your application ready for upcoming major versions of dependencies.
|
*/
'deprecations' => [
'channel' => env('LOG_DEPRECATIONS_CHANNEL', 'null'),
'trace' => env('LOG_DEPRECATIONS_TRACE', false),
],
/*
|--------------------------------------------------------------------------
| Log Channels
|--------------------------------------------------------------------------
|
| Here you may configure the log channels for your application. Laravel
| utilizes the Monolog PHP logging library, which includes a variety
| of powerful log handlers and formatters that you're free to use.
|
| Available drivers: "single", "daily", "slack", "syslog",
| "errorlog", "monolog", "custom", "stack"
|
*/
'channels' => [
'stack' => [
'driver' => 'stack',
'channels' => explode(',', (string) env('LOG_STACK', 'single')),
'ignore_exceptions' => false,
],
'single' => [
'driver' => 'single',
'path' => storage_path('logs/laravel.log'),
'level' => env('LOG_LEVEL', 'debug'),
'replace_placeholders' => true,
],
'daily' => [
'driver' => 'daily',
'path' => storage_path('logs/laravel.log'),
'level' => env('LOG_LEVEL', 'debug'),
'days' => env('LOG_DAILY_DAYS', 14),
'replace_placeholders' => true,
],
'slack' => [
'driver' => 'slack',
'url' => env('LOG_SLACK_WEBHOOK_URL'),
'username' => env('LOG_SLACK_USERNAME', 'Laravel Log'),
'emoji' => env('LOG_SLACK_EMOJI', ':boom:'),
'level' => env('LOG_LEVEL', 'critical'),
'replace_placeholders' => true,
],
'papertrail' => [
'driver' => 'monolog',
'level' => env('LOG_LEVEL', 'debug'),
'handler' => env('LOG_PAPERTRAIL_HANDLER', SyslogUdpHandler::class),
'handler_with' => [
'host' => env('PAPERTRAIL_URL'),
'port' => env('PAPERTRAIL_PORT'),
'connectionString' => 'tls://'.env('PAPERTRAIL_URL').':'.env('PAPERTRAIL_PORT'),
],
'processors' => [PsrLogMessageProcessor::class],
],
'stderr' => [
'driver' => 'monolog',
'level' => env('LOG_LEVEL', 'debug'),
'handler' => StreamHandler::class,
'handler_with' => [
'stream' => 'php://stderr',
],
'formatter' => env('LOG_STDERR_FORMATTER'),
'processors' => [PsrLogMessageProcessor::class],
],
'syslog' => [
'driver' => 'syslog',
'level' => env('LOG_LEVEL', 'debug'),
'facility' => env('LOG_SYSLOG_FACILITY', LOG_USER),
'replace_placeholders' => true,
],
'errorlog' => [
'driver' => 'errorlog',
'level' => env('LOG_LEVEL', 'debug'),
'replace_placeholders' => true,
],
'null' => [
'driver' => 'monolog',
'handler' => NullHandler::class,
],
'emergency' => [
'path' => storage_path('logs/laravel.log'),
],
],
];
+118
View File
@@ -0,0 +1,118 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Mailer
|--------------------------------------------------------------------------
|
| This option controls the default mailer that is used to send all email
| messages unless another mailer is explicitly specified when sending
| the message. All additional mailers can be configured within the
| "mailers" array. Examples of each type of mailer are provided.
|
*/
'default' => env('MAIL_MAILER', 'log'),
/*
|--------------------------------------------------------------------------
| Mailer Configurations
|--------------------------------------------------------------------------
|
| Here you may configure all of the mailers used by your application plus
| their respective settings. Several examples have been configured for
| you and you are free to add your own as your application requires.
|
| Laravel supports a variety of mail "transport" drivers that can be used
| when delivering an email. You may specify which one you're using for
| your mailers below. You may also add additional mailers if needed.
|
| Supported: "smtp", "sendmail", "mailgun", "ses", "ses-v2",
| "postmark", "resend", "log", "array",
| "failover", "roundrobin"
|
*/
'mailers' => [
'smtp' => [
'transport' => 'smtp',
'scheme' => env('MAIL_SCHEME'),
'url' => env('MAIL_URL'),
'host' => env('MAIL_HOST', '127.0.0.1'),
'port' => env('MAIL_PORT', 2525),
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
'timeout' => null,
'local_domain' => env('MAIL_EHLO_DOMAIN', parse_url((string) env('APP_URL', 'http://localhost'), PHP_URL_HOST)),
],
'ses' => [
'transport' => 'ses',
],
'postmark' => [
'transport' => 'postmark',
// 'message_stream_id' => env('POSTMARK_MESSAGE_STREAM_ID'),
// 'client' => [
// 'timeout' => 5,
// ],
],
'resend' => [
'transport' => 'resend',
],
'sendmail' => [
'transport' => 'sendmail',
'path' => env('MAIL_SENDMAIL_PATH', '/usr/sbin/sendmail -bs -i'),
],
'log' => [
'transport' => 'log',
'channel' => env('MAIL_LOG_CHANNEL'),
],
'array' => [
'transport' => 'array',
],
'failover' => [
'transport' => 'failover',
'mailers' => [
'smtp',
'log',
],
'retry_after' => 60,
],
'roundrobin' => [
'transport' => 'roundrobin',
'mailers' => [
'ses',
'postmark',
],
'retry_after' => 60,
],
],
/*
|--------------------------------------------------------------------------
| Global "From" Address
|--------------------------------------------------------------------------
|
| You may wish for all emails sent by your application to be sent from
| the same address. Here you may specify a name and address that is
| used globally for all emails that are sent by your application.
|
*/
'from' => [
'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
'name' => env('MAIL_FROM_NAME', 'Example'),
],
];
+129
View File
@@ -0,0 +1,129 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Queue Connection Name
|--------------------------------------------------------------------------
|
| Laravel's queue supports a variety of backends via a single, unified
| API, giving you convenient access to each backend using identical
| syntax for each. The default queue connection is defined below.
|
*/
'default' => env('QUEUE_CONNECTION', 'database'),
/*
|--------------------------------------------------------------------------
| Queue Connections
|--------------------------------------------------------------------------
|
| Here you may configure the connection options for every queue backend
| used by your application. An example configuration is provided for
| each backend supported by Laravel. You're also free to add more.
|
| Drivers: "sync", "database", "beanstalkd", "sqs", "redis",
| "deferred", "background", "failover", "null"
|
*/
'connections' => [
'sync' => [
'driver' => 'sync',
],
'database' => [
'driver' => 'database',
'connection' => env('DB_QUEUE_CONNECTION'),
'table' => env('DB_QUEUE_TABLE', 'jobs'),
'queue' => env('DB_QUEUE', 'default'),
'retry_after' => (int) env('DB_QUEUE_RETRY_AFTER', 90),
'after_commit' => false,
],
'beanstalkd' => [
'driver' => 'beanstalkd',
'host' => env('BEANSTALKD_QUEUE_HOST', 'localhost'),
'queue' => env('BEANSTALKD_QUEUE', 'default'),
'retry_after' => (int) env('BEANSTALKD_QUEUE_RETRY_AFTER', 90),
'block_for' => 0,
'after_commit' => false,
],
'sqs' => [
'driver' => 'sqs',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'),
'queue' => env('SQS_QUEUE', 'default'),
'suffix' => env('SQS_SUFFIX'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
'after_commit' => false,
],
'redis' => [
'driver' => 'redis',
'connection' => env('REDIS_QUEUE_CONNECTION', 'default'),
'queue' => env('REDIS_QUEUE', 'default'),
'retry_after' => (int) env('REDIS_QUEUE_RETRY_AFTER', 90),
'block_for' => null,
'after_commit' => false,
],
'deferred' => [
'driver' => 'deferred',
],
'background' => [
'driver' => 'background',
],
'failover' => [
'driver' => 'failover',
'connections' => [
'database',
'deferred',
],
],
],
/*
|--------------------------------------------------------------------------
| Job Batching
|--------------------------------------------------------------------------
|
| The following options configure the database and table that store job
| batching information. These options can be updated to any database
| connection and table which has been defined by your application.
|
*/
'batching' => [
'database' => env('DB_CONNECTION', 'pgsql'),
'table' => 'job_batches',
],
/*
|--------------------------------------------------------------------------
| Failed Queue Jobs
|--------------------------------------------------------------------------
|
| These options configure the behavior of failed queue job logging so you
| can control how and where failed jobs are stored. Laravel ships with
| support for storing failed jobs in a simple file or in a database.
|
| Supported drivers: "database-uuids", "dynamodb", "file", "null"
|
*/
'failed' => [
'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'),
'database' => env('DB_CONNECTION', 'pgsql'),
'table' => 'failed_jobs',
],
];
+84
View File
@@ -0,0 +1,84 @@
<?php
use Laravel\Sanctum\Sanctum;
return [
/*
|--------------------------------------------------------------------------
| Stateful Domains
|--------------------------------------------------------------------------
|
| Requests from the following domains / hosts will receive stateful API
| authentication cookies. Typically, these should include your local
| and production domains which access your API via a frontend SPA.
|
*/
'stateful' => explode(',', env('SANCTUM_STATEFUL_DOMAINS', sprintf(
'%s%s',
'localhost,localhost:3000,127.0.0.1,127.0.0.1:8000,::1',
Sanctum::currentApplicationUrlWithPort(),
// Sanctum::currentRequestHost(),
))),
/*
|--------------------------------------------------------------------------
| Sanctum Guards
|--------------------------------------------------------------------------
|
| This array contains the authentication guards that will be checked when
| Sanctum is trying to authenticate a request. If none of these guards
| are able to authenticate the request, Sanctum will use the bearer
| token that's present on an incoming request for authentication.
|
*/
'guard' => ['web'],
/*
|--------------------------------------------------------------------------
| Expiration Minutes
|--------------------------------------------------------------------------
|
| This value controls the number of minutes until an issued token will be
| considered expired. This will override any values set in the token's
| "expires_at" attribute, but first-party sessions are not affected.
|
*/
'expiration' => null,
/*
|--------------------------------------------------------------------------
| Token Prefix
|--------------------------------------------------------------------------
|
| Sanctum can prefix new tokens in order to take advantage of numerous
| security scanning initiatives maintained by open source platforms
| that notify developers if they commit tokens into repositories.
|
| See: https://docs.github.com/en/code-security/secret-scanning/about-secret-scanning
|
*/
'token_prefix' => env('SANCTUM_TOKEN_PREFIX', ''),
/*
|--------------------------------------------------------------------------
| Sanctum Middleware
|--------------------------------------------------------------------------
|
| When authenticating your first-party SPA with Sanctum you may need to
| customize some of the middleware Sanctum uses while processing the
| request. You may change the middleware listed below as required.
|
*/
'middleware' => [
'authenticate_session' => Laravel\Sanctum\Http\Middleware\AuthenticateSession::class,
'encrypt_cookies' => Illuminate\Cookie\Middleware\EncryptCookies::class,
'validate_csrf_token' => Illuminate\Foundation\Http\Middleware\ValidateCsrfToken::class,
],
];
+38
View File
@@ -0,0 +1,38 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Third Party Services
|--------------------------------------------------------------------------
|
| This file is for storing the credentials for third party services such
| as Mailgun, Postmark, AWS and more. This file provides the de facto
| location for this type of information, allowing packages to have
| a conventional file to locate the various service credentials.
|
*/
'postmark' => [
'key' => env('POSTMARK_API_KEY'),
],
'resend' => [
'key' => env('RESEND_API_KEY'),
],
'ses' => [
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
],
'slack' => [
'notifications' => [
'bot_user_oauth_token' => env('SLACK_BOT_USER_OAUTH_TOKEN'),
'channel' => env('SLACK_BOT_USER_DEFAULT_CHANNEL'),
],
],
];
+217
View File
@@ -0,0 +1,217 @@
<?php
use Illuminate\Support\Str;
return [
/*
|--------------------------------------------------------------------------
| Default Session Driver
|--------------------------------------------------------------------------
|
| This option determines the default session driver that is utilized for
| incoming requests. Laravel supports a variety of storage options to
| persist session data. Database storage is a great default choice.
|
| Supported: "file", "cookie", "database", "memcached",
| "redis", "dynamodb", "array"
|
*/
'driver' => env('SESSION_DRIVER', 'database'),
/*
|--------------------------------------------------------------------------
| Session Lifetime
|--------------------------------------------------------------------------
|
| Here you may specify the number of minutes that you wish the session
| to be allowed to remain idle before it expires. If you want them
| to expire immediately when the browser is closed then you may
| indicate that via the expire_on_close configuration option.
|
*/
'lifetime' => (int) env('SESSION_LIFETIME', 120),
'expire_on_close' => env('SESSION_EXPIRE_ON_CLOSE', false),
/*
|--------------------------------------------------------------------------
| Session Encryption
|--------------------------------------------------------------------------
|
| This option allows you to easily specify that all of your session data
| should be encrypted before it's stored. All encryption is performed
| automatically by Laravel and you may use the session like normal.
|
*/
'encrypt' => env('SESSION_ENCRYPT', false),
/*
|--------------------------------------------------------------------------
| Session File Location
|--------------------------------------------------------------------------
|
| When utilizing the "file" session driver, the session files are placed
| on disk. The default storage location is defined here; however, you
| are free to provide another location where they should be stored.
|
*/
'files' => storage_path('framework/sessions'),
/*
|--------------------------------------------------------------------------
| Session Database Connection
|--------------------------------------------------------------------------
|
| When using the "database" or "redis" session drivers, you may specify a
| connection that should be used to manage these sessions. This should
| correspond to a connection in your database configuration options.
|
*/
'connection' => env('SESSION_CONNECTION'),
/*
|--------------------------------------------------------------------------
| Session Database Table
|--------------------------------------------------------------------------
|
| When using the "database" session driver, you may specify the table to
| be used to store sessions. Of course, a sensible default is defined
| for you; however, you're welcome to change this to another table.
|
*/
'table' => env('SESSION_TABLE', 'sessions'),
/*
|--------------------------------------------------------------------------
| Session Cache Store
|--------------------------------------------------------------------------
|
| When using one of the framework's cache driven session backends, you may
| define the cache store which should be used to store the session data
| between requests. This must match one of your defined cache stores.
|
| Affects: "dynamodb", "memcached", "redis"
|
*/
'store' => env('SESSION_STORE'),
/*
|--------------------------------------------------------------------------
| Session Sweeping Lottery
|--------------------------------------------------------------------------
|
| Some session drivers must manually sweep their storage location to get
| rid of old sessions from storage. Here are the chances that it will
| happen on a given request. By default, the odds are 2 out of 100.
|
*/
'lottery' => [2, 100],
/*
|--------------------------------------------------------------------------
| Session Cookie Name
|--------------------------------------------------------------------------
|
| Here you may change the name of the session cookie that is created by
| the framework. Typically, you should not need to change this value
| since doing so does not grant a meaningful security improvement.
|
*/
'cookie' => env(
'SESSION_COOKIE',
Str::slug((string) env('APP_NAME', 'laravel')).'-session'
),
/*
|--------------------------------------------------------------------------
| Session Cookie Path
|--------------------------------------------------------------------------
|
| The session cookie path determines the path for which the cookie will
| be regarded as available. Typically, this will be the root path of
| your application, but you're free to change this when necessary.
|
*/
'path' => env('SESSION_PATH', '/'),
/*
|--------------------------------------------------------------------------
| Session Cookie Domain
|--------------------------------------------------------------------------
|
| This value determines the domain and subdomains the session cookie is
| available to. By default, the cookie will be available to the root
| domain without subdomains. Typically, this shouldn't be changed.
|
*/
'domain' => env('SESSION_DOMAIN'),
/*
|--------------------------------------------------------------------------
| HTTPS Only Cookies
|--------------------------------------------------------------------------
|
| By setting this option to true, session cookies will only be sent back
| to the server if the browser has a HTTPS connection. This will keep
| the cookie from being sent to you when it can't be done securely.
|
*/
'secure' => env('SESSION_SECURE_COOKIE'),
/*
|--------------------------------------------------------------------------
| HTTP Access Only
|--------------------------------------------------------------------------
|
| Setting this value to true will prevent JavaScript from accessing the
| value of the cookie and the cookie will only be accessible through
| the HTTP protocol. It's unlikely you should disable this option.
|
*/
'http_only' => env('SESSION_HTTP_ONLY', true),
/*
|--------------------------------------------------------------------------
| Same-Site Cookies
|--------------------------------------------------------------------------
|
| This option determines how your cookies behave when cross-site requests
| take place, and can be used to mitigate CSRF attacks. By default, we
| will set this value to "lax" to permit secure cross-site requests.
|
| See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#samesitesamesite-value
|
| Supported: "lax", "strict", "none", null
|
*/
'same_site' => env('SESSION_SAME_SITE', 'lax'),
/*
|--------------------------------------------------------------------------
| Partitioned Cookies
|--------------------------------------------------------------------------
|
| Setting this value to true will tie the cookie to the top-level site for
| a cross-site context. Partitioned cookies are accepted by the browser
| when flagged "secure" and the Same-Site attribute is set to "none".
|
*/
'partitioned' => env('SESSION_PARTITIONED_COOKIE', false),
];
+1
View File
@@ -0,0 +1 @@
*.sqlite*
@@ -0,0 +1,46 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Str;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\User>
*/
class UserFactory extends Factory
{
/**
* The current password being used by the factory.
*/
protected static ?string $password;
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'first_name' => fake()->firstName(),
'last_name' => fake()->lastName(),
'phone' => fake()->unique()->numerify('09########'),
'email' => fake()->unique()->safeEmail(),
'email_verified_at' => now(),
'password' => static::$password ??= Hash::make('password'),
'remember_token' => Str::random(10),
];
}
/**
* Indicate that the model's email address should be unverified.
*/
public function unverified(): static
{
return $this->state(fn (array $attributes) => [
'email_verified_at' => null,
]);
}
}
@@ -0,0 +1,49 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('users', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->rememberToken();
$table->timestamps();
});
Schema::create('password_reset_tokens', function (Blueprint $table) {
$table->string('email')->primary();
$table->string('token');
$table->timestamp('created_at')->nullable();
});
Schema::create('sessions', function (Blueprint $table) {
$table->string('id')->primary();
$table->foreignId('user_id')->nullable()->index();
$table->string('ip_address', 45)->nullable();
$table->text('user_agent')->nullable();
$table->longText('payload');
$table->integer('last_activity')->index();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('users');
Schema::dropIfExists('password_reset_tokens');
Schema::dropIfExists('sessions');
}
};
@@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('cache', function (Blueprint $table) {
$table->string('key')->primary();
$table->mediumText('value');
$table->integer('expiration')->index();
});
Schema::create('cache_locks', function (Blueprint $table) {
$table->string('key')->primary();
$table->string('owner');
$table->integer('expiration')->index();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('cache');
Schema::dropIfExists('cache_locks');
}
};
@@ -0,0 +1,57 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('jobs', function (Blueprint $table) {
$table->id();
$table->string('queue')->index();
$table->longText('payload');
$table->unsignedTinyInteger('attempts');
$table->unsignedInteger('reserved_at')->nullable();
$table->unsignedInteger('available_at');
$table->unsignedInteger('created_at');
});
Schema::create('job_batches', function (Blueprint $table) {
$table->string('id')->primary();
$table->string('name');
$table->integer('total_jobs');
$table->integer('pending_jobs');
$table->integer('failed_jobs');
$table->longText('failed_job_ids');
$table->mediumText('options')->nullable();
$table->integer('cancelled_at')->nullable();
$table->integer('created_at');
$table->integer('finished_at')->nullable();
});
Schema::create('failed_jobs', function (Blueprint $table) {
$table->id();
$table->string('uuid')->unique();
$table->text('connection');
$table->text('queue');
$table->longText('payload');
$table->longText('exception');
$table->timestamp('failed_at')->useCurrent();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('jobs');
Schema::dropIfExists('job_batches');
Schema::dropIfExists('failed_jobs');
}
};
@@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('personal_access_tokens', function (Blueprint $table) {
$table->id();
$table->morphs('tokenable');
$table->text('name');
$table->string('token', 64)->unique();
$table->text('abilities')->nullable();
$table->timestamp('last_used_at')->nullable();
$table->timestamp('expires_at')->nullable()->index();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('personal_access_tokens');
}
};
@@ -0,0 +1,29 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::table('users', function (Blueprint $table) {
// نحذف name الافتراضي
$table->dropColumn('name');
// نضيف الحقول تبع مشروعنا
$table->string('first_name');
$table->string('last_name');
$table->string('phone')->unique();
});
}
public function down(): void
{
Schema::table('users', function (Blueprint $table) {
$table->string('name');
$table->dropColumn(['first_name', 'last_name', 'phone']);
});
}
};
@@ -0,0 +1,22 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('roles', function (Blueprint $table) {
$table->id();
$table->string('name')->unique();
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('roles');
}
};
@@ -0,0 +1,25 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('user_roles', function (Blueprint $table) {
$table->id();
$table->foreignId('user_id')->constrained()->cascadeOnDelete();
$table->foreignId('role_id')->constrained()->cascadeOnDelete();
$table->timestamps();
$table->unique(['user_id', 'role_id']);
});
}
public function down(): void
{
Schema::dropIfExists('user_roles');
}
};
@@ -0,0 +1,26 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('venues', function (Blueprint $table) {
$table->id();
$table->foreignId('vendor_id')->constrained('users')->cascadeOnDelete();
$table->string('name');
$table->text('description')->nullable();
$table->string('address')->nullable();
$table->string('phone')->nullable();
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('venues');
}
};
@@ -0,0 +1,22 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::table('venues', function (Blueprint $table) {
$table->string('type')->default('restaurant');
});
}
public function down(): void
{
Schema::table('venues', function (Blueprint $table) {
$table->dropColumn('type');
});
}
};
@@ -0,0 +1,24 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::table('venues', function (Blueprint $table) {
$table->string('address_text')->nullable();
$table->decimal('lat', 10, 7)->nullable();
$table->decimal('lng', 10, 7)->nullable();
});
}
public function down(): void
{
Schema::table('venues', function (Blueprint $table) {
$table->dropColumn(['address_text', 'lat', 'lng']);
});
}
};
@@ -0,0 +1,22 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::table('venues', function (Blueprint $table) {
$table->boolean('is_active')->default(true);
});
}
public function down(): void
{
Schema::table('venues', function (Blueprint $table) {
$table->dropColumn('is_active');
});
}
};
@@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('reservations', function (Blueprint $table) {
$table->id();
$table->foreignId('customer_id')->constrained('users')->cascadeOnDelete();
$table->foreignId('venue_id')->constrained('venues')->cascadeOnDelete();
$table->date('reservation_date');
$table->time('reservation_time');
$table->unsignedSmallInteger('party_size');
$table->string('status')->default('pending');
$table->string('rejection_reason')->nullable();
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('reservations');
}
};
@@ -0,0 +1,22 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::table('reservations', function (Blueprint $table) {
$table->string('code', 8)->unique();
});
}
public function down(): void
{
Schema::table('reservations', function (Blueprint $table) {
$table->dropColumn('code');
});
}
};
@@ -0,0 +1,25 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('reservation_status_histories', function (Blueprint $table) {
$table->id();
$table->foreignId('reservation_id')->constrained('reservations')->cascadeOnDelete();
$table->string('old_status')->nullable();
$table->string('new_status');
$table->foreignId('changed_by_user_id')->nullable()->constrained('users')->nullOnDelete();
$table->timestamp('created_at')->useCurrent();
});
}
public function down(): void
{
Schema::dropIfExists('reservation_status_histories');
}
};
@@ -0,0 +1,24 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::table('users', function (Blueprint $table) {
$table->unsignedSmallInteger('strike_count')->default(0);
$table->timestamp('blocked_until')->nullable();
$table->boolean('blocked_permanent')->default(false);
});
}
public function down(): void
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn(['strike_count', 'blocked_until', 'blocked_permanent']);
});
}
};
@@ -0,0 +1,27 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('notifications', function (Blueprint $table) {
$table->id();
$table->foreignId('user_id')->constrained('users')->cascadeOnDelete();
$table->enum('type', ['reservation_approved', 'reservation_rejected', 'reservation_reminder', 'general']);
$table->string('title');
$table->text('body');
$table->json('data_json')->nullable();
$table->boolean('is_read')->default(false);
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('notifications');
}
};
@@ -0,0 +1,26 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('reservation_reminders', function (Blueprint $table) {
$table->id();
$table->foreignId('reservation_id')->constrained('reservations')->cascadeOnDelete();
$table->timestamp('send_at');
$table->timestamp('sent_at')->nullable();
$table->timestamps();
$table->unique('reservation_id');
});
}
public function down(): void
{
Schema::dropIfExists('reservation_reminders');
}
};
@@ -0,0 +1,26 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('pricing_rules', function (Blueprint $table) {
$table->id();
$table->enum('scope', ['global', 'type', 'venue']);
$table->string('venue_type')->nullable();
$table->foreignId('venue_id')->nullable()->constrained('venues')->nullOnDelete();
$table->decimal('price_per_person', 10, 2);
$table->boolean('is_active')->default(true);
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('pricing_rules');
}
};
@@ -0,0 +1,27 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('reservation_fees', function (Blueprint $table) {
$table->id();
$table->foreignId('reservation_id')->constrained('reservations')->cascadeOnDelete();
$table->foreignId('pricing_rule_id')->nullable()->constrained('pricing_rules')->nullOnDelete();
$table->decimal('price_per_person', 10, 2);
$table->unsignedSmallInteger('party_size');
$table->decimal('total_amount', 10, 2);
$table->string('currency', 3)->default('USD');
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('reservation_fees');
}
};
@@ -0,0 +1,24 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('seating_areas', function (Blueprint $table) {
$table->id();
$table->foreignId('venue_id')->constrained('venues')->cascadeOnDelete();
$table->string('name');
$table->string('description')->nullable();
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('seating_areas');
}
};
@@ -0,0 +1,26 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('venue_tables', function (Blueprint $table) {
$table->id();
$table->foreignId('venue_id')->constrained('venues')->cascadeOnDelete();
$table->foreignId('seating_area_id')->nullable()->constrained('seating_areas')->nullOnDelete();
$table->string('name');
$table->unsignedSmallInteger('capacity');
$table->boolean('is_active')->default(true);
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('venue_tables');
}
};
@@ -0,0 +1,24 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('reservation_table_assignments', function (Blueprint $table) {
$table->id();
$table->foreignId('reservation_id')->constrained('reservations')->cascadeOnDelete();
$table->foreignId('venue_table_id')->constrained('venue_tables')->cascadeOnDelete();
$table->timestamp('assigned_at')->useCurrent();
$table->unique('reservation_id');
});
}
public function down(): void
{
Schema::dropIfExists('reservation_table_assignments');
}
};
@@ -0,0 +1,22 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::table('venues', function (Blueprint $table) {
$table->json('amenities')->nullable();
});
}
public function down(): void
{
Schema::table('venues', function (Blueprint $table) {
$table->dropColumn('amenities');
});
}
};
@@ -0,0 +1,23 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::table('venues', function (Blueprint $table) {
$table->json('image_urls')->nullable();
$table->json('offers')->nullable();
});
}
public function down(): void
{
Schema::table('venues', function (Blueprint $table) {
$table->dropColumn(['image_urls', 'offers']);
});
}
};
@@ -0,0 +1,23 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('user_feedback', function (Blueprint $table) {
$table->id();
$table->foreignId('user_id')->constrained('users')->cascadeOnDelete();
$table->text('message');
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('user_feedback');
}
};
@@ -0,0 +1,30 @@
<?php
namespace Database\Seeders;
use App\Models\User;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use Database\Seeders\RoleSeeder;
class DatabaseSeeder extends Seeder
{
use WithoutModelEvents;
/**
* Seed the application's database.
*/
public function run(): void
{
$this->call(RoleSeeder::class);
// User::factory(10)->create();
User::factory()->create([
'first_name' => 'Test',
'last_name' => 'User',
'phone' => '0999999999',
'email' => 'test@example.com',
]);
}
}
@@ -0,0 +1,18 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use App\Models\Role;
class RoleSeeder extends Seeder
{
public function run(): void
{
$roles = ['customer', 'vendor', 'admin'];
foreach ($roles as $role) {
Role::firstOrCreate(['name' => $role]);
}
}
}
+53
View File
@@ -0,0 +1,53 @@
services:
app:
build:
context: .
dockerfile: Dockerfile
container_name: tabeley_app
restart: unless-stopped
env_file:
- .env
environment:
APP_ENV: production
APP_DEBUG: "false"
APP_URL: ${APP_URL:-http://127.0.0.1:8000}
DB_CONNECTION: pgsql
DB_HOST: db
DB_PORT: 5432
DB_DATABASE: ${DB_DATABASE:-tabeley_db}
DB_USERNAME: ${DB_USERNAME:-postgres}
DB_PASSWORD: ${DB_PASSWORD:-secret}
RUN_MIGRATIONS: "true"
depends_on:
- db
volumes:
- storage_data:/var/www/html/storage
nginx:
image: nginx:1.27-alpine
container_name: tabeley_nginx
restart: unless-stopped
depends_on:
- app
ports:
- "8000:80"
volumes:
- ./public:/var/www/html/public:ro
- ./docker/nginx/default.conf:/etc/nginx/conf.d/default.conf:ro
db:
image: postgres:17-alpine
container_name: tabeley_db
restart: unless-stopped
environment:
POSTGRES_DB: ${DB_DATABASE:-tabeley_db}
POSTGRES_USER: ${DB_USERNAME:-postgres}
POSTGRES_PASSWORD: ${DB_PASSWORD:-secret}
ports:
- "5433:5432"
volumes:
- db_data:/var/lib/postgresql/data
volumes:
db_data:
storage_data:
+60
View File
@@ -0,0 +1,60 @@
#!/usr/bin/env sh
set -e
cd /var/www
echo "🚀 Starting Tabeley Production Container..."
# Create .env if not exists
if [ ! -f .env ]; then
cp .env.example .env
fi
# Function to safely update env values
set_env() {
key="$1"
value="$2"
if [ -n "$value" ]; then
if grep -q "^${key}=" .env; then
sed -i "s|^${key}=.*|${key}=${value}|" .env
else
echo "${key}=${value}" >> .env
fi
fi
}
# Inject runtime environment variables
set_env DB_CONNECTION "${DB_CONNECTION}"
set_env DB_HOST "${DB_HOST}"
set_env DB_PORT "${DB_PORT}"
set_env DB_DATABASE "${DB_DATABASE}"
set_env DB_USERNAME "${DB_USERNAME}"
set_env DB_PASSWORD "${DB_PASSWORD}"
set_env DATABASE_URL "${DATABASE_URL}"
set_env APP_ENV "${APP_ENV}"
set_env APP_DEBUG "${APP_DEBUG}"
set_env APP_URL "${APP_URL}"
# Laravel setup
php artisan config:clear || true
if [ -z "$APP_KEY" ]; then
php artisan key:generate --force --no-interaction || true
fi
php artisan storage:link || true
# Run migrations only if enabled
if [ "${RUN_MIGRATIONS}" = "true" ]; then
echo "📦 Running migrations..."
php artisan migrate --force --no-interaction || true
fi
# Cache for production performance
php artisan config:cache || true
php artisan route:cache || true
php artisan view:cache || true
echo "✅ Container ready."
exec "$@"
+26
View File
@@ -0,0 +1,26 @@
server {
listen 80;
server_name _;
root /var/www/html/public;
index index.php index.html;
client_max_body_size 20M;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass app:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/html/public$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT /var/www/html/public;
fastcgi_read_timeout 300;
}
location ~* \.(jpg|jpeg|png|gif|css|js|ico|svg|webp)$ {
expires 30d;
access_log off;
}
}
+14
View File
@@ -0,0 +1,14 @@
const express = require("express");
const cors = require("cors");
const app = express();
app.use(cors());
app.get("/api/hello", (req, res) => {
res.json({ message: "مرحبا من السيرفر 🚀" });
});
// مهم: 0.0.0.0 مش localhost
app.listen(3000, "0.0.0.0", () => {
console.log("Backend running on port 3000");
});
+854
View File
@@ -0,0 +1,854 @@
{
"name": "backend",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "backend",
"version": "1.0.0",
"license": "ISC",
"dependencies": {
"cors": "^2.8.6",
"express": "^5.2.1"
}
},
"node_modules/accepts": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/accepts/-/accepts-2.0.0.tgz",
"integrity": "sha512-5cvg6CtKwfgdmVqY1WIiXKc3Q1bkRqGLi+2W/6ao+6Y7gu/RCwRuAhGEzh5B4KlszSuTLgZYuqFqo5bImjNKng==",
"license": "MIT",
"dependencies": {
"mime-types": "^3.0.0",
"negotiator": "^1.0.0"
},
"engines": {
"node": ">= 0.6"
}
},
"node_modules/body-parser": {
"version": "2.2.2",
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-2.2.2.tgz",
"integrity": "sha512-oP5VkATKlNwcgvxi0vM0p/D3n2C3EReYVX+DNYs5TjZFn/oQt2j+4sVJtSMr18pdRr8wjTcBl6LoV+FUwzPmNA==",
"license": "MIT",
"dependencies": {
"bytes": "^3.1.2",
"content-type": "^1.0.5",
"debug": "^4.4.3",
"http-errors": "^2.0.0",
"iconv-lite": "^0.7.0",
"on-finished": "^2.4.1",
"qs": "^6.14.1",
"raw-body": "^3.0.1",
"type-is": "^2.0.1"
},
"engines": {
"node": ">=18"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/express"
}
},
"node_modules/bytes": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz",
"integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==",
"license": "MIT",
"engines": {
"node": ">= 0.8"
}
},
"node_modules/call-bind-apply-helpers": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz",
"integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==",
"license": "MIT",
"dependencies": {
"es-errors": "^1.3.0",
"function-bind": "^1.1.2"
},
"engines": {
"node": ">= 0.4"
}
},
"node_modules/call-bound": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz",
"integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==",
"license": "MIT",
"dependencies": {
"call-bind-apply-helpers": "^1.0.2",
"get-intrinsic": "^1.3.0"
},
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/content-disposition": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-1.0.1.tgz",
"integrity": "sha512-oIXISMynqSqm241k6kcQ5UwttDILMK4BiurCfGEREw6+X9jkkpEe5T9FZaApyLGGOnFuyMWZpdolTXMtvEJ08Q==",
"license": "MIT",
"engines": {
"node": ">=18"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/express"
}
},
"node_modules/content-type": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz",
"integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==",
"license": "MIT",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/cookie": {
"version": "0.7.2",
"resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz",
"integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==",
"license": "MIT",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/cookie-signature": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.2.2.tgz",
"integrity": "sha512-D76uU73ulSXrD1UXF4KE2TMxVVwhsnCgfAyTg9k8P6KGZjlXKrOLe4dJQKI3Bxi5wjesZoFXJWElNWBjPZMbhg==",
"license": "MIT",
"engines": {
"node": ">=6.6.0"
}
},
"node_modules/cors": {
"version": "2.8.6",
"resolved": "https://registry.npmjs.org/cors/-/cors-2.8.6.tgz",
"integrity": "sha512-tJtZBBHA6vjIAaF6EnIaq6laBBP9aq/Y3ouVJjEfoHbRBcHBAHYcMh/w8LDrk2PvIMMq8gmopa5D4V8RmbrxGw==",
"license": "MIT",
"dependencies": {
"object-assign": "^4",
"vary": "^1"
},
"engines": {
"node": ">= 0.10"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/express"
}
},
"node_modules/debug": {
"version": "4.4.3",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz",
"integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==",
"license": "MIT",
"dependencies": {
"ms": "^2.1.3"
},
"engines": {
"node": ">=6.0"
},
"peerDependenciesMeta": {
"supports-color": {
"optional": true
}
}
},
"node_modules/depd": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",
"integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==",
"license": "MIT",
"engines": {
"node": ">= 0.8"
}
},
"node_modules/dunder-proto": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz",
"integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==",
"license": "MIT",
"dependencies": {
"call-bind-apply-helpers": "^1.0.1",
"es-errors": "^1.3.0",
"gopd": "^1.2.0"
},
"engines": {
"node": ">= 0.4"
}
},
"node_modules/ee-first": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
"integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==",
"license": "MIT"
},
"node_modules/encodeurl": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz",
"integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==",
"license": "MIT",
"engines": {
"node": ">= 0.8"
}
},
"node_modules/es-define-property": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz",
"integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==",
"license": "MIT",
"engines": {
"node": ">= 0.4"
}
},
"node_modules/es-errors": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz",
"integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==",
"license": "MIT",
"engines": {
"node": ">= 0.4"
}
},
"node_modules/es-object-atoms": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz",
"integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==",
"license": "MIT",
"dependencies": {
"es-errors": "^1.3.0"
},
"engines": {
"node": ">= 0.4"
}
},
"node_modules/escape-html": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
"integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==",
"license": "MIT"
},
"node_modules/etag": {
"version": "1.8.1",
"resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",
"integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==",
"license": "MIT",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/express": {
"version": "5.2.1",
"resolved": "https://registry.npmjs.org/express/-/express-5.2.1.tgz",
"integrity": "sha512-hIS4idWWai69NezIdRt2xFVofaF4j+6INOpJlVOLDO8zXGpUVEVzIYk12UUi2JzjEzWL3IOAxcTubgz9Po0yXw==",
"license": "MIT",
"dependencies": {
"accepts": "^2.0.0",
"body-parser": "^2.2.1",
"content-disposition": "^1.0.0",
"content-type": "^1.0.5",
"cookie": "^0.7.1",
"cookie-signature": "^1.2.1",
"debug": "^4.4.0",
"depd": "^2.0.0",
"encodeurl": "^2.0.0",
"escape-html": "^1.0.3",
"etag": "^1.8.1",
"finalhandler": "^2.1.0",
"fresh": "^2.0.0",
"http-errors": "^2.0.0",
"merge-descriptors": "^2.0.0",
"mime-types": "^3.0.0",
"on-finished": "^2.4.1",
"once": "^1.4.0",
"parseurl": "^1.3.3",
"proxy-addr": "^2.0.7",
"qs": "^6.14.0",
"range-parser": "^1.2.1",
"router": "^2.2.0",
"send": "^1.1.0",
"serve-static": "^2.2.0",
"statuses": "^2.0.1",
"type-is": "^2.0.1",
"vary": "^1.1.2"
},
"engines": {
"node": ">= 18"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/express"
}
},
"node_modules/finalhandler": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-2.1.1.tgz",
"integrity": "sha512-S8KoZgRZN+a5rNwqTxlZZePjT/4cnm0ROV70LedRHZ0p8u9fRID0hJUZQpkKLzro8LfmC8sx23bY6tVNxv8pQA==",
"license": "MIT",
"dependencies": {
"debug": "^4.4.0",
"encodeurl": "^2.0.0",
"escape-html": "^1.0.3",
"on-finished": "^2.4.1",
"parseurl": "^1.3.3",
"statuses": "^2.0.1"
},
"engines": {
"node": ">= 18.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/express"
}
},
"node_modules/forwarded": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz",
"integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==",
"license": "MIT",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/fresh": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/fresh/-/fresh-2.0.0.tgz",
"integrity": "sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A==",
"license": "MIT",
"engines": {
"node": ">= 0.8"
}
},
"node_modules/function-bind": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
"integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",
"license": "MIT",
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/get-intrinsic": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz",
"integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==",
"license": "MIT",
"dependencies": {
"call-bind-apply-helpers": "^1.0.2",
"es-define-property": "^1.0.1",
"es-errors": "^1.3.0",
"es-object-atoms": "^1.1.1",
"function-bind": "^1.1.2",
"get-proto": "^1.0.1",
"gopd": "^1.2.0",
"has-symbols": "^1.1.0",
"hasown": "^2.0.2",
"math-intrinsics": "^1.1.0"
},
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/get-proto": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz",
"integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==",
"license": "MIT",
"dependencies": {
"dunder-proto": "^1.0.1",
"es-object-atoms": "^1.0.0"
},
"engines": {
"node": ">= 0.4"
}
},
"node_modules/gopd": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz",
"integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==",
"license": "MIT",
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/has-symbols": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz",
"integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==",
"license": "MIT",
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/hasown": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz",
"integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==",
"license": "MIT",
"dependencies": {
"function-bind": "^1.1.2"
},
"engines": {
"node": ">= 0.4"
}
},
"node_modules/http-errors": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.1.tgz",
"integrity": "sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==",
"license": "MIT",
"dependencies": {
"depd": "~2.0.0",
"inherits": "~2.0.4",
"setprototypeof": "~1.2.0",
"statuses": "~2.0.2",
"toidentifier": "~1.0.1"
},
"engines": {
"node": ">= 0.8"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/express"
}
},
"node_modules/iconv-lite": {
"version": "0.7.2",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.7.2.tgz",
"integrity": "sha512-im9DjEDQ55s9fL4EYzOAv0yMqmMBSZp6G0VvFyTMPKWxiSBHUj9NW/qqLmXUwXrrM7AvqSlTCfvqRb0cM8yYqw==",
"license": "MIT",
"dependencies": {
"safer-buffer": ">= 2.1.2 < 3.0.0"
},
"engines": {
"node": ">=0.10.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/express"
}
},
"node_modules/inherits": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
"license": "ISC"
},
"node_modules/ipaddr.js": {
"version": "1.9.1",
"resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz",
"integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==",
"license": "MIT",
"engines": {
"node": ">= 0.10"
}
},
"node_modules/is-promise": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/is-promise/-/is-promise-4.0.0.tgz",
"integrity": "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==",
"license": "MIT"
},
"node_modules/math-intrinsics": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz",
"integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==",
"license": "MIT",
"engines": {
"node": ">= 0.4"
}
},
"node_modules/media-typer": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-1.1.0.tgz",
"integrity": "sha512-aisnrDP4GNe06UcKFnV5bfMNPBUw4jsLGaWwWfnH3v02GnBuXX2MCVn5RbrWo0j3pczUilYblq7fQ7Nw2t5XKw==",
"license": "MIT",
"engines": {
"node": ">= 0.8"
}
},
"node_modules/merge-descriptors": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-2.0.0.tgz",
"integrity": "sha512-Snk314V5ayFLhp3fkUREub6WtjBfPdCPY1Ln8/8munuLuiYhsABgBVWsozAG+MWMbVEvcdcpbi9R7ww22l9Q3g==",
"license": "MIT",
"engines": {
"node": ">=18"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/mime-db": {
"version": "1.54.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.54.0.tgz",
"integrity": "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==",
"license": "MIT",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/mime-types": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-3.0.2.tgz",
"integrity": "sha512-Lbgzdk0h4juoQ9fCKXW4by0UJqj+nOOrI9MJ1sSj4nI8aI2eo1qmvQEie4VD1glsS250n15LsWsYtCugiStS5A==",
"license": "MIT",
"dependencies": {
"mime-db": "^1.54.0"
},
"engines": {
"node": ">=18"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/express"
}
},
"node_modules/ms": {
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
"license": "MIT"
},
"node_modules/negotiator": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/negotiator/-/negotiator-1.0.0.tgz",
"integrity": "sha512-8Ofs/AUQh8MaEcrlq5xOX0CQ9ypTF5dl78mjlMNfOK08fzpgTHQRQPBxcPlEtIw0yRpws+Zo/3r+5WRby7u3Gg==",
"license": "MIT",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/object-assign": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
"integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==",
"license": "MIT",
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/object-inspect": {
"version": "1.13.4",
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz",
"integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==",
"license": "MIT",
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/on-finished": {
"version": "2.4.1",
"resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz",
"integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==",
"license": "MIT",
"dependencies": {
"ee-first": "1.1.1"
},
"engines": {
"node": ">= 0.8"
}
},
"node_modules/once": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
"integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==",
"license": "ISC",
"dependencies": {
"wrappy": "1"
}
},
"node_modules/parseurl": {
"version": "1.3.3",
"resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
"integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==",
"license": "MIT",
"engines": {
"node": ">= 0.8"
}
},
"node_modules/path-to-regexp": {
"version": "8.3.0",
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-8.3.0.tgz",
"integrity": "sha512-7jdwVIRtsP8MYpdXSwOS0YdD0Du+qOoF/AEPIt88PcCFrZCzx41oxku1jD88hZBwbNUIEfpqvuhjFaMAqMTWnA==",
"license": "MIT",
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/express"
}
},
"node_modules/proxy-addr": {
"version": "2.0.7",
"resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz",
"integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==",
"license": "MIT",
"dependencies": {
"forwarded": "0.2.0",
"ipaddr.js": "1.9.1"
},
"engines": {
"node": ">= 0.10"
}
},
"node_modules/qs": {
"version": "6.14.1",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.14.1.tgz",
"integrity": "sha512-4EK3+xJl8Ts67nLYNwqw/dsFVnCf+qR7RgXSK9jEEm9unao3njwMDdmsdvoKBKHzxd7tCYz5e5M+SnMjdtXGQQ==",
"license": "BSD-3-Clause",
"dependencies": {
"side-channel": "^1.1.0"
},
"engines": {
"node": ">=0.6"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/range-parser": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",
"integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==",
"license": "MIT",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/raw-body": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/raw-body/-/raw-body-3.0.2.tgz",
"integrity": "sha512-K5zQjDllxWkf7Z5xJdV0/B0WTNqx6vxG70zJE4N0kBs4LovmEYWJzQGxC9bS9RAKu3bgM40lrd5zoLJ12MQ5BA==",
"license": "MIT",
"dependencies": {
"bytes": "~3.1.2",
"http-errors": "~2.0.1",
"iconv-lite": "~0.7.0",
"unpipe": "~1.0.0"
},
"engines": {
"node": ">= 0.10"
}
},
"node_modules/router": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/router/-/router-2.2.0.tgz",
"integrity": "sha512-nLTrUKm2UyiL7rlhapu/Zl45FwNgkZGaCpZbIHajDYgwlJCOzLSk+cIPAnsEqV955GjILJnKbdQC1nVPz+gAYQ==",
"license": "MIT",
"dependencies": {
"debug": "^4.4.0",
"depd": "^2.0.0",
"is-promise": "^4.0.0",
"parseurl": "^1.3.3",
"path-to-regexp": "^8.0.0"
},
"engines": {
"node": ">= 18"
}
},
"node_modules/safer-buffer": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
"license": "MIT"
},
"node_modules/send": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/send/-/send-1.2.1.tgz",
"integrity": "sha512-1gnZf7DFcoIcajTjTwjwuDjzuz4PPcY2StKPlsGAQ1+YH20IRVrBaXSWmdjowTJ6u8Rc01PoYOGHXfP1mYcZNQ==",
"license": "MIT",
"dependencies": {
"debug": "^4.4.3",
"encodeurl": "^2.0.0",
"escape-html": "^1.0.3",
"etag": "^1.8.1",
"fresh": "^2.0.0",
"http-errors": "^2.0.1",
"mime-types": "^3.0.2",
"ms": "^2.1.3",
"on-finished": "^2.4.1",
"range-parser": "^1.2.1",
"statuses": "^2.0.2"
},
"engines": {
"node": ">= 18"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/express"
}
},
"node_modules/serve-static": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/serve-static/-/serve-static-2.2.1.tgz",
"integrity": "sha512-xRXBn0pPqQTVQiC8wyQrKs2MOlX24zQ0POGaj0kultvoOCstBQM5yvOhAVSUwOMjQtTvsPWoNCHfPGwaaQJhTw==",
"license": "MIT",
"dependencies": {
"encodeurl": "^2.0.0",
"escape-html": "^1.0.3",
"parseurl": "^1.3.3",
"send": "^1.2.0"
},
"engines": {
"node": ">= 18"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/express"
}
},
"node_modules/setprototypeof": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz",
"integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==",
"license": "ISC"
},
"node_modules/side-channel": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz",
"integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==",
"license": "MIT",
"dependencies": {
"es-errors": "^1.3.0",
"object-inspect": "^1.13.3",
"side-channel-list": "^1.0.0",
"side-channel-map": "^1.0.1",
"side-channel-weakmap": "^1.0.2"
},
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/side-channel-list": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.0.tgz",
"integrity": "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==",
"license": "MIT",
"dependencies": {
"es-errors": "^1.3.0",
"object-inspect": "^1.13.3"
},
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/side-channel-map": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz",
"integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==",
"license": "MIT",
"dependencies": {
"call-bound": "^1.0.2",
"es-errors": "^1.3.0",
"get-intrinsic": "^1.2.5",
"object-inspect": "^1.13.3"
},
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/side-channel-weakmap": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz",
"integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==",
"license": "MIT",
"dependencies": {
"call-bound": "^1.0.2",
"es-errors": "^1.3.0",
"get-intrinsic": "^1.2.5",
"object-inspect": "^1.13.3",
"side-channel-map": "^1.0.1"
},
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/statuses": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz",
"integrity": "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==",
"license": "MIT",
"engines": {
"node": ">= 0.8"
}
},
"node_modules/toidentifier": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",
"integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==",
"license": "MIT",
"engines": {
"node": ">=0.6"
}
},
"node_modules/type-is": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/type-is/-/type-is-2.0.1.tgz",
"integrity": "sha512-OZs6gsjF4vMp32qrCbiVSkrFmXtG/AZhY3t0iAMrMBiAZyV9oALtXO8hsrHbMXF9x6L3grlFuwW2oAz7cav+Gw==",
"license": "MIT",
"dependencies": {
"content-type": "^1.0.5",
"media-typer": "^1.1.0",
"mime-types": "^3.0.0"
},
"engines": {
"node": ">= 0.6"
}
},
"node_modules/unpipe": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
"integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==",
"license": "MIT",
"engines": {
"node": ">= 0.8"
}
},
"node_modules/vary": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
"integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==",
"license": "MIT",
"engines": {
"node": ">= 0.8"
}
},
"node_modules/wrappy": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
"integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==",
"license": "ISC"
}
}
}
+17
View File
@@ -0,0 +1,17 @@
{
"$schema": "https://www.schemastore.org/package.json",
"private": true,
"type": "module",
"scripts": {
"build": "vite build",
"dev": "vite"
},
"devDependencies": {
"@tailwindcss/vite": "^4.0.0",
"axios": "^1.11.0",
"concurrently": "^9.0.1",
"laravel-vite-plugin": "^2.0.0",
"tailwindcss": "^4.0.0",
"vite": "^7.0.7"
}
}
+33
View File
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true"
>
<testsuites>
<testsuite name="Unit">
<directory>tests/Unit</directory>
</testsuite>
<testsuite name="Feature">
<directory>tests/Feature</directory>
</testsuite>
</testsuites>
<source>
<include>
<directory>app</directory>
</include>
</source>
<php>
<env name="APP_ENV" value="testing"/>
<env name="APP_MAINTENANCE_DRIVER" value="file"/>
<env name="BCRYPT_ROUNDS" value="4"/>
<env name="BROADCAST_CONNECTION" value="null"/>
<env name="CACHE_STORE" value="array"/>
<env name="MAIL_MAILER" value="array"/>
<env name="QUEUE_CONNECTION" value="sync"/>
<env name="SESSION_DRIVER" value="array"/>
<env name="PULSE_ENABLED" value="false"/>
<env name="TELESCOPE_ENABLED" value="false"/>
<env name="NIGHTWATCH_ENABLED" value="false"/>
</php>
</phpunit>
+25
View File
@@ -0,0 +1,25 @@
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Handle X-XSRF-Token Header
RewriteCond %{HTTP:x-xsrf-token} .
RewriteRule .* - [E=HTTP_X_XSRF_TOKEN:%{HTTP:X-XSRF-Token}]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Send Requests To Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
View File
+20
View File
@@ -0,0 +1,20 @@
<?php
use Illuminate\Foundation\Application;
use Illuminate\Http\Request;
define('LARAVEL_START', microtime(true));
// Determine if the application is in maintenance mode...
if (file_exists($maintenance = __DIR__.'/../storage/framework/maintenance.php')) {
require $maintenance;
}
// Register the Composer autoloader...
require __DIR__.'/../vendor/autoload.php';
// Bootstrap Laravel and handle the request...
/** @var Application $app */
$app = require_once __DIR__.'/../bootstrap/app.php';
$app->handleRequest(Request::capture());
+2
View File
@@ -0,0 +1,2 @@
User-agent: *
Disallow:
+11
View File
@@ -0,0 +1,11 @@
@import 'tailwindcss';
@source '../../vendor/laravel/framework/src/Illuminate/Pagination/resources/views/*.blade.php';
@source '../../storage/framework/views/*.php';
@source '../**/*.blade.php';
@source '../**/*.js';
@theme {
--font-sans: 'Instrument Sans', ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji',
'Segoe UI Symbol', 'Noto Color Emoji';
}
+1
View File
@@ -0,0 +1 @@
import './bootstrap';
+4
View File
@@ -0,0 +1,4 @@
import axios from 'axios';
window.axios = axios;
window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
File diff suppressed because one or more lines are too long
+55
View File
@@ -0,0 +1,55 @@
<?php
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\Api\AuthController;
use App\Http\Controllers\Api\VenueController;
use App\Http\Controllers\Api\ReservationController;
use App\Http\Controllers\Api\NotificationController;
use App\Http\Controllers\Api\FeedbackController;
use App\Http\Controllers\Api\AdminController;
use Illuminate\Http\Request;
Route::any('/register', function (Request $request) {
if ($request->isMethod('post')) {
return app(AuthController::class)->register($request);
}
return response()->json([
'message' => 'Method Not Allowed. Use POST /api/register.',
'allowed' => ['POST'],
], 405);
});
Route::post('/login', [AuthController::class, 'login']);
Route::middleware('auth:sanctum')->post('/logout', [AuthController::class, 'logout']);
Route::middleware('auth:sanctum')->get('/me', [AuthController::class, 'me']);
Route::middleware('auth:sanctum')->patch('/me', [AuthController::class, 'updateProfile']);
Route::middleware(['auth:sanctum', 'role:customer'])->get('/customer-only', function () {
return response()->json(['ok' => true]);
});
Route::get('/venues', [VenueController::class, 'index']);
Route::get('/venues/{id}', [VenueController::class, 'show']);
Route::middleware(['auth:sanctum', 'role:vendor'])->post('/venues', [VenueController::class, 'store']);
Route::middleware(['auth:sanctum', 'role:admin'])->get('/admin/venues', [VenueController::class, 'adminIndex']);
Route::middleware(['auth:sanctum', 'role:admin'])->post('/admin/venues', [VenueController::class, 'adminStore']);
Route::middleware(['auth:sanctum', 'role:admin'])->put('/admin/venues/{id}', [VenueController::class, 'adminUpdate']);
Route::middleware(['auth:sanctum', 'role:admin'])->delete('/admin/venues/{id}', [VenueController::class, 'adminDestroy']);
Route::middleware(['auth:sanctum', 'role:customer'])->post('/reservations', [ReservationController::class, 'store']);
Route::middleware(['auth:sanctum', 'role:customer'])->get('/reservations', [ReservationController::class, 'myReservations']);
Route::middleware(['auth:sanctum', 'role:vendor'])->get('/vendor-reservations', [ReservationController::class, 'vendorReservations']);
Route::middleware(['auth:sanctum', 'role:vendor'])->patch('/reservations/{id}/approve', [ReservationController::class, 'approve']);
Route::middleware(['auth:sanctum', 'role:vendor'])->patch('/reservations/{id}/reject', [ReservationController::class, 'reject']);
Route::middleware(['auth:sanctum', 'role:customer'])->patch('/reservations/{id}/cancel', [ReservationController::class, 'cancelByCustomer']);
Route::middleware(['auth:sanctum', 'role:vendor'])->patch('/reservations/{id}/cancel-by-venue', [ReservationController::class, 'cancelByVendor']);
Route::middleware(['auth:sanctum', 'role:vendor'])->patch('/reservations/{id}/no-show', [ReservationController::class, 'markNoShow']);
Route::middleware(['auth:sanctum', 'role:vendor'])->patch('/reservations/{id}/complete', [ReservationController::class, 'markCompleted']);
Route::middleware(['auth:sanctum'])->get('/notifications', [NotificationController::class, 'index']);
Route::middleware(['auth:sanctum', 'role:customer'])->post('/feedback', [FeedbackController::class, 'store']);
Route::middleware(['auth:sanctum', 'role:admin'])->get('/admin/feedback', [FeedbackController::class, 'adminIndex']);
Route::middleware(['auth:sanctum', 'role:admin'])->get('/admin/users', [AdminController::class, 'users']);
Route::middleware(['auth:sanctum', 'role:admin'])->get('/admin/reservations', [AdminController::class, 'reservations']);
+11
View File
@@ -0,0 +1,11 @@
<?php
use Illuminate\Foundation\Inspiring;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\Schedule;
Artisan::command('inspire', function () {
$this->comment(Inspiring::quote());
})->purpose('Display an inspiring quote');
Schedule::command('reservations:send-reminders')->everyMinute();
+8
View File
@@ -0,0 +1,8 @@
<?php
use Illuminate\Support\Facades\Route;
Route::get('/', function () {
return view('welcome');
});
+22
View File
@@ -0,0 +1,22 @@
<?php
require __DIR__ . '/../vendor/autoload.php';
$app = require __DIR__ . '/../bootstrap/app.php';
$app->make(Illuminate\Contracts\Console\Kernel::class)->bootstrap();
$role = \App\Models\Role::firstOrCreate(['name' => 'admin']);
$user = \App\Models\User::firstOrCreate(
['email' => 'admin@admin.admin'],
[
'first_name' => 'Admin',
'last_name' => 'User',
'phone' => '0000000000',
'password' => '000000',
]
);
$user->roles()->syncWithoutDetaching([$role->id]);
echo "OK\n";
+4
View File
@@ -0,0 +1,4 @@
*
!private/
!public/
!.gitignore
@@ -0,0 +1,2 @@
*
!.gitignore
@@ -0,0 +1,2 @@
*
!.gitignore
@@ -0,0 +1,9 @@
compiled.php
config.php
down
events.scanned.php
maintenance.php
routes.php
routes.scanned.php
schedule-*
services.json
@@ -0,0 +1,3 @@
*
!data/
!.gitignore

Some files were not shown because too many files have changed in this diff Show More