60 lines
1.9 KiB
PHP
60 lines
1.9 KiB
PHP
<?php
|
|
|
|
use App\Charts\ExampleChart;
|
|
use App\Http\Controllers\ClientController;
|
|
use App\Http\Controllers\ContractController;
|
|
use App\Models\Person\Person;
|
|
use ArielMejiaDev\LarapexCharts\LarapexChart;
|
|
use Illuminate\Foundation\Application;
|
|
use Illuminate\Support\Facades\Route;
|
|
use Inertia\Inertia;
|
|
|
|
Route::get('/', function () {
|
|
return Inertia::render('Welcome', [
|
|
'canLogin' => Route::has('login'),
|
|
'canRegister' => Route::has('register'),
|
|
'laravelVersion' => Application::VERSION,
|
|
'phpVersion' => PHP_VERSION,
|
|
]);
|
|
});
|
|
|
|
//Route::get('/person', [PersonController::class, 'index'])->middleware('auth:sanctum',config('jetstream.auth_session'), 'verified');
|
|
|
|
Route::middleware([
|
|
'auth:sanctum',
|
|
config('jetstream.auth_session'),
|
|
'verified',
|
|
])->group(function () {
|
|
Route::get('/dashboard', function () {
|
|
$person = new Person();
|
|
$chart = new ExampleChart(new LarapexChart());
|
|
$clients = $person::with(['group','type'])
|
|
->whereHas('group', fn($que) => $que->where('deleted','=',0))
|
|
->whereHas('type', fn($que) => $que->where('deleted','=',0))
|
|
->where([
|
|
['person.active','=',1],
|
|
['person.group_id','=',1]
|
|
])
|
|
->limit(10)
|
|
->orderBy('id', 'desc')
|
|
->get();
|
|
|
|
return Inertia::render(
|
|
'Dashboard',
|
|
[
|
|
'chart' => $chart->build(),
|
|
'clients' => $clients
|
|
]
|
|
);
|
|
})->name('dashboard');
|
|
|
|
//client
|
|
Route::get('client', [ClientController::class, 'index'])->name('client');
|
|
Route::get('client/{uuid}', [ClientController::class, 'show'])->name('client.show');
|
|
Route::post('client', [ClientController::class, 'store'])->name('client.store');
|
|
|
|
//contract
|
|
Route::Post('contract', [ContractController::class, 'store'])->name('contract.store');
|
|
|
|
});
|