Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

johnschroeder7's avatar

debug laravel code to figure out routing issue

What can I use to debug my laravel framwork code? I've got data on a particular blade that I want to display on the / page, but I don't get any errors, and the data doesn't show up there. Thoughts?

0 likes
31 replies
Sinnbeck's avatar

Debugbar or clockwork are great tool. Or dd(). Or Ray (but that costs money)

Personally I also use xdebug but that is a bit tricky to set up

johnschroeder7's avatar

Awesome, thank you all for that information. I actualyl just installed Debugbar via composer, just trying to figure out now how to use it. I am reading the docs, but don't see anything yet.

http://phpdebugbar.com/docs/

1 like
johnschroeder7's avatar

@vincent15000 Thanks I wonder how to actually see the Bar, so I can look at the different tabs? I installed it without --dev as I don't have a development server, just purely production,

1 like
vincent15000's avatar

@johnschroeder7 The debugbar is by default hidden in production.

So you will only see it in development.

And it's not a good idea to display it in production because it will show some informations that you shouldn't show in production.

Why don't you have any development environment ? Is there any reason ?

johnschroeder7's avatar

@vincent15000 Thanks. My server is on the Cloud, and I am SSH from windows terminal to make any server side changes, and then I am using sublime for text editor to SSH into make changes to the website, and then Filezilla to SFTP into the server because sometimes if I move files or delete directories, etc via Sublime, it gets all jacked up. In addition to that MySQL is running on the Server, so I say all that to say. Not sure if I ran a "development" environment on my localhost is possible since the database is on remote server.

1 like
vincent15000's avatar

@johnschroeder7 It's not so secure to work like this.

You should retrieve your code on your local machine and do all changes locally, so that you can test the code locally before sending it in production.

Very easy to do with Laragon on Windows.

https://laragon.org/

Are you working with a repository like github ?

Sinnbeck's avatar

@johnschroeder7 I assume there are no users on the site then? If you make the smallest typo or mistake the site breaks in production

1 like
johnschroeder7's avatar

@Sinnbeck That is correct, except there is a login page. and it works and I can login. There is some data that is displayed on the /home page when I am logged in. I totally get what you mean by a single typeo that that it breaks. So this one has me really trying to figure it out, as I want to display some of that data from the /home on the / page.

1 like
Tray2's avatar

@johnschroeder7 Why don't you start by showing us your routes file, and then the controller that you are supposed to hit.

1 like
Sinnbeck's avatar

@johnschroeder7 I worked the same way you are when I first started out. But I can highly recommend getting a local environment set up. It is just sooo much nicer, and when you someday get other users you already have a proper set up

johnschroeder7's avatar

@Tray2 Thanks. Below is the routes page. As far as the controller goes, just trying to understand why a controller would be need, or perhaps it needs to be modified in the first get route below?

routes/web.php

<?php

use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::get('/', function () {
    return view('welcome');
});

Auth::routes(['register' => false]);

Route::get('/home', [App\Http\Controllers\HomeController::class, 'index'])->name('home');

Route::resource('bookmarks', App\Http\Controllers\Admin\BookmarksController::class);
1 like
johnschroeder7's avatar

@Sinnbeck Thank you, I've already installed Laragon, wow, it does look like this is going to be much easier...

1 like
johnschroeder7's avatar

@vincent15000 Sure. When I log in, and at my home page 'home' it shows these 4 titles that have some data. So when I copy that small same code and insert it at my 'welcome' page, being the welcome.blade.php file it does not display that data nor throw me an error code.

1 like
vincent15000's avatar
Level 63

@johnschroeder7 Why are you using extends('layout') in the middle of the welcome view ?

Either you extend a view from a layout (best pratice) or you write the entire page, but don't mix both.

johnschroeder7's avatar

@vincent15000 Just trying to pull that same data that is on the home.blade.php file, and that is the way it was written.

1 like
johnschroeder7's avatar

@vincent15000 I had a developer create the site, for a project I was working on. He set it all up. Then I stopped the project, for 3 months. So I started the project again, and basically had to restore it. Now that I got it restored, trying to customize some things on it, while I await to hear back from him on a later date if he's still interested in doing more work on it.

1 like
johnschroeder7's avatar

@vincent15000 Yes, sounds good. I took a look at that, but it didn't cover this issue I am having. I recall it covering and talking about two different ways to do blades, but none of that seemed to help just yet.

1 like
vincent15000's avatar

@johnschroeder7 I don't know the context, but it's a not a good idea to code the site if you don't have any minimum knowledge about Laravel.

Following the tutorial I suggested you will take you some hours and then you will be able to customize some parts of the site.

johnschroeder7's avatar

@vincent15000 Lol, yes. It actually did work, the code was fine, but it was at the bottom of the homepage. So, now I get it what you mean by why did I have extends('layout') in the middle of the page. I'll have to watch the laravel videos and figure out how to get that straighen out. At least, now I know when I didn't get any error codes, it was in fact working. The debug tool also showed on my browser after hitting refresh, but it didn't even really clue me in on what was wrong, because there was no code error... So consider this topic resolved.

1 like
vincent15000's avatar

@johnschroeder7 If you consider this topic resolved, please close the post by assgning the best answer to the answer that best helped you.

Please or to participate in this conversation.