mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-08-09 16:52:17 +01:00
Added client and organization endpoints
This commit is contained in:
@@ -4,9 +4,16 @@ declare(strict_types=1);
|
||||
|
||||
namespace App\Http\Requests\V1\Project;
|
||||
|
||||
use App\Models\Client;
|
||||
use App\Models\Organization;
|
||||
use Illuminate\Contracts\Validation\ValidationRule;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Korridor\LaravelModelValidationRules\Rules\ExistsEloquent;
|
||||
|
||||
/**
|
||||
* @property Organization $organization Organization from model binding
|
||||
*/
|
||||
class ProjectUpdateRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
@@ -27,6 +34,13 @@ class ProjectUpdateRequest extends FormRequest
|
||||
'string',
|
||||
'max:255',
|
||||
],
|
||||
'client_id' => [
|
||||
'nullable',
|
||||
new ExistsEloquent(Client::class, null, function (Builder $builder): Builder {
|
||||
/** @var Builder<Client> $builder */
|
||||
return $builder->whereBelongsTo($this->organization, 'organization');
|
||||
}),
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user