diff --git a/src/resources/views/ui/inc/getting_started.blade.php b/src/resources/views/ui/inc/getting_started.blade.php index 5ff070c30e..acb6e2a6f8 100644 --- a/src/resources/views/ui/inc/getting_started.blade.php +++ b/src/resources/views/ui/inc/getting_started.blade.php @@ -21,13 +21,25 @@
To dig a little deeper, let's make a few changes to the Users CRUD
1. When Listing, let's remove the "password" column - no point in showing the hash. To do that, go to UserCrudController::setupListOperation()
and remove the line saying CRUD::column('password');
- easy-peasy, right?
1. When listing, let's remove setFromDb()
and define each column. To do that, navigate to UserCrudController::setupListOperation()
and remove the line that says setFromDb();
- Afterward, manually add the columns for name and email.
+
+ protected function setupListOperation()
+ {
+ CRUD::column('name');
+ CRUD::column('email');
+ }
+
+
2. On Create & Update, let's add validation to forms. There are multiple ways to add validation but we've already chosen the simplest, validation using field attributes. Let's go to setupCreateOperation()
and specify our validation rules directly on the fields:
- CRUD::field('name')->validationRules('required|min:5');
- CRUD::field('email')->validationRules('required|email|unique:users,email');
- CRUD::field('password')->validationRules('required');
+ protected function setupCreateOperation()
+ {
+ CRUD::field('name')->validationRules('required|min:5');
+ CRUD::field('email')->validationRules('required|email|unique:users,email');
+ CRUD::field('password')->validationRules('required');
+ }
3. On Create, let's hash the password. Currently, if we create a new User, it'll work. But if you look in the database... you'll notice the password is stored in plain text. We don't want that - we want it hashed. There are multiple ways to achieve this too. Let's use Model Events inside setupCreateOperation()
. Here's how our method could look, when we also tap into the creating
event, to hash the password: