|
@@ -3,6 +3,7 @@
|
|
|
namespace App\Http\Requests\API\Task;
|
|
|
|
|
|
use App\Http\Requests\RuleHelper;
|
|
|
+use function DragonCode\Support\Http\exists;
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
use Illuminate\Validation\Rule;
|
|
|
|
|
@@ -30,6 +31,15 @@ class BatchCreateRequest extends FormRequest
|
|
|
'required',
|
|
|
Rule::exists('projects', 'id')->where($this->userCompanyWhere()),
|
|
|
],
|
|
|
+ 'parent_id' => [
|
|
|
+ 'required',
|
|
|
+ Rule::when(
|
|
|
+ $this->get('parent_id') != 0,
|
|
|
+ Rule::exists('tasks', 'id')->where(function ($query) {
|
|
|
+ $this->userCompanyWhere($query);
|
|
|
+ })
|
|
|
+ ),
|
|
|
+ ],
|
|
|
'items' => [
|
|
|
'required', 'array'
|
|
|
]
|