This repository is a copy of the simple PHP/Laravel CMS except the CMS views have been converted from vanilla PHP to Blade.
For these instructions I'm going to us MAMP as my development environment. But you could upload this application to a host, deploy using Docker, or the Laravel built in server.
To set up this CMS follow these steps:
- Using your Terminal (or Git Bash on Windows), navigate to your working folder:
$ cd <FOLDER_NAME>
$ ls
Note: On a Wiindows machine use dir
to view the files in the current folder:
$ dir
- Clone this repo:
$ git clone https://github.com/codeadamca/laravel-blade-cms.git
- Using the Terminal, use
ls
on a Mac otdir
on a Windows machine to view the files in the current directory:
You should now see a folder named laravel-blade-cms
. Change the present working directory to your new folder:
$ cd laravel-blade-cms
- Using the Terminal (or Git Bash), run
composer update
:
$ composer update
- We need to setup the database connection.
Using MAMP and phpMyAdmin, create a new databse.
Make a copy the .env.sample
file and name it .env
. Update the new .env
file with your database credentials:
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=<DATABASE_NAME>
DB_USERNAME=root
DB_PASSWORD=root
On a Mac I also need to define the socket. Under DB_PASSWORD
I'm going to add:
DB_SOCKET=/Applications/MAMP/tmp/mysql/mysql.sock
Your socket setting may be different. When your MAMP server is up and running, open the MAMP start page (http://:8888/MAMP), go to the MySQL tab, and your socket location will be listed:
The database setup included with this applications includes migrations and seeding. Run the following command to create the required tables and seed them with testing data:
$ php artisan migrate:refresh --seed
- Update your
.env
file to use thepublic
file system:
FILESYSTEM_DRIVER=public
And then run this command using the Terminal:
$ php artisan storage:link
- Opne up your MAMP preferences and set the document root to the
public
folder in yourlaravel-blade-cms
folder:
Restart MAMP.
- Using a Terminal, create an app key:
php artisan key:generate
-
Test!
-
To log in to the admin, use the URL http://localhost:8888/console/login. You will need to look up the email addresses in the
user
table and the default password is "password".
- Visual Studio Code or Brackets (or any code editor)
- Laravel
Full tutorial URL: https://codeadam.ca/learning/php-cms-laravel.html