Laravel 10.x + Backpack + Github Codespaces
To proceed you should have:
- wish to try new things
- Github account
Note: There is an older version of this tutorial
#STEP 1: Create the codespace instance
Open https://github.com/FMI-VT/plain-php-codespace and click on ‘Create codespace on main’.
Then the screen will be transformed to
If you want to see more details you could click on ‘view logs’.
#STEP 2: Create Laravel project
composer create-project laravel/laravel example-app
When you run the code above you will see how composer will install everything for you.
The final result is the message ‘Application key set successfully’.
#STEP 3: Start the web server
php artisan serve
When you execute the code, a pop-up will be shown on the bottom right. When you click on ‘Open in Browser’ you will see the expected result.
#STEP 4: Install Backpack
We are using Backpack for teaching purposes. For the last several years it has proven to be the fastest and easiest way to introduce admin to students.
Check whether DB service is running.
service mariadb status
If the service is missing, we could install it.
apt-get update && apt-get install -y mariadb-server php8.2-mysqli mariadb-client
Note: If you don’t have a database you need to have it created
CREATE DATABASE laravel;
CREATE USER 'user'@'%' IDENTIFIED BY 'user';
GRANT ALL PRIVILEGES ON *.* TO 'user'@'%' WITH GRANT OPTION;
Note: If you have a different DB name and user/password these need to be updated in the .env file
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=laravel
DB_USERNAME=user
DB_PASSWORD=user
When you want to install a backpack you need to run.
composer require backpack/crud
or add this to your composer.json file
"backpack/crud": "6.3.1",
Note: There is a chance that the version that you running is not compatible with the latest stable version of backpack crud.
Once the composer finishes you need to run
php artisan backpack:install