Tutorials · 5 min read

laravel 8 logo

Troubleshooting tips for your Laravel 8 project

Some common issues that trip you up with Laravel 8 and how to handle them!

Erikka Innes

October 6, 2021

Laravel is a great framework for building web applications. It does a lot of the heavy lifting for you, so you can focus your development efforts on the more unique elements of your application. Because there are multiple versions of Laravel and many of the packages you'll use with it have their own updates, it can sometimes get tricky to troubleshoot. There are many troubleshooting suggestions online, and this quick article aims to help sift those for the best tips.

Check your version of Laravel

One issue you will encounter is matching your version of Laravel to the advice you find online. This guide may work for other versions of Laravel, but is intended for Laravel 8. When troubleshooting, make sure you are conscious of what version you have and what version the tips you find are for.

Bootstrap isn't working in my Laravel project

You must properly install Bootstrap for your Laravel project in order to add it to your files. If you find that Bootstrap styling isn't appearing on your HTML pages as expected, this section may be for you.

How to install Bootstrap 4 for Laravel

To install Bootstrap 4 for your Laravel project, you do these things:

  1. At the command line, type composer require laravel/ui.
  2. At the command line, type php artisan ui bootstrap if you just want Bootstrap for your project but don't plan to do any authentication. If you want to handle authentication in your project with bootstrap, then type php artisan ui bootstrap --auth.
  3. You'll also need to make sure npm is installed, so at the command line, type npm install.
  4. Finally, at the command line run npm run dev.

Some problems that might arise are having packages that aren't up to date, or issues with installing Laravel Mix. You can search online for how to handle packages that aren't up to date if there's a special issue. For the Laravel Mix issue, simply run npm run dev again. It often solves the issue.

How to add Bootstrap 4 to your blade files

To add Bootstrap 4 into your blade.php files, you use mustache quotes {{}} to reference the Bootstrap content you'll need. It looks like this:

json

You may see the choice where you just reference a link to a public distribution, but blade files work differently. You need to use the mustache quotes version to add the files.

Bootstrap still isn't working

You'll see a note on installation that you don't have the most recent version of popperjs. If you want to update that to see if it corrects your issue, you can use the following command:

npm i @popperjs/core

I don't see the changes I made to SASS and JS

If you don't see changes implemented in your application after updating something in SASS or JS files, the issue might be that you didn't run npm run dev again. Every time you change content here, you must use this command. If you don't want to do that and want to continually see your changes while you're making them, you can use npm run watch. This command will start regularly checking your files and recompiling every time it detects new changes.

I made changes to my application and they're not reflected on my server

If you made changes that are not just updates to the views, you may need to restart your server. You can do that like this:

  1. Press Control + C at the same time.
  2. Type in the terminal in your project folder php artisan serve.

I installed a new library

If you install a new library with Composer, you need to make sure you pull in all the new changes that causes. In the terminal type:

composer update

I made changes to my database schema

If you change your database schema or add something new, you need to run a migration. This is pretty simple, type:

php artisan migrate:fresh

My application isn't accessing my public folder correctly

To make sure your application accesses your public folder, which is where you'll often store assets, you need to create symbolic links for your application:

php artisan storage:link

I'm still not sure why I can't see changes I made

If you get stuck, an easy thing to try is:

php artisan config:clear - this clears your cache file. If you corrected something, but the cache isn't cleared, you might not be able to see your update.

The route I want isn't displaying

The order of routes in your web.php file matters! If you put routes that include variables first, it can mess up the flow of your application. Try to put concrete routes first, and then routes with flexible components after.

My controllers aren't found

In Laravel 8, the automatic namespace is turned off. If you want the same functionality as earlier versions of Laravel back, go to RouteServiceProvider.php and make it so protected $namespace = 'App\\Http\\Controllers'; is no longer commented out.

Conclusion

When working with Laravel, there are lots of small details to remember. Updating and refreshing various aspects of your application can help correct a lot of problems you may encounter. If you want to try building something with api.video and Laravel, check out our post Create your own version of Instagram using api.video and Laravel.

Try out more than 80 features for free

Access all the features for as long as you need.
No commitment or credit card required

Video API, simplified

Fully customizable API to manage everything video. From encoding to delivery, in minutes.

Built for Speed

The fastest video encoding platform. Serve your users globally with 140+ points of presence. 

Let end-users upload videos

Finally, an API that allows your end-users to upload videos and start live streams in a few clicks.

Affordable

Volume discounts and usage-based pricing to ensure you don’t exceed your budget.