Laravel's pretty var_dump(), dd(), not working anymore - laravel

For some reason laravel's dd() function decided to stop functioning. I have no idea how this happened. I tried composer update already but I'm not sure what else can be going on. The debug key is set to true in the config.
Where should I look to solve this problem? I'm using Laravel 4.2.16
NOTE:
dd() now simply functions as var_dump(), it doesn't prettify it anymore

Solved it. I loaded my vagrant machine with the wrong config and was running hhvm instead of regular php-fpm. Hence xdebug, which handles the pretty dd(), was not being loaded. I reloaded my box with the correct settings (without hhvm and hack) and everything started working again

Is dd the only Laravel helper function that doesn't work? If not then check the contents of vendor/composer/autoload_files.php. The laravel support helpers are loaded here. If the other helper functions are fine you can check the contents of laravel/framework/src/Illuminate/Support/helpers.php to see what's going on - this is where the function is created.

Related

cannot access Component controller variables inside the component view

I have been running into this very weird issue with Laravel.
I had a problem where one of my component views was not able to read the variables defined in its class. It was kind of strange because I have several components running in my project and they all worked fine, except for this one.
So I created a fresh Laravel project to test some things out (Wanted to check if the problem was on my end, maybe I somehow messed up the project files).
I created a new component on a blank project using php artisan make:component top_nav
pre function basically is used as print_r which is in helper.php
Then I simply added a sql_data variable to the class component like so:
i tried many thing as much as i can do but still i can't access that variable
also clear cache of view
of laravel
change name of components but still can't work
kindly help me..........
you should
return view('components.top_nav', ['sql_data' => $sql_data]);
you are not passing the variable to the view
composer install
npm install && npm run dev
php artisan optimize
I just copied your screenshots into a new laravel installation and ran it with no problems.
Try setting the public property with a default value:
public $sql_data = 'testing'
If you try the above and still have issues, I'd like to confirm the output of AdminLogin::all().
PS:
TopNav instead of top_nav Class name please.

Where does the output of dd() and dump() get written when developing Laravel in VS Code?

I'm developing a Laravel 8.x app in the current version of VS Code. I have a dump() statement in a Controller that I've written so that I can determine precisely what's in the $request that is being handled because I suspect that my date isn't exactly what I think it is. I've added this to the store() method: $request->dump() and I'm pretty sure it has executed but I can't find the output from the dump() function anywhere. I've got Debugbar installed and it does not show the dump() output. Ditto for any window of the browser like the console, inspector, etc. I've looked in the laravel.log but it's not there either. I've checked each of my terminal windows - the ones dedicated to php artisan serve and npm run watch and the one I use for all other commands but I can't find anything there. I'm out of ideas on where to look.
If the Laravel docs tell you where to find the output, I missed it; they describe what dump() and dd() do but I can't find where they describe where the output is written.
I'm pretty new to Laravel and I'm working alone so I have no work colleagues to ask. Could someone kindly tell me where to find the output of dump() so that I can debug this program?
None of the comments pointed me to precisely where I eventually found the dd() output so I'm posting it here for the sake of any future person who has the same issue. I finally found it in the browser, in the console tab (I'm using Firefox) and within the Response to the Axios statement that tried to write the new record to the database. Here's a picture:
I had assumed that the information wouldn't require me to drill down as far as I did; I thought it would be as visible as normal console.log() output.
I'm very grateful to those who replied to my question; you finally got me looking in the exact right place. I've never used dd() or dump() before, even in vanilla PHP, so I really had no idea where the output got written.

Laravel artisan command from controller

I update my .env file using a function in my controller.
After I save the settings I need to update, I call Artisan::call('config:cache') to clear the cache of my site's configuration.
Everything works fine on localhost, but when I try to clear config cache on production, it doesn't work. (No warnings or errors.)
I even tried with --no-interaction option attached to this CLI command.
Did anyone have this problem and know what causes it?
check into the PHP security settings and make sure you can run these exec,passthru,shell_exec functions in your server.

laravel env method get different value when code not change ?

I'm new beginner of laravel.I want use Helpers to get environment value using env method.
class Helpers {
public static function somefunc(){
var_dump(env('QINIU_BUCKET_DOMAIN'));exit;
}
}
Then strange thing happed.When I opened chrome-dev-tool (F12),I got nothing. Then I closed chrome-dev-tool,I got what I want. Is anything wrong? Anybody can help me? :)
Laravel's .env manages configuration for the server side environment.
So, you opening and closing Chrome Dev Tools has nothing to do with this!
You might have changed something in the server environment.
So restarting your server might help.
Check the documentation - http://laravel.com/docs/5.1#configuration

Laravel caching old controllers MAMP

I have a Laravel application that refuses to acknowledge controller changes even if the controller doesn't exist anymore!
Using MAMP PRO 5.5.3 and Laravel 4.1
with
/Applications/MAMP/bin/php/php5.5.3/bin/php
I have followed these instructions
Stop caching for PHP 5.5.3 in MAMP
I have deleted the view storage in Laravel.
There was mention of adding - opcache_reset(); in my bootstrap/autoload.php
http://laravel.io/forum/02-06-2014-laravel-and-view-caching-in-development-cant-see-changes-right-away
But not sure how and where you do you do that, I tried but just got an error
Call to undefined function opcache_reset()
The caching still continues!
Despite the controller having been deleted 2 hours ago (to prove controller not being called), it is still showing the page with an imaginary controller.
It's driving me insane.
Any help really appreciated.
Further to this the route file is refusing to accept UserController
Route::get('register', 'UserController#getRegister');
Giving this error
.....controllers/UserControllerb.php): failed to open stream: No such file or directory
UserControllerb.php doesn't exist and was not asked for ?! but the route is wrongly looking for it
When I try this
Route::get('register', 'UserControllerb#getRegister');
Rightly give this error
Class UserControllerb does not exist
So the route has been cached (a previous back-up removed days ago)
I have tried to use composer which decides it doesn't want to work and no-one seems to know the solution for either problem.
Laravel composer signal "11" error symfony osx
Huge kudos to anyone who can solve this.

Resources