Файл: app/Rules/WebsiteLimitGateRule.php
Строк: 28
<?php
namespace AppRules;
use IlluminateContractsValidationRule;
class WebsiteLimitGateRule implements Rule
{
/**
* @var
*/
private $user;
/**
* Create a new rule instance.
*
* @param $user
* @return void
*/
public function __construct($user)
{
$this->user = $user;
}
/**
* Determine if the validation rule passes.
*
* @param string $attribute
* @param mixed $value
* @return bool
*/
public function passes($attribute, $value)
{
if ($this->user->can('create', ['AppModelsWebsite'])) {
return true;
}
}
/**
* Get the validation error message.
*
* @return string
*/
public function message()
{
return __('You created too many websites.');
}
}