49 lines
1.1 KiB
PHP
49 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Bo\Tenants;
|
|
|
|
use App\Models\Tenant;
|
|
use App\Traits\Requests\HasPicture;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
use Illuminate\Support\Facades\Gate;
|
|
|
|
class StoreTenantRequest extends FormRequest
|
|
{
|
|
use HasPicture;
|
|
|
|
/**
|
|
* Determine if the user is authorized to make this request.
|
|
*
|
|
* @return boolean
|
|
*/
|
|
public function authorize(): bool
|
|
{
|
|
return Gate::check('create', Tenant::class);
|
|
}
|
|
|
|
/**
|
|
* Get the validation rules that apply to the request.
|
|
*
|
|
* @return array<string, string>
|
|
*/
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'theme' => 'required|string|min:3|max:255|unique:tenants,theme',
|
|
'domain' => 'required|string|min:3|max:255|unique:domains,domain',
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Get custom attributes for validator errors.
|
|
*
|
|
* @return array<string, string>
|
|
*/
|
|
public function attributes(): array
|
|
{
|
|
return [
|
|
'theme' => trans('validation.custom.theme'),
|
|
'domain' => trans('validation.custom.domain'),
|
|
];
|
|
}
|
|
}
|