Laravel 9.x + Backpack — CRUD for tags

Lyubomir Filipov
2 min readNov 27, 2022

In order to proceed you should have:
- Laravel installed + Backpack admin (teaching purposes)
- virtual host ready for you
- xampp setup or other web server
- composer installed
- you have follow this tutorial (you have tags table created and migration has run)

# STEP 1. Create crud

php artisan backpack:crud tag

After this command has run the output is

Artisan has created for us

  • model
  • controller
  • request
  • registered the route in the routes
  • updated the view with the new icon

# STEP 2. Alter requests file

Open TagRequest.php located in app/Http/Requests folder

Edit the rules method by adding extra validations.

 /**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'name' => 'required|min:5|max:255',
'slug' => 'required|min:5|max:255'
];
}

List of all available rules in Laravel could be found here.

In our case we are adding a requirement for name and slug to be mandatory.

Well, we are ready. It is that easy.

--

--

Lyubomir Filipov

Group Architect at FFW, believer, developer, enthusiast