mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-06-06 20:37:32 +00:00
48 lines
1.1 KiB
PHP
48 lines
1.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Http\Requests\V1\Organization;
|
|
|
|
use App\Models\Organization;
|
|
use Illuminate\Contracts\Validation\ValidationRule;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
/**
|
|
* @property Organization $organization Organization from model binding
|
|
*/
|
|
class OrganizationUpdateRequest extends FormRequest
|
|
{
|
|
/**
|
|
* Get the validation rules that apply to the request.
|
|
*
|
|
* @return array<string, array<string|ValidationRule>>
|
|
*/
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'name' => [
|
|
'required',
|
|
'string',
|
|
'max:255',
|
|
],
|
|
'billable_rate' => [
|
|
'nullable',
|
|
'integer',
|
|
'min:0',
|
|
'max:2147483647',
|
|
],
|
|
'employees_can_see_billable_rates' => [
|
|
'boolean',
|
|
],
|
|
];
|
|
}
|
|
|
|
public function getBillableRate(): ?int
|
|
{
|
|
$input = $this->input('billable_rate');
|
|
|
|
return $input !== null && $input !== 0 ? (int) $this->input('billable_rate') : null;
|
|
}
|
|
}
|