Laravel 9.x + Backpack — CRUD for tags

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

# 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.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store