User Management

The theme comes with an out of the box user management option. To access this option ,click the “Laravel Examples/User Management” link in the left sidebar or add /users to the URL. The first thing you will see is a list of existing users. You can add new ones by clicking the “Add user” button (above the table on the right). On the Add user page, you will find a form which allows you to fill out the user`s name, email, role and password. All pages are generated using blade templates:

<div class="col-md-12 mb-3">
    <div>
        <label for="name">{{__('Name')}}</label>
        <input wire:model="name" class="form-control @error('name') is-invalid @enderror" id="name"
            type="text" placeholder="Name" required>
    </div>
    @error('name') <div class="invalid-feedback">{{ $message }}</div> @enderror
</div>
    

Validation rules were added to prevent errors in the form fields (see App\Http\Livewire\NewUser.php). Note that these validation rules also apply for the user edit option.

protected function rules()
    {
        return [
            'email' => 'email|required|unique:users',
            'first_name' => 'max:15',
            'last_name' => 'max:20',
            'phone' => '',
            'status' => '',
            'role_id' => ['required', Rule::in(collect(DB::table('roles')->pluck('id')))],
            'password' => 'required|min:6|same:passwordConfirmation',
            'upload' => 'nullable|image|max:5000'
        ];
}