You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/resources/views/ui/inc/getting_started.blade.php
+18-5Lines changed: 18 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -21,13 +21,25 @@
21
21
<p>To dig a little deeper, <ahref="#"data-bs-toggle="collapse"data-bs-target="#customizeUsersCRUD"data-toggle="collapse"data-target="#customizeUsersCRUD"aria-expanded="true"aria-controls="customizeUsersCRUD">let's make a few changes to the Users CRUD <iclass="la la-angle-double-right"></i></a></p>
22
22
23
23
<divclass="collapse"id="customizeUsersCRUD">
24
-
<p><strong>1. When Listing, let's remove the "password" column</strong> - no point in showing the hash. To do that, go to <codeclass="text-primary bg-light p-1 rounded">UserCrudController::setupListOperation()</code> and remove the line saying <codeclass="text-primary bg-light p-1 rounded">CRUD::column('password');</code> - easy-peasy, right?</p>
24
+
<p><strong>1. When listing, let's remove <code>setFromDb()</code> and define each column</strong>. To do that, navigate to <codeclass="text-primary bg-light p-1 rounded">UserCrudController::setupListOperation()</code> and remove the line that says <codeclass="text-primary bg-light p-1 rounded">setFromDb();</code> - Afterward, manually add the columns for <em>name</em> and <em>email</em>.</p>
<p><strong>2. On Create & Update, let's add validation to forms</strong>. There are <ahref="https://backpackforlaravel.com/docs/crud-operation-create#validation?ref=getting-started-widget"target="_blank">multiple ways to add validation</a> but we've already chosen the simplest, <ahref="https://backpackforlaravel.com/docs/crud-operation-create#validating-fields-using-field-attributes?ref=getting-started-widget"target="_blank">validation using field attributes</a>. Let's go to <codeclass="text-primary bg-light p-1 rounded">setupCreateOperation()</code> and specify our validation rules directly on the fields:
<p><strong>3. On Create, let's hash the password.</strong> 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 <ahref="https://backpackforlaravel.com/docs/crud-operation-create#use-events-in-your-setup-method?ref=getting-started-widget"target="_blank">multiple ways to achieve this too</a>. Let's use Model Events inside <codeclass="text-primary bg-light p-1 rounded">setupCreateOperation()</code>. Here's how our method could look, when we also tap into the <codeclass="text-primary bg-light p-1 rounded">creating</code> event, to hash the password:</p>
@@ -38,7 +50,7 @@ protected function setupCreateOperation()
// if you are using Laravel 10+ your User model should already include the password hashing in the model casts.
43
55
// if that's the case, you can skip this step. You can check your model $casts property or `casts()` method.
44
56
\App\Models\User::creating(function ($entry) {
@@ -114,6 +126,7 @@ protected function setupUpdateOperation()
114
126
<li><strong><atarget="_blank"href="https://backpackforlaravel.com/products/devtools?ref=getting-started-widget">DevTools</a></strong> - easily generate Laravel migrations and models, from a web interface</li>
115
127
<li><strong><atarget="_blank"href="https://backpackforlaravel.com/products/figma-template?ref=getting-started-widget">FigmaTemplate</a></strong> - create designs and mockups that are easy to implement in Backpack</li>
116
128
<li><strong><atarget="_blank"href="https://backpackforlaravel.com/products/editable-columns?ref=getting-started-widget">EditableColumns</a></strong> - let your admins make quick edits, right from the table view</li>
129
+
<li><strong><atarget="_blank"href="https://backpackforlaravel.com/products/calendar-operation?ref=getting-started-widget">CalendarOperation</a></strong> - let your admins see and manage model entries, directly on a calendar</li>
0 commit comments