Skip to content
Advertisement

Tag: laravel

How to print out value on controller Laravel?

I’m beginner on Laravel… How to debug some value on controller in Laravel, result can show to console like syntax console.log() on javascript? example controller function : Answer In Laravel use dd($id) or if you don’t want to halt the execution, you can use dump($var). You can still always use PHP’s native functions like var_dump, die and print_r.

Laravel 5.1 – Checking a Database Connection

I am trying to check if a database is connected in Laravel. I’ve looked around the documentation and can’t find anything. The closest thing I’ve found is this, but this doesn’t solve my problem. I have three instances of MySQL that are set up on different machines. Below is a simplified version of what I am trying to achieve. If

Laravel `array_pluck` on any key

Is possible use something like array_pluck($array, ‘users.*.id’)? Imagine that I have: And I want get [1, 2, 3]. I tried something like: users.*.id, users.id and users..id, but nothing worked. Answer From Laravel 5.7, you may use the Arr::pluck() helper. Use array_pluck($array[‘users’], ‘id’) The function only supports a single dimensional array. It will search for keys in the array which match

Laravel 5 Send Errors to Email

I am trying to figure out how I can send errors to my email in Laravel 5. I haven’t had much luck finding any good resources. There used to be good packages like: https://github.com/TheMonkeys/laravel-error-emailer That did this for you in Laravel 4. They have yet to release a Laravel5 update because of the way they changed error handling… which I

Laravel – Form validation error – argument 2 must be array

I’m working with Laravel and every time I submit my form it gives me this error: ErrorException in Factory.php line 91: Argument 2 passed to IlluminateValidationFactory::make() must be of the type array, null given, called in /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/FormRequest.php on line 83 and defined This is some code for the controller, even when I don’t try to send data to the database

Advertisement