35 lines
781 B
PHP
35 lines
781 B
PHP
<?php
|
|
|
|
namespace App\Policies\Rules;
|
|
|
|
use App\Models\Invoice;
|
|
use Kwaadpepper\CrudPolicies\Policies\Rules\StaticRules;
|
|
|
|
/**
|
|
* Invoice Policiy Static Rules
|
|
* ! Rules has to return boolean value
|
|
*/
|
|
abstract class InvoiceStaticRules extends StaticRules
|
|
{
|
|
/**
|
|
* Invoice has not been sent ot the client
|
|
*
|
|
* @param \App\Models\Invoice $model
|
|
* @return boolean
|
|
*/
|
|
protected static function invoiceHasNotBeenSentTotheClient(Invoice $model): bool
|
|
{
|
|
return \is_null($model->sent_client_date);
|
|
}
|
|
|
|
/**
|
|
* Invoice has some tasks
|
|
*
|
|
* @param \App\Models\Invoice $model
|
|
* @return boolean
|
|
*/
|
|
protected static function invoiceHasTasks(Invoice $model): bool
|
|
{
|
|
return (bool)\count($model->tasks);
|
|
}
|
|
}
|