mirror of
https://github.com/Einundzwanzig-Podcast/einundzwanzig-portal.git
synced 2025-12-11 06:46:47 +00:00
34 lines
696 B
PHP
34 lines
696 B
PHP
<?php
|
|
|
|
namespace JoeDixon\Translation\Rules;
|
|
|
|
use Illuminate\Contracts\Validation\Rule;
|
|
use JoeDixon\Translation\Drivers\Translation;
|
|
|
|
class LanguageNotExists implements Rule
|
|
{
|
|
/**
|
|
* Determine if the validation rule passes.
|
|
*
|
|
* @param string $attribute
|
|
* @param mixed $value
|
|
* @return bool
|
|
*/
|
|
public function passes($attribute, $value)
|
|
{
|
|
$translation = app()->make(Translation::class);
|
|
|
|
return ! $translation->languageExists($value);
|
|
}
|
|
|
|
/**
|
|
* Get the validation error message.
|
|
*
|
|
* @return string
|
|
*/
|
|
public function message()
|
|
{
|
|
return __('translation::translation.language_exists');
|
|
}
|
|
}
|