Admin Dashboard Change

This commit is contained in:
ChanukaST 2026-07-14 09:39:31 +05:30
commit 7a451a046f
88 changed files with 11955 additions and 0 deletions

18
.editorconfig Normal file
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
[docker-compose.yml]
indent_size = 4

68
.env.example Normal file
View File

@ -0,0 +1,68 @@
APP_NAME=UniformFlow
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost
ADMIN_EMAIL=admin@uniformflow.local
ADMIN_PASSWORD=change-this-password
APP_LOCALE=en
APP_FALLBACK_LOCALE=en
APP_FAKER_LOCALE=en_US
APP_MAINTENANCE_DRIVER=file
# APP_MAINTENANCE_STORE=database
PHP_CLI_SERVER_WORKERS=4
BCRYPT_ROUNDS=12
LOG_CHANNEL=stack
LOG_STACK=single
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=uniform_management
DB_USERNAME=root
DB_PASSWORD=
SESSION_DRIVER=database
SESSION_LIFETIME=120
SESSION_ENCRYPT=false
SESSION_PATH=/
SESSION_DOMAIN=null
BROADCAST_CONNECTION=log
FILESYSTEM_DISK=local
QUEUE_CONNECTION=database
CACHE_STORE=database
# CACHE_PREFIX=
MEMCACHED_HOST=127.0.0.1
REDIS_CLIENT=phpredis
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_MAILER=log
MAIL_SCHEME=null
MAIL_HOST=127.0.0.1
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_FROM_ADDRESS="hello@example.com"
MAIL_FROM_NAME="${APP_NAME}"
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
AWS_USE_PATH_STYLE_ENDPOINT=false
VITE_APP_NAME="${APP_NAME}"

11
.gitattributes vendored Normal file
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

23
.gitignore vendored Normal file
View File

@ -0,0 +1,23 @@
/.phpunit.cache
/node_modules
/public/build
/public/hot
/public/storage
/storage/*.key
/storage/pail
/vendor
.env
.env.backup
.env.production
.phpactor.json
.phpunit.result.cache
Homestead.json
Homestead.yaml
npm-debug.log
yarn-error.log
/auth.json
/.fleet
/.idea
/.nova
/.vscode
/.zed

35
README.md Normal file
View File

@ -0,0 +1,35 @@
# UniformFlow
A Laravel 12 uniform stock and employee accountability system.
## Features
- Uniform catalogue with size-level stock balances and reorder thresholds
- Stock receiving with an immutable movement audit trail
- Employee directory and individual issue history
- Uniform issuing with live availability and insufficient-stock protection
- Employee exit handover for reusable, damaged, or unreturned items
- Automatic stock return for reusable handover items
- Dashboard for stock, issued units, alerts, and recent activity
## Run locally
```bash
php artisan migrate --seed
php artisan serve
```
Open `http://127.0.0.1:8000`.
The login page is the public landing page. The seeded local administrator credentials are:
- Email: `admin@uniformflow.local`
- Password: `Admin@12345`
Change `ADMIN_EMAIL` and `ADMIN_PASSWORD` in `.env` before reseeding for a shared or production installation.
The default configuration uses SQLite, so no database server is required. Run tests with:
```bash
php artisan test
```

View File

@ -0,0 +1,50 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Validation\ValidationException;
class AdminLoginController extends Controller
{
public function create()
{
if (Auth::check() && Auth::user()->is_admin) {
return redirect()->route('dashboard');
}
return view('auth.login');
}
public function store(Request $request)
{
$credentials = $request->validate([
'email' => ['required', 'email'],
'password' => ['required', 'string'],
]);
if (! Auth::attempt($credentials, $request->boolean('remember'))) {
throw ValidationException::withMessages(['email' => 'The supplied administrator credentials are incorrect.']);
}
if (! $request->user()->is_admin) {
Auth::logout();
throw ValidationException::withMessages(['email' => 'This account does not have administrator access.']);
}
$request->session()->regenerate();
return redirect()->intended(route('dashboard'));
}
public function destroy(Request $request)
{
Auth::logout();
$request->session()->invalidate();
$request->session()->regenerateToken();
return redirect()->route('login')->with('success', 'You have been signed out.');
}
}

View File

@ -0,0 +1,8 @@
<?php
namespace App\Http\Controllers;
abstract class Controller
{
//
}

View File

@ -0,0 +1,55 @@
<?php
namespace App\Http\Controllers;
use App\Models\Employee;
use App\Models\Handover;
use App\Models\HandoverItem;
use App\Models\StockMovement;
use App\Models\StockVariant;
use App\Models\UniformIssue;
use App\Models\UniformItem;
use Illuminate\Support\Facades\DB;
class DashboardController extends Controller
{
public function __invoke()
{
$monthStart = now()->startOfMonth()->toDateString();
$monthEnd = now()->endOfMonth()->toDateString();
$variants = StockVariant::count();
$healthyVariants = StockVariant::whereColumn('quantity', '>', 'reorder_level')->count();
return view('dashboard', [
'activeEmployees' => Employee::where('status', 'active')->count(),
'uniformTypes' => UniformItem::count(),
'unitsInStock' => StockVariant::sum('quantity'),
'unitsIssued' => UniformIssue::where('status', 'issued')->get()->sum(fn ($issue) => $issue->outstanding_quantity),
'issuedThisMonth' => UniformIssue::whereBetween('issued_at', [$monthStart, $monthEnd])->sum('quantity'),
'handoversThisMonth' => Handover::whereBetween('handover_date', [$monthStart, $monthEnd])->count(),
'employeesWithIssues' => UniformIssue::where('status', 'issued')->distinct()->count('employee_id'),
'stockHealth' => $variants ? (int) round(($healthyVariants / $variants) * 100) : 100,
'lowStock' => StockVariant::with('item')->whereColumn('quantity', '<=', 'reorder_level')->orderBy('quantity')->get(),
'outOfStock' => StockVariant::with('item')->where('quantity', 0)->orderBy('size')->get(),
'replacementDue' => UniformIssue::with(['employee', 'variant.item'])
->where('status', 'issued')
->whereDate('issued_at', '<=', now()->subYear()->toDateString())
->oldest('issued_at')->take(6)->get(),
'departmentAllocation' => UniformIssue::query()
->join('employees', 'employees.id', '=', 'uniform_issues.employee_id')
->where('uniform_issues.status', 'issued')
->select('employees.department', DB::raw('SUM(uniform_issues.quantity - uniform_issues.returned_quantity) as units'))
->groupBy('employees.department')->orderByDesc('units')->take(6)->get(),
'popularUniforms' => UniformIssue::query()
->join('stock_variants', 'stock_variants.id', '=', 'uniform_issues.stock_variant_id')
->join('uniform_items', 'uniform_items.id', '=', 'stock_variants.uniform_item_id')
->select('uniform_items.name', DB::raw('SUM(uniform_issues.quantity) as units'))
->groupBy('uniform_items.id', 'uniform_items.name')->orderByDesc('units')->take(5)->get(),
'handoverOutcomes' => HandoverItem::join('handovers', 'handovers.id', '=', 'handover_items.handover_id')
->whereBetween('handovers.handover_date', [$monthStart, $monthEnd])
->select('handover_items.condition', DB::raw('SUM(handover_items.quantity) as units'))
->groupBy('condition')->pluck('units', 'condition'),
'recentMovements' => StockMovement::with(['variant.item'])->latest()->take(8)->get(),
]);
}
}

View File

@ -0,0 +1,39 @@
<?php
namespace App\Http\Controllers;
use App\Models\Employee;
use Illuminate\Http\Request;
class EmployeeController extends Controller
{
public function index(Request $request)
{
$employees = Employee::query()
->when($request->search, fn ($q, $term) => $q->where(fn ($q) => $q->where('name', 'like', "%{$term}%")->orWhere('employee_no', 'like', "%{$term}%")))
->withCount(['issues as outstanding_items_count' => fn ($q) => $q->where('status', 'issued')])
->orderBy('name')->paginate(15)->withQueryString();
return view('employees.index', compact('employees'));
}
public function store(Request $request)
{
Employee::create($request->validate([
'employee_no' => ['required', 'string', 'max:50', 'unique:employees'],
'name' => ['required', 'string', 'max:150'],
'department' => ['required', 'string', 'max:100'],
'designation' => ['nullable', 'string', 'max:100'],
'joined_at' => ['nullable', 'date'],
]));
return back()->with('success', 'Employee added successfully.');
}
public function show(Employee $employee)
{
$employee->load(['issues.variant.item', 'handovers.items.issue.variant.item']);
return view('employees.show', compact('employee'));
}
}

View File

@ -0,0 +1,83 @@
<?php
namespace App\Http\Controllers;
use App\Models\Employee;
use App\Models\Handover;
use App\Models\StockMovement;
use App\Models\UniformIssue;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Illuminate\Validation\Rule;
use Illuminate\Validation\ValidationException;
class HandoverController extends Controller
{
public function index()
{
return view('handovers.index', [
'employees' => Employee::where('status', 'active')->whereHas('issues', fn ($q) => $q->where('status', 'issued'))->orderBy('name')->get(),
'handovers' => Handover::with(['employee', 'items.issue.variant.item'])->latest('handover_date')->get(),
]);
}
public function create(Employee $employee)
{
$employee->load(['issues' => fn ($q) => $q->where('status', 'issued')->with('variant.item')]);
abort_if($employee->status !== 'active', 422, 'This employee has already left.');
return view('handovers.create', compact('employee'));
}
public function store(Request $request, Employee $employee)
{
$data = $request->validate([
'handover_date' => ['required', 'date'],
'notes' => ['nullable', 'string', 'max:1000'],
'items' => ['required', 'array'],
'items.*.issue_id' => ['required', 'integer', 'distinct', 'exists:uniform_issues,id'],
'items.*.condition' => ['required', Rule::in(['reusable', 'damaged', 'not_returned'])],
]);
DB::transaction(function () use ($data, $employee) {
$lockedEmployee = Employee::lockForUpdate()->findOrFail($employee->id);
if ($lockedEmployee->status !== 'active') {
throw ValidationException::withMessages(['employee' => 'This employee has already completed handover.']);
}
$openIssues = UniformIssue::where('employee_id', $employee->id)->where('status', 'issued')->lockForUpdate()->get()->keyBy('id');
if ($openIssues->count() !== count($data['items'])) {
throw ValidationException::withMessages(['items' => 'Every outstanding uniform must be accounted for before handover is completed.']);
}
$handover = Handover::create(['employee_id' => $employee->id, 'handover_date' => $data['handover_date'], 'notes' => $data['notes'] ?? null]);
foreach ($data['items'] as $itemData) {
$issue = $openIssues->get($itemData['issue_id']);
if (! $issue) {
throw ValidationException::withMessages(['items' => 'An invalid issue was submitted.']);
}
$quantity = $issue->outstanding_quantity;
$handover->items()->create(['uniform_issue_id' => $issue->id, 'quantity' => $quantity, 'condition' => $itemData['condition']]);
if ($itemData['condition'] === 'reusable') {
$issue->variant()->lockForUpdate()->first()->increment('quantity', $quantity);
StockMovement::create([
'stock_variant_id' => $issue->stock_variant_id,
'employee_id' => $employee->id,
'uniform_issue_id' => $issue->id,
'type' => 'return',
'quantity_change' => $quantity,
'notes' => 'Reusable return during employee exit handover',
]);
}
$issue->update(['returned_quantity' => $issue->quantity, 'status' => $itemData['condition'] === 'not_returned' ? 'not_returned' : 'returned']);
}
$lockedEmployee->update(['status' => 'left', 'left_at' => $data['handover_date']]);
});
return redirect()->route('handovers.index')->with('success', 'Handover completed and employee marked as left.');
}
}

View File

@ -0,0 +1,79 @@
<?php
namespace App\Http\Controllers;
use App\Models\StockMovement;
use App\Models\StockVariant;
use App\Models\UniformItem;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Illuminate\Validation\Rule;
use Illuminate\Validation\ValidationException;
class InventoryController extends Controller
{
public function index()
{
return view('inventory.index', [
'items' => UniformItem::with('variants')->orderBy('name')->get(),
'movements' => StockMovement::with('variant.item')->latest()->take(15)->get(),
]);
}
public function storeItem(Request $request)
{
$data = $request->validate([
'code' => ['required', 'string', 'max:40', 'unique:uniform_items'],
'name' => ['required', 'string', 'max:120'],
'description' => ['nullable', 'string', 'max:500'],
'sizes' => ['required', 'array', 'min:1'],
'sizes.*' => ['required', 'string', 'distinct', Rule::in($this->allowedSizes())],
'reorder_level' => ['required', 'integer', 'min:0'],
]);
DB::transaction(function () use ($data) {
$item = UniformItem::create($data);
collect($data['sizes'])->map(fn ($size) => strtoupper(trim($size)))->filter()->unique()
->each(fn ($size) => $item->variants()->create(['size' => $size, 'reorder_level' => $data['reorder_level']]));
});
return back()->with('success', 'Uniform and size options added.');
}
public function restock(Request $request)
{
$data = $request->validate([
'uniform_item_id' => ['required', 'exists:uniform_items,id'],
'stocks' => ['required', 'array', 'min:1'],
'stocks.*' => ['required', 'integer', 'min:1', 'max:100000'],
'notes' => ['nullable', 'string', 'max:500'],
]);
$updatedSizes = 0;
DB::transaction(function () use ($data, &$updatedSizes) {
$variants = StockVariant::whereIn('id', array_keys($data['stocks']))->lockForUpdate()->get()->keyBy('id');
if ($variants->count() !== count($data['stocks']) || $variants->contains(fn ($variant) => $variant->uniform_item_id !== (int) $data['uniform_item_id'])) {
throw ValidationException::withMessages(['stocks' => 'One or more selected sizes do not belong to that uniform.']);
}
foreach ($data['stocks'] as $variantId => $quantity) {
$variant = $variants->get((int) $variantId);
$variant->increment('quantity', $quantity);
StockMovement::create([
'stock_variant_id' => $variant->id,
'type' => 'restock',
'quantity_change' => $quantity,
'notes' => $data['notes'] ?? null,
]);
$updatedSizes++;
}
});
return back()->with('success', "Stock updated successfully for {$updatedSizes} size(s).");
}
private function allowedSizes(): array
{
return ['XXS', 'XS', 'S', 'M', 'L', 'XL', '2XL', '3XL', '4XL', '26', '28', '30', '32', '34', '36', '38', '40', '42', '44', '46', '48'];
}
}

View File

@ -0,0 +1,59 @@
<?php
namespace App\Http\Controllers;
use App\Models\Employee;
use App\Models\StockMovement;
use App\Models\StockVariant;
use App\Models\UniformIssue;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Illuminate\Validation\ValidationException;
class IssueController extends Controller
{
public function index()
{
return view('issues.index', [
'employees' => Employee::where('status', 'active')->orderBy('name')->get(),
'variants' => StockVariant::with('item')->where('quantity', '>', 0)->orderBy('size')->get()->sortBy('item.name'),
'issues' => UniformIssue::with(['employee', 'variant.item'])->latest('issued_at')->paginate(15),
]);
}
public function store(Request $request)
{
$data = $request->validate([
'employee_id' => ['required', 'exists:employees,id'],
'stock_variant_id' => ['required', 'exists:stock_variants,id'],
'quantity' => ['required', 'integer', 'min:1'],
'issued_at' => ['required', 'date'],
'notes' => ['nullable', 'string', 'max:500'],
]);
DB::transaction(function () use ($data) {
$employee = Employee::lockForUpdate()->findOrFail($data['employee_id']);
if ($employee->status !== 'active') {
throw ValidationException::withMessages(['employee_id' => 'Uniforms can only be issued to active employees.']);
}
$variant = StockVariant::lockForUpdate()->findOrFail($data['stock_variant_id']);
if ($variant->quantity < $data['quantity']) {
throw ValidationException::withMessages(['quantity' => "Only {$variant->quantity} item(s) are available in this size."]);
}
$issue = UniformIssue::create($data);
$variant->decrement('quantity', $data['quantity']);
StockMovement::create([
'stock_variant_id' => $variant->id,
'employee_id' => $employee->id,
'uniform_issue_id' => $issue->id,
'type' => 'issue',
'quantity_change' => -$data['quantity'],
'notes' => "Issued to {$employee->name}",
]);
});
return back()->with('success', 'Uniform issued and stock adjusted.');
}
}

View File

@ -0,0 +1,17 @@
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Symfony\Component\HttpFoundation\Response;
class EnsureUserIsAdmin
{
public function handle(Request $request, Closure $next): Response
{
abort_unless($request->user()?->is_admin, 403, 'Administrator access is required.');
return $next($request);
}
}

22
app/Models/Employee.php Normal file
View File

@ -0,0 +1,22 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Employee extends Model
{
protected $fillable = ['employee_no', 'name', 'department', 'designation', 'joined_at', 'left_at', 'status'];
protected $casts = ['joined_at' => 'date', 'left_at' => 'date'];
public function issues()
{
return $this->hasMany(UniformIssue::class);
}
public function handovers()
{
return $this->hasMany(Handover::class);
}
}

22
app/Models/Handover.php Normal file
View File

@ -0,0 +1,22 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Handover extends Model
{
protected $fillable = ['employee_id', 'handover_date', 'status', 'notes'];
protected $casts = ['handover_date' => 'date'];
public function employee()
{
return $this->belongsTo(Employee::class);
}
public function items()
{
return $this->hasMany(HandoverItem::class);
}
}

View File

@ -0,0 +1,20 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class HandoverItem extends Model
{
protected $fillable = ['handover_id', 'uniform_issue_id', 'quantity', 'condition'];
public function handover()
{
return $this->belongsTo(Handover::class);
}
public function issue()
{
return $this->belongsTo(UniformIssue::class, 'uniform_issue_id');
}
}

View File

@ -0,0 +1,15 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class StockMovement extends Model
{
protected $fillable = ['stock_variant_id', 'employee_id', 'uniform_issue_id', 'type', 'quantity_change', 'notes'];
public function variant()
{
return $this->belongsTo(StockVariant::class, 'stock_variant_id');
}
}

View File

@ -0,0 +1,25 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class StockVariant extends Model
{
protected $fillable = ['uniform_item_id', 'size', 'quantity', 'reorder_level'];
public function item()
{
return $this->belongsTo(UniformItem::class, 'uniform_item_id');
}
public function issues()
{
return $this->hasMany(UniformIssue::class);
}
public function movements()
{
return $this->hasMany(StockMovement::class);
}
}

View File

@ -0,0 +1,27 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class UniformIssue extends Model
{
protected $fillable = ['employee_id', 'stock_variant_id', 'quantity', 'returned_quantity', 'issued_at', 'status', 'notes'];
protected $casts = ['issued_at' => 'date'];
public function employee()
{
return $this->belongsTo(Employee::class);
}
public function variant()
{
return $this->belongsTo(StockVariant::class, 'stock_variant_id');
}
public function getOutstandingQuantityAttribute(): int
{
return $this->quantity - $this->returned_quantity;
}
}

View File

@ -0,0 +1,15 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class UniformItem extends Model
{
protected $fillable = ['code', 'name', 'description'];
public function variants()
{
return $this->hasMany(StockVariant::class);
}
}

51
app/Models/User.php Normal file
View File

@ -0,0 +1,51 @@
<?php
namespace App\Models;
// use Illuminate\Contracts\Auth\MustVerifyEmail;
use Database\Factories\UserFactory;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
class User extends Authenticatable
{
/** @use HasFactory<UserFactory> */
use HasFactory, Notifiable;
/**
* The attributes that are mass assignable.
*
* @var list<string>
*/
protected $fillable = [
'name',
'email',
'password',
'is_admin',
];
/**
* The attributes that should be hidden for serialization.
*
* @var list<string>
*/
protected $hidden = [
'password',
'remember_token',
];
/**
* Get the attributes that should be cast.
*
* @return array<string, string>
*/
protected function casts(): array
{
return [
'email_verified_at' => 'datetime',
'password' => 'hashed',
'is_admin' => 'boolean',
];
}
}

View File

@ -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
artisan Normal file
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);

21
bootstrap/app.php Normal file
View File

@ -0,0 +1,21 @@
<?php
use App\Http\Middleware\EnsureUserIsAdmin;
use Illuminate\Foundation\Application;
use Illuminate\Foundation\Configuration\Exceptions;
use Illuminate\Foundation\Configuration\Middleware;
return Application::configure(basePath: dirname(__DIR__))
->withRouting(
web: __DIR__.'/../routes/web.php',
commands: __DIR__.'/../routes/console.php',
health: '/up',
)
->withMiddleware(function (Middleware $middleware) {
$middleware->alias([
'admin' => EnsureUserIsAdmin::class,
]);
})
->withExceptions(function (Exceptions $exceptions) {
//
})->create();

2
bootstrap/cache/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*
!.gitignore

7
bootstrap/providers.php Normal file
View File

@ -0,0 +1,7 @@
<?php
use App\Providers\AppServiceProvider;
return [
AppServiceProvider::class,
];

74
composer.json Normal file
View File

@ -0,0 +1,74 @@
{
"$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/tinker": "^2.10.1"
},
"require-dev": {
"fakerphp/faker": "^1.23",
"laravel/pail": "^1.2.2",
"laravel/pint": "^1.13",
"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": {
"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 -r \"file_exists('database/database.sqlite') || touch('database/database.sqlite');\"",
"@php artisan migrate --graceful --ansi"
],
"dev": [
"Composer\\Config::disableProcessTimeout",
"npx concurrently -c \"#93c5fd,#c4b5fd,#fb7185,#fdba74\" \"php artisan serve\" \"php artisan queue:listen --tries=1\" \"php artisan pail --timeout=0\" \"npm run dev\" --names=server,queue,logs,vite"
]
},
"extra": {
"branch-alias": {
"dev-master": "12.x-dev"
},
"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": "dev",
"prefer-stable": true
}

8395
composer.lock generated Normal file

File diff suppressed because it is too large Load Diff

126
config/app.php Normal file
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(',', 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'),
],
];

117
config/auth.php Normal file
View File

@ -0,0 +1,117 @@
<?php
use App\Models\User;
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', 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 amount 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),
];

108
config/cache.php Normal file
View File

@ -0,0 +1,108 @@
<?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", "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',
],
],
/*
|--------------------------------------------------------------------------
| 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(env('APP_NAME', 'laravel'), '_').'_cache_'),
];

174
config/database.php Normal file
View File

@ -0,0 +1,174 @@
<?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', 'sqlite'),
/*
|--------------------------------------------------------------------------
| 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,
],
'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([
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([
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
]) : [],
],
'pgsql' => [
'driver' => 'pgsql',
'url' => env('DB_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' => '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(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'),
],
'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'),
],
],
];

80
config/filesystems.php Normal file
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' => env('APP_URL').'/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
config/logging.php Normal file
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(',', 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,
'formatter' => env('LOG_STDERR_FORMATTER'),
'with' => [
'stream' => 'php://stderr',
],
'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'),
],
],
];

116
config/mail.php Normal file
View File

@ -0,0 +1,116 @@
<?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(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',
],
],
'roundrobin' => [
'transport' => 'roundrobin',
'mailers' => [
'ses',
'postmark',
],
],
],
/*
|--------------------------------------------------------------------------
| 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'),
],
];

112
config/queue.php Normal file
View File

@ -0,0 +1,112 @@
<?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", "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,
],
],
/*
|--------------------------------------------------------------------------
| 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', 'sqlite'),
'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', 'sqlite'),
'table' => 'failed_jobs',
],
];

38
config/services.php Normal file
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' => [
'token' => env('POSTMARK_TOKEN'),
],
'ses' => [
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
],
'resend' => [
'key' => env('RESEND_KEY'),
],
'slack' => [
'notifications' => [
'bot_user_oauth_token' => env('SLACK_BOT_USER_OAUTH_TOKEN'),
'channel' => env('SLACK_BOT_USER_DEFAULT_CHANNEL'),
],
],
];

217
config/session.php Normal file
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", "apc",
| "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: "apc", "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(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 and all 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
database/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*.sqlite*

View File

@ -0,0 +1,45 @@
<?php
namespace Database\Factories;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Str;
/**
* @extends Factory<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 [
'name' => fake()->name(),
'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,
]);
}
}

View File

@ -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');
}
};

View File

@ -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');
});
Schema::create('cache_locks', function (Blueprint $table) {
$table->string('key')->primary();
$table->string('owner');
$table->integer('expiration');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('cache');
Schema::dropIfExists('cache_locks');
}
};

View File

@ -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');
}
};

View File

@ -0,0 +1,93 @@
<?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('employees', function (Blueprint $table) {
$table->id();
$table->string('employee_no')->unique();
$table->string('name');
$table->string('department');
$table->string('designation')->nullable();
$table->date('joined_at')->nullable();
$table->date('left_at')->nullable();
$table->string('status')->default('active');
$table->timestamps();
});
Schema::create('uniform_items', function (Blueprint $table) {
$table->id();
$table->string('code')->unique();
$table->string('name');
$table->text('description')->nullable();
$table->timestamps();
});
Schema::create('stock_variants', function (Blueprint $table) {
$table->id();
$table->foreignId('uniform_item_id')->constrained()->cascadeOnDelete();
$table->string('size');
$table->unsignedInteger('quantity')->default(0);
$table->unsignedInteger('reorder_level')->default(5);
$table->timestamps();
$table->unique(['uniform_item_id', 'size']);
});
Schema::create('uniform_issues', function (Blueprint $table) {
$table->id();
$table->foreignId('employee_id')->constrained()->restrictOnDelete();
$table->foreignId('stock_variant_id')->constrained()->restrictOnDelete();
$table->unsignedInteger('quantity');
$table->unsignedInteger('returned_quantity')->default(0);
$table->date('issued_at');
$table->string('status')->default('issued');
$table->text('notes')->nullable();
$table->timestamps();
});
Schema::create('handovers', function (Blueprint $table) {
$table->id();
$table->foreignId('employee_id')->constrained()->restrictOnDelete();
$table->date('handover_date');
$table->string('status')->default('completed');
$table->text('notes')->nullable();
$table->timestamps();
});
Schema::create('handover_items', function (Blueprint $table) {
$table->id();
$table->foreignId('handover_id')->constrained()->cascadeOnDelete();
$table->foreignId('uniform_issue_id')->constrained()->restrictOnDelete();
$table->unsignedInteger('quantity');
$table->string('condition');
$table->timestamps();
});
Schema::create('stock_movements', function (Blueprint $table) {
$table->id();
$table->foreignId('stock_variant_id')->constrained()->restrictOnDelete();
$table->foreignId('employee_id')->nullable()->constrained()->nullOnDelete();
$table->foreignId('uniform_issue_id')->nullable()->constrained()->nullOnDelete();
$table->string('type');
$table->integer('quantity_change');
$table->text('notes')->nullable();
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('stock_movements');
Schema::dropIfExists('handover_items');
Schema::dropIfExists('handovers');
Schema::dropIfExists('uniform_issues');
Schema::dropIfExists('stock_variants');
Schema::dropIfExists('uniform_items');
Schema::dropIfExists('employees');
}
};

View File

@ -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('users', function (Blueprint $table) {
$table->boolean('is_admin')->default(false)->after('password');
});
}
public function down(): void
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn('is_admin');
});
}
};

View File

@ -0,0 +1,46 @@
<?php
namespace Database\Seeders;
use App\Models\Employee;
use App\Models\StockMovement;
use App\Models\UniformItem;
use App\Models\User;
// use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
class DatabaseSeeder extends Seeder
{
/**
* Seed the application's database.
*/
public function run(): void
{
User::updateOrCreate(
['email' => env('ADMIN_EMAIL', 'admin@uniformflow.local')],
['name' => 'System Administrator', 'password' => env('ADMIN_PASSWORD', 'Admin@12345'), 'is_admin' => true, 'email_verified_at' => now()]
);
$employees = collect([
['employee_no' => 'EMP-001', 'name' => 'Nadeesha Perera', 'department' => 'Operations', 'designation' => 'Operations Executive', 'joined_at' => '2024-02-12'],
['employee_no' => 'EMP-002', 'name' => 'Kasun Silva', 'department' => 'Warehouse', 'designation' => 'Store Assistant', 'joined_at' => '2023-08-21'],
['employee_no' => 'EMP-003', 'name' => 'Tharushi Fernando', 'department' => 'Front Office', 'designation' => 'Receptionist', 'joined_at' => '2025-01-15'],
])->map(fn ($data) => Employee::create($data));
$catalogue = [
['code' => 'SHIRT-NVY', 'name' => 'Navy Work Shirt', 'sizes' => ['S' => 8, 'M' => 14, 'L' => 9, 'XL' => 3]],
['code' => 'TROUSER-GRY', 'name' => 'Grey Work Trouser', 'sizes' => ['28' => 4, '30' => 9, '32' => 12, '34' => 6, '36' => 2]],
['code' => 'POLO-WHT', 'name' => 'White Polo Shirt', 'sizes' => ['S' => 7, 'M' => 10, 'L' => 5, 'XL' => 0]],
];
foreach ($catalogue as $data) {
$item = UniformItem::create(['code' => $data['code'], 'name' => $data['name']]);
foreach ($data['sizes'] as $size => $quantity) {
$variant = $item->variants()->create(['size' => $size, 'quantity' => $quantity, 'reorder_level' => 4]);
if ($quantity) {
StockMovement::create(['stock_variant_id' => $variant->id, 'type' => 'opening_stock', 'quantity_change' => $quantity, 'notes' => 'Opening stock balance']);
}
}
}
}
}

16
package.json Normal file
View File

@ -0,0 +1,16 @@
{
"private": true,
"type": "module",
"scripts": {
"build": "vite build",
"dev": "vite"
},
"devDependencies": {
"@tailwindcss/vite": "^4.0.0",
"axios": "^1.7.4",
"concurrently": "^9.0.1",
"laravel-vite-plugin": "^1.2.0",
"tailwindcss": "^4.0.0",
"vite": "^6.0.11"
}
}

33
phpunit.xml Normal file
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="CACHE_STORE" value="array"/>
<env name="DB_CONNECTION" value="sqlite" force="true"/>
<env name="DB_DATABASE" value=":memory:" force="true"/>
<env name="MAIL_MAILER" value="array"/>
<env name="PULSE_ENABLED" value="false"/>
<env name="QUEUE_CONNECTION" value="sync"/>
<env name="SESSION_DRIVER" value="array"/>
<env name="TELESCOPE_ENABLED" value="false"/>
</php>
</phpunit>

25
public/.htaccess Normal file
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>

3
public/css/app.css Normal file

File diff suppressed because one or more lines are too long

58
public/css/dashboard.css Normal file
View File

@ -0,0 +1,58 @@
.quick-actions { display: flex; gap: 9px; flex-wrap: wrap; justify-content: flex-end; }
.sidebar-foot.admin-account { display: block; }
.admin-identity { display: flex; gap: 9px; align-items: center; min-width: 0; }
.admin-identity > div { min-width: 0; }
.admin-identity strong, .admin-identity small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-account form { margin-top: 12px; }
.admin-account button { width: 100%; border: 1px solid #365047; border-radius: 7px; background: transparent; color: #9fb2ab; padding: 8px; font: 600 11px "DM Sans"; cursor: pointer; }
.admin-account button:hover { color: white; border-color: #698078; }
.button.subtle { background: #fff; color: #365348; border: 1px solid #dce4e0; }
.admin-stats .stat-card { min-height: 156px; }
.stat-note { color: #87928e; font-size: 11px; }
.admin-summary-grid { display: grid; grid-template-columns: 1.4fr .8fr; gap: 20px; margin-bottom: 20px; }
.health-score { font: 800 25px Manrope; color: var(--green); }
.progress-track, .bar-track { height: 8px; border-radius: 99px; overflow: hidden; background: #e9eeeb; }
.progress-track span { display: block; height: 100%; background: linear-gradient(90deg, #1a7058, #69b98e); border-radius: inherit; }
.health-legend { display: flex; flex-wrap: wrap; gap: 18px; margin: 11px 0 19px; color: var(--muted); font-size: 10px; }
.health-legend i { width: 7px; height: 7px; border-radius: 50%; display: inline-block; margin-right: 5px; }
.good-dot { background: #4caf7b; }
.warn-dot { background: #d7983e; }
.mini-metrics { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); padding-top: 17px; }
.mini-metrics div { padding: 0 18px; border-right: 1px solid var(--line); }
.mini-metrics div:first-child { padding-left: 0; }
.mini-metrics div:last-child { border: 0; }
.mini-metrics small { display: block; color: var(--muted); font-size: 10px; }
.mini-metrics strong { display: block; font: 800 21px Manrope; margin-top: 4px; }
.monthly-metric { display: flex; justify-content: space-between; align-items: center; padding: 11px 0; border-top: 1px solid #edf0ee; font-size: 12px; color: var(--muted); }
.monthly-metric strong { font: 800 17px Manrope; color: var(--ink); }
.monthly-metric.danger-text strong { color: var(--rose); }
.dashboard-main-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.person-avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: #e1ede7; color: var(--green); font-weight: 800; font-size: 12px; flex: none; }
.dashboard-insights-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.bar-row { padding: 9px 0; }
.bar-row > div:first-child { display: flex; justify-content: space-between; margin-bottom: 7px; font-size: 11px; }
.bar-row strong { color: var(--green); }
.bar-track { height: 6px; }
.bar-track i { display: block; height: 100%; background: #579c7c; border-radius: inherit; min-width: 4px; }
.rank-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid #edf0ee; }
.rank-row .rank { width: 25px; height: 25px; border-radius: 7px; display: grid; place-items: center; background: #edf3f0; color: #3e5f53; font-size: 10px; font-weight: 800; }
.rank-row strong { display: block; font-size: 12px; }
.rank-row small { display: block; color: var(--muted); font-size: 10px; margin-top: 2px; }
.rank-row b { font: 800 15px Manrope; }
@media (max-width: 1150px) {
.dashboard-insights-grid { grid-template-columns: 1fr 1fr; }
.dashboard-insights-grid > :last-child { grid-column: 1 / -1; }
}
@media (max-width: 850px) {
.admin-summary-grid, .dashboard-main-grid, .dashboard-insights-grid { grid-template-columns: 1fr; }
.dashboard-insights-grid > :last-child { grid-column: auto; }
.admin-intro { align-items: flex-start; }
.quick-actions { justify-content: flex-start; }
}
@media (max-width: 520px) {
.quick-actions { display: grid; width: 100%; }
.mini-metrics div { padding: 0 8px; }
}

17
public/css/inventory.css Normal file
View File

@ -0,0 +1,17 @@
.check-dropdown { position: relative; margin-top: 6px; }
.check-dropdown summary { list-style: none; min-height: 42px; padding: 11px 12px; border: 1px solid #dce2df; border-radius: 8px; background: white; color: var(--ink); font: 500 13px "DM Sans"; cursor: pointer; display: flex; align-items: center; justify-content: space-between; }
.check-dropdown summary::-webkit-details-marker { display: none; }
.check-dropdown[open] summary { outline: 2px solid #b6d9ca; border-color: var(--green); border-radius: 8px 8px 0 0; }
.dropdown-arrow { font-size: 17px; transition: transform .15s; }
.check-dropdown[open] .dropdown-arrow { transform: rotate(180deg); }
.check-options { position: absolute; z-index: 10; left: 0; right: 0; top: 100%; display: grid; grid-template-columns: repeat(3, 1fr); background: white; border: 1px solid #b9cac3; border-top: 0; border-radius: 0 0 9px 9px; box-shadow: 0 14px 30px rgba(24,48,39,.14); max-height: 245px; overflow: auto; padding: 8px; }
.check-options label { display: flex; align-items: center; gap: 8px; padding: 9px 10px; border-radius: 6px; cursor: pointer; font-size: 12px; color: #43534d; }
.check-options label:hover { background: #edf5f1; }
.check-options input { position: absolute; opacity: 0; pointer-events: none; }
.checkmark { width: 18px; height: 18px; border: 1px solid #bdc9c4; border-radius: 5px; display: grid; place-items: center; color: transparent; font-size: 11px; background: #fff; }
.check-options input:checked + .checkmark { background: var(--green); border-color: var(--green); color: white; }
.check-options input:focus + .checkmark { outline: 2px solid #b6d9ca; }
@media (max-width: 760px) {
.check-options { grid-template-columns: repeat(2, 1fr); }
}

44
public/css/login.css Normal file
View File

@ -0,0 +1,44 @@
:root { --ink:#17201d; --green:#155f4d; --cream:#f3f5f1; --muted:#74807b; }
* { box-sizing: border-box; }
body { margin: 0; font-family: "DM Sans", sans-serif; color: var(--ink); background: var(--cream); }
.login-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(420px, 1.05fr) minmax(480px, .95fr); }
.login-story { position: relative; padding: 42px clamp(42px, 6vw, 92px); color: #eef5f1; background: radial-gradient(circle at 75% 20%, rgba(110,173,143,.22), transparent 32%), linear-gradient(145deg, #18352b 0%, #10231d 72%); overflow: hidden; display: flex; flex-direction: column; }
.login-story::after { content:""; position:absolute; width:420px; height:420px; right:-190px; bottom:-170px; border:1px solid rgba(255,255,255,.1); border-radius:50%; box-shadow:0 0 0 65px rgba(255,255,255,.018),0 0 0 130px rgba(255,255,255,.012); }
.login-brand { color:white; text-decoration:none; display:flex; align-items:center; gap:13px; position:relative; z-index:1; }
.login-brand > span { width:42px; height:42px; border-radius:11px; display:grid; place-items:center; background:#d6e9ae; color:#173028; font:800 13px Manrope; }
.login-brand strong { font:800 18px Manrope; }
.login-brand small { display:block; margin-top:2px; color:#91aaa0; font:500 10px "DM Sans"; }
.story-copy { margin:auto 0; max-width:590px; position:relative; z-index:1; }
.kicker { font-size:10px; font-weight:700; letter-spacing:.18em; color:#9cb5aa; }
.story-copy h1 { margin:18px 0; font:800 clamp(43px,5vw,69px)/1.02 Manrope; letter-spacing:-.055em; }
.story-copy h1 em { color:#bddc91; font-style:normal; }
.story-copy > p { max-width:510px; color:#aabdb5; font-size:15px; line-height:1.7; }
.feature-row { display:grid; grid-template-columns:repeat(3,1fr); margin-top:48px; border-top:1px solid rgba(255,255,255,.13); padding-top:21px; }
.feature-row div { display:flex; gap:11px; align-items:flex-start; }
.feature-row b { color:#c7e2a2; font-size:10px; }
.feature-row span { font-size:11px; line-height:1.45; color:#a9bbb4; }
.story-foot { color:#627a70; font-size:9px; letter-spacing:.08em; position:relative; z-index:1; }
.login-panel { display:grid; place-items:center; padding:45px; background:#f7f8f5; }
.login-card { width:min(100%, 410px); }
.secure-label { display:inline-flex; align-items:center; gap:7px; padding:7px 10px; border-radius:99px; color:#497064; background:#e5eee9; font-size:9px; text-transform:uppercase; letter-spacing:.1em; font-weight:700; }
.secure-label i { width:6px; height:6px; border-radius:50%; background:#49a374; }
.login-card h2 { margin:25px 0 5px; font:800 35px Manrope; letter-spacing:-.04em; }
.login-card > p { margin:0 0 30px; color:var(--muted); font-size:13px; }
.login-card form { display:grid; gap:17px; }
.login-card label { color:#4d5a55; font-size:11px; font-weight:700; }
.login-card input[type=email], .login-card input[type=password], .login-card input[type=text] { width:100%; margin-top:7px; border:1px solid #d8dfdb; border-radius:9px; background:white; padding:13px 14px; font:500 13px "DM Sans"; outline:none; }
.login-card input:focus { border-color:#3e856c; box-shadow:0 0 0 3px rgba(41,113,87,.1); }
.password-field { position:relative; }
.password-field input { padding-right:62px!important; }
.password-field button { position:absolute; right:6px; top:13px; bottom:6px; border:0; background:transparent; color:var(--green); font-size:10px; font-weight:700; cursor:pointer; }
.remember { display:flex; align-items:center; gap:8px; cursor:pointer; }
.remember input { width:15px; height:15px; accent-color:var(--green); }
.remember span { font-weight:500; color:#697570; }
.login-button { border:0; border-radius:9px; padding:14px 17px; background:var(--green); color:white; font:700 13px "DM Sans"; display:flex; justify-content:space-between; cursor:pointer; box-shadow:0 8px 20px rgba(21,95,77,.18); }
.login-button:hover { background:#104d3e; }
.security-note { display:flex; gap:11px; align-items:flex-start; border-top:1px solid #dde3df; margin-top:28px; padding-top:20px; color:#8a9590; font-size:10px; line-height:1.55; }
.security-note span { color:#608778; }
.security-note p { margin:0; }.security-note strong { color:#65736d; }
.login-alert { margin-bottom:18px; padding:11px 13px; border-radius:8px; font-size:11px; }
.login-alert.error { background:#f6e3e3; color:#993f3f; }.login-alert.success { background:#dff0e8; color:#17604b; }
@media(max-width:850px){.login-shell{grid-template-columns:1fr}.login-story{min-height:330px;padding:30px}.story-copy{margin:55px 0 30px}.story-copy h1{font-size:42px}.story-copy>p,.feature-row,.story-foot{display:none}.login-panel{padding:45px 22px}}

0
public/favicon.ico Normal file
View File

20
public/index.php Normal file
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
public/robots.txt Normal file
View File

@ -0,0 +1,2 @@
User-agent: *
Disallow:

12
resources/css/app.css Normal file
View File

@ -0,0 +1,12 @@
@import 'tailwindcss';
@source '../../vendor/laravel/framework/src/Illuminate/Pagination/resources/views/*.blade.php';
@source '../../storage/framework/views/*.php';
@source "../**/*.blade.php";
@source "../**/*.js";
@source "../**/*.vue";
@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
resources/js/app.js Normal file
View File

@ -0,0 +1 @@
import './bootstrap';

4
resources/js/bootstrap.js vendored Normal file
View File

@ -0,0 +1,4 @@
import axios from 'axios';
window.axios = axios;
window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';

View File

@ -0,0 +1,44 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Admin Login - UniformFlow</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Manrope:wght@700;800&display=swap" rel="stylesheet">
<link rel="stylesheet" href="{{ asset('css/login.css') }}">
</head>
<body>
<main class="login-shell">
<section class="login-story">
<a class="login-brand" href="{{ route('login') }}"><span>UF</span><strong>UniformFlow<small>Uniform asset management</small></strong></a>
<div class="story-copy">
<span class="kicker">CONTROL. ACCOUNTABILITY. CLARITY.</span>
<h1>Every uniform,<br><em>accounted for.</em></h1>
<p>Manage size-level inventory, employee issues, stock movements, and exit handovers from one secure operations portal.</p>
<div class="feature-row"><div><b>01</b><span>Live stock<br>control</span></div><div><b>02</b><span>Employee<br>accountability</span></div><div><b>03</b><span>Exit handover<br>tracking</span></div></div>
</div>
<small class="story-foot">UniformFlow / Internal administration system</small>
</section>
<section class="login-panel">
<div class="login-card">
<span class="secure-label"><i></i> Secure administrator access</span>
<h2>Welcome back.</h2>
<p>Sign in to manage your uniform operations.</p>
@if(session('success'))<div class="login-alert success">{{ session('success') }}</div>@endif
@if($errors->any())<div class="login-alert error">{{ $errors->first() }}</div>@endif
<form method="POST" action="{{ route('login.store') }}">@csrf
<label>Email address<input type="email" name="email" value="{{ old('email') }}" autocomplete="username" autofocus required placeholder="admin@company.com"></label>
<label>Password<div class="password-field"><input id="password" type="password" name="password" autocomplete="current-password" required placeholder="Enter your password"><button type="button" aria-label="Show password" onclick="const p=document.getElementById('password');p.type=p.type==='password'?'text':'password';this.textContent=p.type==='password'?'Show':'Hide'">Show</button></div></label>
<label class="remember"><input type="checkbox" name="remember" value="1"><span>Keep me signed in on this device</span></label>
<button class="login-button" type="submit">Sign in to dashboard <span></span></button>
</form>
<div class="security-note"><span></span><p><strong>Protected administration area</strong><br>Your session is encrypted and access is restricted to authorized administrators.</p></div>
</div>
</section>
</main>
</body>
</html>

View File

@ -0,0 +1,77 @@
@extends('layouts.app')
@section('title', 'Admin Dashboard - UniformFlow')
@section('page-heading', 'Admin dashboard')
@section('content')
<section class="page-intro admin-intro">
<div>
<span class="eyebrow">{{ now()->format('l, d F Y') }}</span>
<h1>Operations at a <em>glance.</em></h1>
<p>Stock health, employee accountability, and handover performance in one place.</p>
</div>
<div class="quick-actions">
<a class="button subtle" href="{{ route('employees.index') }}">+ Add employee</a>
<a class="button subtle" href="{{ route('inventory.index') }}">+ Receive stock</a>
<a class="button primary" href="{{ route('issues.index') }}">+ Issue uniform</a>
</div>
</section>
<div class="stats-grid admin-stats">
<article class="stat-card mint"><span class="stat-icon">E</span><small>Active employees</small><strong>{{ number_format($activeEmployees) }}</strong><span class="stat-note">{{ $employeesWithIssues }} currently hold uniforms</span></article>
<article class="stat-card blue"><span class="stat-icon">S</span><small>Available stock</small><strong>{{ number_format($unitsInStock) }}</strong><span class="stat-note">Across {{ $uniformTypes }} uniform types</span></article>
<article class="stat-card amber"><span class="stat-icon">I</span><small>Units with employees</small><strong>{{ number_format($unitsIssued) }}</strong><span class="stat-note">{{ $issuedThisMonth }} issued this month</span></article>
<article class="stat-card rose"><span class="stat-icon">!</span><small>Stock alerts</small><strong>{{ $lowStock->count() }}</strong><span class="stat-note">{{ $outOfStock->count() }} sizes are out of stock</span></article>
</div>
<div class="admin-summary-grid">
<section class="panel health-panel">
<div class="panel-head"><div><span class="eyebrow">Inventory control</span><h2>Stock health</h2></div><strong class="health-score">{{ $stockHealth }}%</strong></div>
<div class="progress-track"><span style="width: {{ $stockHealth }}%"></span></div>
<div class="health-legend"><span><i class="good-dot"></i> Healthy sizes</span><span><i class="warn-dot"></i> At or below reorder level</span></div>
<div class="mini-metrics"><div><small>Uniform types</small><strong>{{ $uniformTypes }}</strong></div><div><small>Low stock</small><strong>{{ $lowStock->count() }}</strong></div><div><small>Out of stock</small><strong>{{ $outOfStock->count() }}</strong></div></div>
</section>
<section class="panel monthly-panel">
<div class="panel-head"><div><span class="eyebrow">This month</span><h2>Movement summary</h2></div></div>
<div class="monthly-metric"><span>Uniforms issued</span><strong>{{ $issuedThisMonth }}</strong></div>
<div class="monthly-metric"><span>Exit handovers completed</span><strong>{{ $handoversThisMonth }}</strong></div>
<div class="monthly-metric"><span>Reusable returns</span><strong>{{ $handoverOutcomes['reusable'] ?? 0 }}</strong></div>
<div class="monthly-metric danger-text"><span>Damaged or not returned</span><strong>{{ ($handoverOutcomes['damaged'] ?? 0) + ($handoverOutcomes['not_returned'] ?? 0) }}</strong></div>
</section>
</div>
<div class="dashboard-main-grid">
<section class="panel attention-panel">
<div class="panel-head"><div><span class="eyebrow">Action required</span><h2>Stock alerts</h2></div><a href="{{ route('inventory.index') }}">Manage stock</a></div>
@forelse($lowStock->take(7) as $variant)
<div class="list-row"><div class="item-symbol">{{ strtoupper(substr($variant->item->name, 0, 2)) }}</div><div class="grow"><strong>{{ $variant->item->name }}</strong><small>Size {{ $variant->size }} / reorder at {{ $variant->reorder_level }}</small></div><span class="pill {{ $variant->quantity === 0 ? 'danger' : 'warning' }}">{{ $variant->quantity }} available</span></div>
@empty<div class="empty">All size balances are above their reorder levels.</div>@endforelse
</section>
<section class="panel replacement-panel">
<div class="panel-head"><div><span class="eyebrow">Employee welfare</span><h2>Held over 12 months</h2></div><span class="pill {{ $replacementDue->count() ? 'warning' : 'good' }}">{{ $replacementDue->count() }} due</span></div>
@forelse($replacementDue as $issue)
<div class="list-row"><div class="person-avatar">{{ strtoupper(substr($issue->employee->name, 0, 1)) }}</div><div class="grow"><strong>{{ $issue->employee->name }}</strong><small>{{ $issue->variant->item->name }} / {{ $issue->variant->size }} / issued {{ $issue->issued_at->format('d M Y') }}</small></div><a class="text-link" href="{{ route('employees.show', $issue->employee) }}">Review</a></div>
@empty<div class="empty">No employee-held uniforms are over 12 months old.</div>@endforelse
</section>
</div>
<div class="dashboard-insights-grid">
<section class="panel">
<div class="panel-head"><div><span class="eyebrow">Accountability</span><h2>Issued by department</h2></div></div>
@php($maxDepartmentUnits = max(1, (int) ($departmentAllocation->max('units') ?? 1)))
@forelse($departmentAllocation as $department)
<div class="bar-row"><div><span>{{ $department->department }}</span><strong>{{ $department->units }}</strong></div><div class="bar-track"><i style="width: {{ round(($department->units / $maxDepartmentUnits) * 100) }}%"></i></div></div>
@empty<div class="empty">Department allocation appears after uniforms are issued.</div>@endforelse
</section>
<section class="panel">
<div class="panel-head"><div><span class="eyebrow">Demand planning</span><h2>Most issued uniforms</h2></div></div>
@forelse($popularUniforms as $index => $uniform)
<div class="rank-row"><span class="rank">{{ $index + 1 }}</span><div class="grow"><strong>{{ $uniform->name }}</strong><small>Total units issued</small></div><b>{{ $uniform->units }}</b></div>
@empty<div class="empty">Demand rankings appear after uniforms are issued.</div>@endforelse
</section>
<section class="panel">
<div class="panel-head"><div><span class="eyebrow">Audit trail</span><h2>Recent activity</h2></div></div>
@forelse($recentMovements->take(6) as $movement)
<div class="activity"><span class="activity-dot {{ $movement->quantity_change > 0 ? 'in' : 'out' }}"></span><div class="grow"><strong>{{ ucfirst(str_replace('_', ' ', $movement->type)) }} / {{ $movement->variant->item->name }}</strong><small>Size {{ $movement->variant->size }} / {{ $movement->created_at->diffForHumans() }}</small></div><b>{{ $movement->quantity_change > 0 ? '+' : '' }}{{ $movement->quantity_change }}</b></div>
@empty<div class="empty">Stock activity will appear here.</div>@endforelse
</section>
</div>
@endsection

View File

@ -0,0 +1,14 @@
@extends('layouts.app')
@section('title', 'Employees · UniformFlow')
@section('page-heading', 'Employees')
@section('content')
<section class="page-intro"><div><span class="eyebrow">People directory</span><h1>Employee <em>uniform records.</em></h1><p>Keep each employee and their issued items in one place.</p></div></section>
<div class="layout-aside">
<section class="panel"><div class="panel-head"><div><span class="eyebrow">Directory</span><h2>Employees</h2></div><form class="search"><input name="search" value="{{ request('search') }}" placeholder="Search name or ID"><button>Search</button></form></div>
<div class="table-wrap"><table><thead><tr><th>Employee</th><th>Department</th><th>Status</th><th>Open issues</th><th></th></tr></thead><tbody>
@forelse($employees as $employee)<tr><td><strong>{{ $employee->name }}</strong><small class="block">{{ $employee->employee_no }}</small></td><td>{{ $employee->department }}<small class="block">{{ $employee->designation }}</small></td><td><span class="pill {{ $employee->status === 'active' ? 'good' : '' }}">{{ ucfirst($employee->status) }}</span></td><td>{{ $employee->outstanding_items_count }}</td><td><a class="text-link" href="{{ route('employees.show', $employee) }}">View record </a></td></tr>@empty<tr><td colspan="5" class="empty">No employees found.</td></tr>@endforelse
</tbody></table></div><div class="pagination">{{ $employees->links() }}</div></section>
<aside class="panel sticky"><div class="panel-head"><div><span class="eyebrow">New starter</span><h2>Add employee</h2></div></div><form method="POST" action="{{ route('employees.store') }}" class="form-stack">@csrf
<label>Employee ID<input name="employee_no" required value="{{ old('employee_no') }}" placeholder="EMP-001"></label><label>Full name<input name="name" required value="{{ old('name') }}" placeholder="Employee name"></label><label>Department<input name="department" required value="{{ old('department') }}" placeholder="Operations"></label><label>Designation<input name="designation" value="{{ old('designation') }}" placeholder="Role or title"></label><label>Joined date<input type="date" name="joined_at" value="{{ old('joined_at') }}"></label><button class="button primary" type="submit">Add employee</button></form></aside>
</div>
@endsection

View File

@ -0,0 +1,9 @@
@extends('layouts.app')
@section('title', $employee->name.' · UniformFlow')
@section('page-heading', 'Employee record')
@section('content')
<section class="page-intro"><div><a class="back" href="{{ route('employees.index') }}"> Employees</a><span class="eyebrow">{{ $employee->employee_no }}</span><h1>{{ $employee->name }}</h1><p>{{ $employee->designation ?: 'Employee' }} · {{ $employee->department }}</p></div>@if($employee->status === 'active' && $employee->issues->where('status','issued')->count())<a class="button danger-button" href="{{ route('handovers.create', $employee) }}">Start exit handover</a>@endif</section>
<div class="profile-strip"><div><small>Status</small><strong><span class="status-dot"></span>{{ ucfirst($employee->status) }}</strong></div><div><small>Joined</small><strong>{{ $employee->joined_at?->format('d M Y') ?? 'Not recorded' }}</strong></div><div><small>Left</small><strong>{{ $employee->left_at?->format('d M Y') ?? '—' }}</strong></div><div><small>Issued units</small><strong>{{ $employee->issues->where('status','issued')->sum(fn($i) => $i->outstanding_quantity) }}</strong></div></div>
<section class="panel table-panel"><div class="panel-head"><div><span class="eyebrow">Accountability</span><h2>Uniform issue history</h2></div></div><div class="table-wrap"><table><thead><tr><th>Issued</th><th>Uniform</th><th>Size</th><th>Qty</th><th>Status</th><th>Notes</th></tr></thead><tbody>
@forelse($employee->issues->sortByDesc('issued_at') as $issue)<tr><td>{{ $issue->issued_at->format('d M Y') }}</td><td><strong>{{ $issue->variant->item->name }}</strong></td><td><span class="size-badge">{{ $issue->variant->size }}</span></td><td>{{ $issue->quantity }}</td><td><span class="pill {{ $issue->status === 'issued' ? 'warning' : 'good' }}">{{ str_replace('_',' ', ucfirst($issue->status)) }}</span></td><td>{{ $issue->notes ?: '—' }}</td></tr>@empty<tr><td colspan="6" class="empty">No uniforms have been issued.</td></tr>@endforelse</tbody></table></div></section>
@endsection

View File

@ -0,0 +1,12 @@
@extends('layouts.app')
@section('title', 'Handover '.$employee->name.' · UniformFlow')
@section('page-heading', 'Complete handover')
@section('content')
<section class="page-intro"><div><a class="back" href="{{ route('handovers.index') }}"> Exit handovers</a><span class="eyebrow">{{ $employee->employee_no }} · {{ $employee->department }}</span><h1>Clear {{ $employee->name }}.</h1><p>Choose the final outcome for every outstanding issue.</p></div></section>
<form method="POST" action="{{ route('handovers.store',$employee) }}">@csrf
<section class="panel"><div class="panel-head"><div><span class="eyebrow">Outstanding property</span><h2>{{ $employee->issues->sum(fn($i) => $i->outstanding_quantity) }} units to account for</h2></div></div>
@forelse($employee->issues as $index => $issue)<div class="handover-item"><div class="item-symbol">{{ strtoupper(substr($issue->variant->item->name,0,2)) }}</div><div class="grow"><strong>{{ $issue->variant->item->name }}</strong><small>Size {{ $issue->variant->size }} · {{ $issue->outstanding_quantity }} unit(s) · Issued {{ $issue->issued_at->format('d M Y') }}</small></div><input type="hidden" name="items[{{ $index }}][issue_id]" value="{{ $issue->id }}"><label>Outcome<select name="items[{{ $index }}][condition]" required><option value="reusable">Returned · reusable (add to stock)</option><option value="damaged">Returned · damaged (do not add)</option><option value="not_returned">Not returned (do not add)</option></select></label></div>@empty<div class="empty">There are no outstanding uniforms for this employee.</div>@endforelse
</section>
@if($employee->issues->count())<section class="panel handover-confirm"><div class="form-grid"><label>Last working / handover date<input type="date" name="handover_date" value="{{ old('handover_date',now()->toDateString()) }}" required></label><label>Clearance note<input name="notes" value="{{ old('notes') }}" placeholder="Optional notes"></label></div><div class="warning-box"><strong>This completes employee clearance.</strong><span>The employee will be marked as left. Reusable items will return to stock.</span></div><button class="button danger-button" type="submit" onclick="return confirm('Complete this handover and mark the employee as left?')">Complete handover</button></section>@endif
</form>
@endsection

View File

@ -0,0 +1,9 @@
@extends('layouts.app')
@section('title', 'Exit handovers · UniformFlow')
@section('page-heading', 'Exit handovers')
@section('content')
<section class="page-intro"><div><span class="eyebrow">Employee clearance</span><h1>Uniform <em>handover.</em></h1><p>Account for issued uniforms and close an employees record safely.</p></div></section>
<section class="panel handover-start"><div><span class="eyebrow">Start clearance</span><h2>Select a departing employee</h2><p>Only active employees with outstanding uniform issues are shown.</p></div><form onsubmit="if(this.employee.value){window.location=this.employee.value} return false"><select name="employee" required><option value="">Choose an employee</option>@foreach($employees as $employee)<option value="{{ route('handovers.create',$employee) }}">{{ $employee->name }} · {{ $employee->employee_no }}</option>@endforeach</select><button class="button primary">Begin handover</button></form></section>
<section class="panel table-panel"><div class="panel-head"><div><span class="eyebrow">Clearance log</span><h2>Completed handovers</h2></div></div><div class="table-wrap"><table><thead><tr><th>Date</th><th>Employee</th><th>Items accounted</th><th>Outcome</th><th>Status</th></tr></thead><tbody>
@forelse($handovers as $handover)<tr><td>{{ $handover->handover_date->format('d M Y') }}</td><td><a class="text-link" href="{{ route('employees.show',$handover->employee) }}">{{ $handover->employee->name }}</a><small class="block">{{ $handover->employee->employee_no }}</small></td><td>{{ $handover->items->sum('quantity') }} units</td><td>@foreach($handover->items->groupBy('condition') as $condition => $items)<span class="pill">{{ $items->sum('quantity') }} {{ str_replace('_',' ',$condition) }}</span> @endforeach</td><td><span class="pill good">Completed</span></td></tr>@empty<tr><td colspan="5" class="empty">Completed employee handovers will appear here.</td></tr>@endforelse</tbody></table></div></section>
@endsection

View File

@ -0,0 +1,88 @@
@extends('layouts.app')
@section('title', 'Inventory - UniformFlow')
@section('page-heading', 'Inventory')
@section('content')
<section class="page-intro"><div><span class="eyebrow">Stock control</span><h1>Uniform <em>inventory.</em></h1><p>Create uniform types and manage stock for every size.</p></div></section>
<div class="two-column forms-top">
<section class="panel"><div class="panel-head"><div><span class="eyebrow">Catalogue</span><h2>Add uniform type</h2></div></div>
<form method="POST" action="{{ route('inventory.items.store') }}" class="form-grid">@csrf
<label>Item code<input name="code" required placeholder="SHIRT-NVY" value="{{ old('code') }}"></label><label>Uniform name<input name="name" required placeholder="Navy work shirt" value="{{ old('name') }}"></label>
<label class="full">Sizes <span>select all applicable sizes</span>
<details class="check-dropdown" id="size-dropdown"><summary><span id="size-summary">Select sizes</span><span class="dropdown-arrow">&#8964;</span></summary><div class="check-options">
@foreach(['XXS','XS','S','M','L','XL','2XL','3XL','4XL','26','28','30','32','34','36','38','40','42','44','46','48'] as $size)
<label><input type="checkbox" name="sizes[]" value="{{ $size }}" @checked(in_array($size, old('sizes', [])))><span class="checkmark">&#10003;</span><span>{{ $size }}</span></label>
@endforeach
</div></details></label><label>Low-stock level<input type="number" min="0" name="reorder_level" value="{{ old('reorder_level', 5) }}" required></label><label>Description<input name="description" placeholder="Optional notes" value="{{ old('description') }}"></label>
<button class="button primary full" type="submit">Add uniform & sizes</button></form></section>
<section class="panel"><div class="panel-head"><div><span class="eyebrow">Goods received</span><h2>Bulk add stock</h2></div></div>
<form method="POST" action="{{ route('inventory.restock') }}" class="form-grid">@csrf
<label class="full">Uniform name<select name="uniform_item_id" id="stock-item" required><option value="">Select uniform</option>@foreach($items as $item)<option value="{{ $item->id }}" @selected(old('uniform_item_id') == $item->id)>{{ $item->name }}</option>@endforeach</select></label>
<div class="full bulk-stock-picker">
<div class="bulk-picker-head"><span>Sizes and received quantities</span><b id="stock-selection-count">0 selected</b></div>
<div class="bulk-picker-placeholder" id="bulk-picker-placeholder">Select a uniform above to see its sizes.</div>
@foreach($items as $item)
<div class="bulk-size-group" data-item-id="{{ $item->id }}" hidden>
@foreach($item->variants as $variant)
@php($previousQuantity = old("stocks.{$variant->id}"))
<div class="bulk-size-row">
<label class="bulk-size-check"><input type="checkbox" class="stock-size-check" data-quantity-id="stock-qty-{{ $variant->id }}" @checked($previousQuantity !== null)><span class="checkmark">&#10003;</span><span><strong>{{ $variant->size }}</strong><small>{{ $variant->quantity }} currently available</small></span></label>
<label class="bulk-quantity">Received<input id="stock-qty-{{ $variant->id }}" type="number" name="stocks[{{ $variant->id }}]" min="1" max="100000" value="{{ $previousQuantity ?? 1 }}" @disabled($previousQuantity === null)></label>
</div>
@endforeach
</div>
@endforeach
</div>
<label class="full">Reference / note<input name="notes" value="{{ old('notes') }}" placeholder="PO number, supplier, delivery note..."></label><button class="button dark full" type="submit">Receive selected stock</button></form></section>
</div>
<section class="panel table-panel"><div class="panel-head"><div><span class="eyebrow">Live balances</span><h2>Stock by size</h2></div><span class="pill">{{ $items->sum(fn($i) => $i->variants->count()) }} size records</span></div>
<div class="table-wrap"><table><thead><tr><th>Uniform</th><th>Code</th><th>Size</th><th>Available</th><th>Reorder level</th><th>Status</th></tr></thead><tbody>
@forelse($items as $item)@foreach($item->variants as $variant)<tr><td><strong>{{ $item->name }}</strong></td><td>{{ $item->code }}</td><td><span class="size-badge">{{ $variant->size }}</span></td><td><strong>{{ $variant->quantity }}</strong></td><td>{{ $variant->reorder_level }}</td><td><span class="pill {{ $variant->quantity <= $variant->reorder_level ? ($variant->quantity === 0 ? 'danger' : 'warning') : 'good' }}">{{ $variant->quantity === 0 ? 'Out of stock' : ($variant->quantity <= $variant->reorder_level ? 'Low stock' : 'Healthy') }}</span></td></tr>@endforeach @empty<tr><td colspan="6" class="empty">Add your first uniform type above.</td></tr>@endforelse
</tbody></table></div></section>
<script>
document.addEventListener('DOMContentLoaded', () => {
const checkedSizes = () => [...document.querySelectorAll('input[name="sizes[]"]:checked')];
const updateSizeSummary = () => {
const selected = checkedSizes().map(input => input.value);
document.getElementById('size-summary').textContent = selected.length ? `${selected.length} selected: ${selected.join(', ')}` : 'Select sizes';
};
document.querySelectorAll('input[name="sizes[]"]').forEach(input => input.addEventListener('change', updateSizeSummary));
updateSizeSummary();
const itemSelect = document.getElementById('stock-item');
const groups = [...document.querySelectorAll('.bulk-size-group')];
const placeholder = document.getElementById('bulk-picker-placeholder');
const selectionCount = document.getElementById('stock-selection-count');
const updateSelectionCount = () => {
const activeGroup = groups.find(group => !group.hidden);
const selected = activeGroup ? activeGroup.querySelectorAll('.stock-size-check:checked').length : 0;
selectionCount.textContent = `${selected} selected`;
};
const updateStockSizes = () => {
groups.forEach(group => {
const active = group.dataset.itemId === itemSelect.value;
group.hidden = !active;
group.querySelectorAll('.stock-size-check').forEach(checkbox => {
if (!active) checkbox.checked = false;
const quantity = document.getElementById(checkbox.dataset.quantityId);
quantity.disabled = !active || !checkbox.checked;
quantity.required = active && checkbox.checked;
});
});
placeholder.hidden = itemSelect.value !== '';
updateSelectionCount();
};
document.querySelectorAll('.stock-size-check').forEach(checkbox => checkbox.addEventListener('change', () => {
const quantity = document.getElementById(checkbox.dataset.quantityId);
quantity.disabled = !checkbox.checked;
quantity.required = checkbox.checked;
if (checkbox.checked) quantity.focus();
updateSelectionCount();
}));
itemSelect.addEventListener('change', updateStockSizes);
updateStockSizes();
});
</script>
@endsection

View File

@ -0,0 +1,12 @@
@extends('layouts.app')
@section('title', 'Issue uniforms · UniformFlow')
@section('page-heading', 'Issue uniforms')
@section('content')
<section class="page-intro"><div><span class="eyebrow">Employee allocation</span><h1>Issue the <em>correct size.</em></h1><p>Available stock is shown beside every size and updates immediately.</p></div></section>
<section class="panel issue-form"><div class="panel-head"><div><span class="eyebrow">New issue</span><h2>Assign a uniform</h2></div></div><form method="POST" action="{{ route('issues.store') }}" class="form-grid issue-grid">@csrf
<label>Employee<select name="employee_id" required><option value="">Select employee</option>@foreach($employees as $employee)<option value="{{ $employee->id }}" @selected(old('employee_id') == $employee->id)>{{ $employee->name }} · {{ $employee->employee_no }}</option>@endforeach</select></label>
<label>Uniform and size<select name="stock_variant_id" required><option value="">Select an available size</option>@foreach($variants as $variant)<option value="{{ $variant->id }}" @selected(old('stock_variant_id') == $variant->id)>{{ $variant->item->name }} · Size {{ $variant->size }} {{ $variant->quantity }} available</option>@endforeach</select></label>
<label>Quantity<input type="number" min="1" name="quantity" value="{{ old('quantity', 1) }}" required></label><label>Issue date<input type="date" name="issued_at" value="{{ old('issued_at', now()->toDateString()) }}" required></label><label>Notes<input name="notes" value="{{ old('notes') }}" placeholder="Optional issue note"></label><button class="button primary" type="submit">Confirm issue</button></form></section>
<section class="panel table-panel"><div class="panel-head"><div><span class="eyebrow">Issue register</span><h2>Recent issues</h2></div></div><div class="table-wrap"><table><thead><tr><th>Date</th><th>Employee</th><th>Uniform</th><th>Size</th><th>Qty</th><th>Status</th></tr></thead><tbody>
@forelse($issues as $issue)<tr><td>{{ $issue->issued_at->format('d M Y') }}</td><td><a class="text-link" href="{{ route('employees.show',$issue->employee) }}">{{ $issue->employee->name }}</a><small class="block">{{ $issue->employee->employee_no }}</small></td><td><strong>{{ $issue->variant->item->name }}</strong></td><td><span class="size-badge">{{ $issue->variant->size }}</span></td><td>{{ $issue->quantity }}</td><td><span class="pill {{ $issue->status === 'issued' ? 'warning' : 'good' }}">{{ str_replace('_',' ', ucfirst($issue->status)) }}</span></td></tr>@empty<tr><td colspan="6" class="empty">No issue records yet.</td></tr>@endforelse</tbody></table></div><div class="pagination">{{ $issues->links() }}</div></section>
@endsection

View File

@ -0,0 +1,37 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>@yield('title', 'UniformFlow')</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Manrope:wght@700;800&display=swap" rel="stylesheet">
<link rel="stylesheet" href="{{ asset('css/app.css') }}">
<link rel="stylesheet" href="{{ asset('css/inventory.css') }}">
<link rel="stylesheet" href="{{ asset('css/dashboard.css') }}">
</head>
<body>
<div class="app-shell">
<aside class="sidebar">
<a class="brand" href="{{ route('dashboard') }}"><span class="brand-mark">UF</span><span>UniformFlow<small>Asset management</small></span></a>
<nav>
<a class="{{ request()->routeIs('dashboard') ? 'active' : '' }}" href="{{ route('dashboard') }}"> <span>Admin dashboard</span></a>
<a class="{{ request()->routeIs('inventory.*') ? 'active' : '' }}" href="{{ route('inventory.index') }}"> <span>Inventory</span></a>
<a class="{{ request()->routeIs('employees.*') ? 'active' : '' }}" href="{{ route('employees.index') }}"> <span>Employees</span></a>
<a class="{{ request()->routeIs('issues.*') ? 'active' : '' }}" href="{{ route('issues.index') }}"> <span>Issue uniforms</span></a>
<a class="{{ request()->routeIs('handovers.*') ? 'active' : '' }}" href="{{ route('handovers.index') }}"> <span>Exit handovers</span></a>
</nav>
<div class="sidebar-foot admin-account"><div class="admin-identity"><span class="status-dot"></span><div><strong>{{ auth()->user()->name }}</strong><small>{{ auth()->user()->email }}</small></div></div><form method="POST" action="{{ route('logout') }}">@csrf<button type="submit">Sign out</button></form></div>
</aside>
<main>
<header class="topbar"><button class="menu-button" onclick="document.body.classList.toggle('menu-open')"></button><div><span class="eyebrow">Operations portal</span><strong>@yield('page-heading', 'Overview')</strong></div><div class="avatar">{{ strtoupper(substr(auth()->user()->name, 0, 2)) }}</div></header>
<div class="content">
@if(session('success'))<div class="alert success"> {{ session('success') }}</div>@endif
@if($errors->any())<div class="alert error"><strong>Please check the following:</strong><ul>@foreach($errors->all() as $error)<li>{{ $error }}</li>@endforeach</ul></div>@endif
@yield('content')
</div>
</main>
</div>
</body>
</html>

File diff suppressed because one or more lines are too long

8
routes/console.php Normal file
View File

@ -0,0 +1,8 @@
<?php
use Illuminate\Foundation\Inspiring;
use Illuminate\Support\Facades\Artisan;
Artisan::command('inspire', function () {
$this->comment(Inspiring::quote());
})->purpose('Display an inspiring quote');

30
routes/web.php Normal file
View File

@ -0,0 +1,30 @@
<?php
use App\Http\Controllers\Auth\AdminLoginController;
use App\Http\Controllers\DashboardController;
use App\Http\Controllers\EmployeeController;
use App\Http\Controllers\HandoverController;
use App\Http\Controllers\InventoryController;
use App\Http\Controllers\IssueController;
use Illuminate\Support\Facades\Route;
Route::middleware('guest')->group(function () {
Route::get('/', [AdminLoginController::class, 'create'])->name('login');
Route::post('/login', [AdminLoginController::class, 'store'])->middleware('throttle:6,1')->name('login.store');
});
Route::middleware(['auth', 'admin'])->group(function () {
Route::get('/dashboard', DashboardController::class)->name('dashboard');
Route::post('/logout', [AdminLoginController::class, 'destroy'])->name('logout');
Route::get('/employees', [EmployeeController::class, 'index'])->name('employees.index');
Route::post('/employees', [EmployeeController::class, 'store'])->name('employees.store');
Route::get('/employees/{employee}', [EmployeeController::class, 'show'])->name('employees.show');
Route::get('/inventory', [InventoryController::class, 'index'])->name('inventory.index');
Route::post('/inventory/items', [InventoryController::class, 'storeItem'])->name('inventory.items.store');
Route::post('/inventory/restock', [InventoryController::class, 'restock'])->name('inventory.restock');
Route::get('/issues', [IssueController::class, 'index'])->name('issues.index');
Route::post('/issues', [IssueController::class, 'store'])->name('issues.store');
Route::get('/handovers', [HandoverController::class, 'index'])->name('handovers.index');
Route::get('/handovers/{employee}/create', [HandoverController::class, 'create'])->name('handovers.create');
Route::post('/handovers/{employee}', [HandoverController::class, 'store'])->name('handovers.store');
});

View File

4
storage/app/.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
*
!private/
!public/
!.gitignore

2
storage/app/private/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*
!.gitignore

2
storage/app/public/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*
!.gitignore

9
storage/framework/.gitignore vendored Normal file
View File

@ -0,0 +1,9 @@
compiled.php
config.php
down
events.scanned.php
maintenance.php
routes.php
routes.scanned.php
schedule-*
services.json

3
storage/framework/cache/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
*
!data/
!.gitignore

View File

@ -0,0 +1,2 @@
*
!.gitignore

2
storage/framework/sessions/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*
!.gitignore

2
storage/framework/testing/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*
!.gitignore

2
storage/framework/views/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*
!.gitignore

2
storage/logs/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*
!.gitignore

View File

@ -0,0 +1,59 @@
<?php
namespace Tests\Feature;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class AdminAuthenticationTest extends TestCase
{
use RefreshDatabase;
public function test_login_page_is_the_public_landing_page(): void
{
$this->get('/')
->assertOk()
->assertSee('Welcome back.')
->assertSee('Secure administrator access');
}
public function test_guests_are_redirected_to_login_from_admin_pages(): void
{
$this->get('/dashboard')->assertRedirect(route('login'));
$this->get('/inventory')->assertRedirect(route('login'));
}
public function test_admin_can_sign_in_and_reach_dashboard(): void
{
$admin = User::factory()->create([
'email' => 'admin@example.com',
'password' => 'secret-password',
'is_admin' => true,
]);
$this->post(route('login.store'), ['email' => $admin->email, 'password' => 'secret-password'])
->assertRedirect(route('dashboard'));
$this->assertAuthenticatedAs($admin);
}
public function test_non_admin_account_cannot_sign_in_to_admin_portal(): void
{
$user = User::factory()->create(['password' => 'secret-password', 'is_admin' => false]);
$this->post(route('login.store'), ['email' => $user->email, 'password' => 'secret-password'])
->assertSessionHasErrors('email');
$this->assertGuest();
$this->actingAs($user)->get('/dashboard')->assertForbidden();
}
public function test_admin_can_sign_out(): void
{
$admin = User::factory()->create(['is_admin' => true]);
$this->actingAs($admin)->post(route('logout'))->assertRedirect(route('login'));
$this->assertGuest();
}
}

View File

@ -0,0 +1,26 @@
<?php
namespace Tests\Feature;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class ExampleTest extends TestCase
{
use RefreshDatabase;
/**
* A basic test example.
*/
public function test_the_application_returns_a_successful_response(): void
{
$response = $this->actingAs(User::factory()->create(['is_admin' => true]))->get('/dashboard');
$response->assertStatus(200)
->assertSee('Admin dashboard')
->assertSee('Stock health')
->assertSee('Issued by department')
->assertSee('Recent activity');
}
}

View File

@ -0,0 +1,98 @@
<?php
namespace Tests\Feature;
use App\Models\Employee;
use App\Models\StockVariant;
use App\Models\UniformItem;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class UniformWorkflowTest extends TestCase
{
use RefreshDatabase;
protected function setUp(): void
{
parent::setUp();
$this->actingAs(User::factory()->create(['is_admin' => true]));
}
private function employee(): Employee
{
return Employee::create(['employee_no' => 'E-100', 'name' => 'Test Employee', 'department' => 'Operations']);
}
private function variant(int $quantity = 5): StockVariant
{
$item = UniformItem::create(['code' => 'TS-01', 'name' => 'Test Shirt']);
return $item->variants()->create(['size' => 'M', 'quantity' => $quantity, 'reorder_level' => 2]);
}
public function test_restock_increases_the_correct_size_balance(): void
{
$variant = $this->variant(3);
$this->post(route('inventory.restock'), ['uniform_item_id' => $variant->uniform_item_id, 'stocks' => [$variant->id => 4]])->assertSessionHasNoErrors();
$this->assertSame(7, $variant->fresh()->quantity);
$this->assertDatabaseHas('stock_movements', ['stock_variant_id' => $variant->id, 'type' => 'restock', 'quantity_change' => 4]);
}
public function test_uniform_type_is_created_with_selected_sizes(): void
{
$this->post(route('inventory.items.store'), [
'code' => 'JKT-01',
'name' => 'Work Jacket',
'sizes' => ['S', 'M', 'XL'],
'reorder_level' => 3,
])->assertSessionHasNoErrors();
$item = UniformItem::where('code', 'JKT-01')->firstOrFail();
$this->assertEqualsCanonicalizing(['S', 'M', 'XL'], $item->variants()->pluck('size')->all());
}
public function test_issuing_a_uniform_reduces_stock(): void
{
$employee = $this->employee();
$variant = $this->variant(5);
$this->post(route('issues.store'), ['employee_id' => $employee->id, 'stock_variant_id' => $variant->id, 'quantity' => 2, 'issued_at' => '2026-07-13'])->assertSessionHasNoErrors();
$this->assertSame(3, $variant->fresh()->quantity);
$this->assertDatabaseHas('uniform_issues', ['employee_id' => $employee->id, 'stock_variant_id' => $variant->id, 'quantity' => 2, 'status' => 'issued']);
}
public function test_issue_is_rejected_when_stock_is_insufficient(): void
{
$employee = $this->employee();
$variant = $this->variant(1);
$this->post(route('issues.store'), ['employee_id' => $employee->id, 'stock_variant_id' => $variant->id, 'quantity' => 2, 'issued_at' => '2026-07-13'])->assertSessionHasErrors('quantity');
$this->assertSame(1, $variant->fresh()->quantity);
}
public function test_exit_handover_returns_only_reusable_uniforms_to_stock(): void
{
$employee = $this->employee();
$variant = $this->variant(5);
$this->post(route('issues.store'), ['employee_id' => $employee->id, 'stock_variant_id' => $variant->id, 'quantity' => 2, 'issued_at' => '2026-07-13']);
$issue = $employee->issues()->first();
$this->post(route('handovers.store', $employee), ['handover_date' => '2026-07-14', 'items' => [['issue_id' => $issue->id, 'condition' => 'reusable']]])->assertSessionHasNoErrors();
$this->assertSame(5, $variant->fresh()->quantity);
$this->assertSame('left', $employee->fresh()->status);
$this->assertDatabaseHas('uniform_issues', ['id' => $issue->id, 'status' => 'returned', 'returned_quantity' => 2]);
}
public function test_damaged_handover_items_do_not_return_to_available_stock(): void
{
$employee = $this->employee();
$variant = $this->variant(5);
$this->post(route('issues.store'), ['employee_id' => $employee->id, 'stock_variant_id' => $variant->id, 'quantity' => 1, 'issued_at' => '2026-07-13']);
$issue = $employee->issues()->first();
$this->post(route('handovers.store', $employee), ['handover_date' => '2026-07-14', 'items' => [['issue_id' => $issue->id, 'condition' => 'damaged']]])->assertSessionHasNoErrors();
$this->assertSame(4, $variant->fresh()->quantity);
$this->assertSame('left', $employee->fresh()->status);
}
}

10
tests/TestCase.php Normal file
View File

@ -0,0 +1,10 @@
<?php
namespace Tests;
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
abstract class TestCase extends BaseTestCase
{
//
}

View File

@ -0,0 +1,16 @@
<?php
namespace Tests\Unit;
use PHPUnit\Framework\TestCase;
class ExampleTest extends TestCase
{
/**
* A basic test example.
*/
public function test_that_true_is_true(): void
{
$this->assertTrue(true);
}
}

13
vite.config.js Normal file
View File

@ -0,0 +1,13 @@
import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
import tailwindcss from '@tailwindcss/vite';
export default defineConfig({
plugins: [
laravel({
input: ['resources/css/app.css', 'resources/js/app.js'],
refresh: true,
}),
tailwindcss(),
],
});