changes to sms packages and option to create user

This commit is contained in:
Simon Pocrnjič
2025-11-06 21:54:07 +01:00
parent ad8e0d5cee
commit 1395b72ae8
102 changed files with 1386 additions and 319 deletions
@@ -0,0 +1,52 @@
<?php
namespace App\Http\Requests\Admin;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Gate;
use Illuminate\Validation\Rules\Password;
class StoreUserRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return Gate::allows('manage-settings');
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
'name' => ['required', 'string', 'max:255'],
'email' => ['required', 'string', 'email', 'max:255', 'unique:users,email'],
'password' => ['required', 'string', Password::defaults(), 'confirmed'],
'roles' => ['array'],
'roles.*' => ['integer', 'exists:roles,id'],
];
}
/**
* Get custom error messages.
*
* @return array<string, string>
*/
public function messages(): array
{
return [
'name.required' => 'Ime uporabnika je obvezno.',
'email.required' => 'E-poštni naslov je obvezen.',
'email.email' => 'E-poštni naslov mora biti veljaven.',
'email.unique' => 'Ta e-poštni naslov je že v uporabi.',
'password.required' => 'Geslo je obvezno.',
'password.confirmed' => 'Gesli se ne ujemata.',
'roles.*.exists' => 'Izbrana vloga ni veljavna.',
];
}
}
+1 -1
View File
@@ -17,7 +17,7 @@ public function rules(): array
'name' => ['required', 'string', 'max:50'],
'description' => ['nullable', 'string', 'max:255'],
'active' => ['boolean'],
'exclude' => ['boolean']
'exclude' => ['boolean'],
];
}