Overview
- Part 1: Walk-through installing and configuring Laravel
- Part 2: Create the core models/tables, controllers, and views
- Part 3: Authentication/Login
- Part 4: Post CRUD
- Part 5: Comment CRUD
- Part 6: Validation
- Part 7: Testing
Install the UI theme
We are going to make use of the laravel/ui utilities to get a basic style and authentication setup in place.
- Install the utility
./vendor/bin/sail composer require laravel/ui
- Load the
bootstrap
UI along with the authentication controllers/views
./vendor/bin/sail artisan ui bootstrap --auth
Build the JS/CSS
- Install the npm packages that will allow us to build the CSS/JS
./vendor/bin/sail npm install
- Build the compiled CSS/JS so the front-end has files to load. You may see broken styling if this is not done.
./vendor/bin/sail npm run prod
It will wipe out the app.blade.php we had set up before. That is OK.
The [layouts/app.blade.php] view already exists. Do you want to replace it? (yes/no) [no]: > yes
Clean up default files
Some welcome
blade files and routes are automatically generated that we'll clean up.
- Remove the
resources/views/welcome.blade.php
file. We'll replace it with the new blade file created by usinglaravel/ui
.
git rm resources/views/welcome.blade.php
- Update the
/
route inroutes/web.php
to point to thehome.blade.php
file.
Create the admin account
If you load the site, http://localhost:6001, you'll now see Log in
and Register
in the top right of the page. Click Register
and fill it out. We will turn this into your admin account.
We don't have an admin interface to work with users, so for now we'll manually adjust it from SQL.
- Connect to mysql
./vendor/bin/sail mysql
- Run the SQL to set your role to
admin
UPDATE users SET role='admin' where ID='1';
Roundup
That's it for now. Part 4 will go through adding controllers/views to manage blog posts now that we have an admin
user.
Next: Post CRUD