Последняя версия с сервера прошлого разработчика

This commit is contained in:
2025-07-10 04:35:51 +00:00
commit c731570032
1174 changed files with 134314 additions and 0 deletions

58
app/Rules/LoadedMedia.php Executable file
View File

@@ -0,0 +1,58 @@
<?php
namespace App\Rules;
use Illuminate\Contracts\Validation\ImplicitRule;
use Illuminate\Foundation\Http\FormRequest;
// use Illuminate\Contracts\Validation\Rule;
class LoadedMedia implements ImplicitRule
{
public $request;
public function __construct(FormRequest $request)
{
$this->request = $request;
}
/**
* Determine if the validation rule passes.
*
* @param string $attribute
* @param mixed $value
* @return bool
*/
public function passes($attribute, $value)
{
if(is_array($value)){
return true;
}
$total = $this->request->totalItems ?? -1;
$removeCount = $this->request->removedItems ?? [];
if($total === count($removeCount)){
return false;
}
if($total < 0 && $value === null){
return false;
}
return true;
}
/**
* Get the validation error message.
*
* @return string
*/
public function message()
{
return 'Поле медиа обязательно для заполнения!';
}
}