27 lines
686 B
PHP
27 lines
686 B
PHP
<?php
|
|
|
|
namespace App\Policies;
|
|
|
|
use App\Enums\Credit\EstimationStatusEnum;
|
|
use App\Models\Credit\Estimation;
|
|
use Illuminate\Auth\Access\HandlesAuthorization;
|
|
use App\Models\User;
|
|
|
|
class EstimationPolicy
|
|
{
|
|
use HandlesAuthorization;
|
|
|
|
/**
|
|
* Determine if the user can answer an estimation.
|
|
*
|
|
* @param \App\Models\User $user
|
|
* @param \App\Models\Credit\Estimation $estimation
|
|
* @return boolean
|
|
* @phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter
|
|
*/
|
|
public function answer(User $user, Estimation $estimation)
|
|
{
|
|
// phpcs:enable
|
|
return $estimation->status->equals(EstimationStatusEnum::pending);
|
|
}
|
|
}
|