2022-05-31 14:06:07 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Policies;
|
|
|
|
|
|
2023-08-14 09:23:39 +00:00
|
|
|
use App\Enums\Credit\EstimationStatusEnum;
|
|
|
|
|
use App\Models\Credit\Estimation;
|
2022-05-31 14:06:07 +02:00
|
|
|
use Illuminate\Auth\Access\HandlesAuthorization;
|
2023-08-14 09:23:39 +00:00
|
|
|
use App\Models\User;
|
2022-05-31 14:06:07 +02:00
|
|
|
|
2023-08-14 09:23:39 +00:00
|
|
|
class EstimationPolicy
|
2022-05-31 14:06:07 +02:00
|
|
|
{
|
|
|
|
|
use HandlesAuthorization;
|
|
|
|
|
|
|
|
|
|
/**
|
2023-08-14 09:23:39 +00:00
|
|
|
* Determine if the user can answer an estimation.
|
2022-05-31 14:06:07 +02:00
|
|
|
*
|
2023-08-14 09:23:39 +00:00
|
|
|
* @param \App\Models\User $user
|
|
|
|
|
* @param \App\Models\Credit\Estimation $estimation
|
|
|
|
|
* @return boolean
|
|
|
|
|
* @phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter
|
2022-05-31 14:06:07 +02:00
|
|
|
*/
|
2025-04-08 11:47:49 +02:00
|
|
|
public function answer(User $user, Estimation $estimation): bool
|
2022-05-31 14:06:07 +02:00
|
|
|
{
|
2022-08-30 13:21:07 +00:00
|
|
|
// phpcs:enable
|
2023-08-14 09:23:39 +00:00
|
|
|
return $estimation->status->equals(EstimationStatusEnum::pending);
|
2022-05-31 14:06:07 +02:00
|
|
|
}
|
|
|
|
|
}
|