-
app/Policies/OfficePolicy.php
Open in GitHubuse App\Models\Office; use App\Models\User; use Illuminate\Auth\Access\HandlesAuthorization; class OfficePolicy { use HandlesAuthorization; public function update(User $user, Office $office) { return $user->id == $office->user_id; } public function delete(User $user, Office $office) { return $user->id == $office->user_id; } }
-
app/Http/Controllers/OfficeController.php
Open in GitHubuse App\Models\Office; use Illuminate\Http\Resources\Json\JsonResource; class OfficeController extends Controller { // public function update(Office $office): JsonResource { // $this->authorize('update', $office); // } // }