This commit is contained in:
Codex
2026-07-10 09:14:42 -05:00
parent e27fcc6c19
commit 63820994f8
55 changed files with 2195 additions and 86 deletions
+31
View File
@@ -0,0 +1,31 @@
<?php
use App\Models\JobPost;
use App\Models\ProviderProfile;
use App\Models\WorkOrder;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
Route::get('/providers', function () {
return ProviderProfile::with('user:id,name')->latest()->paginate(20);
});
Route::get('/jobs', function () {
return JobPost::with('buyer:id,name')->latest()->paginate(20);
});
Route::middleware('auth:sanctum')->group(function () {
Route::get('/me', function (Request $request) {
return $request->user()->load('roles', 'providerProfile', 'buyerProfile');
});
Route::get('/work-orders', function (Request $request) {
return WorkOrder::with('jobPost:id,title,location', 'buyer:id,name', 'provider:id,name')
->where(fn ($query) => $query
->where('buyer_id', $request->user()->id)
->orWhere('provider_id', $request->user()->id)
)
->latest()
->paginate(20);
});
});