25 lines
560 B
PHP
25 lines
560 B
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Bo;
|
|
|
|
use Illuminate\Support\Facades\Auth;
|
|
|
|
class UpdateTicket extends StoreTicket
|
|
{
|
|
/**
|
|
* Determine if the user is authorized to make this request.
|
|
*
|
|
* @return boolean
|
|
*/
|
|
public function authorize(): bool
|
|
{
|
|
/** @var \App\Models\User|null $user */
|
|
$user = Auth::user();
|
|
if (!($user)) {
|
|
return false;
|
|
}
|
|
return Auth::check() and ($user->isAdmin() or
|
|
optional(request()->route()->ticket)->created_by === $user->id
|
|
);
|
|
}
|
|
}
|