This article is the first in a series covering the management of roles and permissions in Laravel using the Laratrust package. As part of this series we will build a simple blog using the CKEditor, we will learn how to apply Laratrust in managing users on the website and how to use Laratrust’s team feature. This article, however will cover setting up your database, Laratrust and the CKEditor. Follow the steps below and you will be ready to go:
1. Create a new Laravel project
We will name our Laravel project blog. To create it, we open our command line, navigate to the folder we wish to store our project in and run the following line:
composer create-project laravel/laravel blog
Run the following line to navigate into the folder:
Don’t forget to update your .env file with the appropriate database name.
2. Setup your basic authentication system with Laravel Breeze
Laravel 8 provides three free authentication starter packages: Laravel Breeze, Laravel Jetstream, and Laravel Fortify. For this tutorial, we will be using Laravel Breeze. Feel free to use whichever you want. It should not make a difference for what we need to do here.
To setup Laravel Breeze, run the following lines in the order they appear on your command line:
composer require laravel/breeze --devphp artisan breeze:installnpm installnpm run devphp artisan migrate
Running the following lines in your browser will create an authentication system for one type of user.
3. Install Laratrust on your website
Run the following lines on your command line to set up laratrust
composer require santigarcor/laratrustphp artisan vendor:publish --tag="laratrust"php artisan config:clearphp artisan laratrust:setupcomposer dump-autoloadphp artisan migrate:fresh
4. Acquire CKEditor 5 CDN
The CKEditor will be used later when we create our views. It’s pasted below.