Loading
Network error

Agorakit : Users & developers

Trying to print a query

Started by Odile B in Agorakit : Users & developers May 5, 2025 3:19 PM

Hi!

I'm currently failing to debug an insert that does not happen while it definitely should. Getting Laravel to print its SQL queries seems difficult. At least I did not find how to print which SQL is, in real life, sent when I write somthing like $model->save() or $model->update() or $model->associate(...). Well, these things. Even the DEBUGBAR does not help :-(

Any idea?

May 5, 2025 4:50 PM

Is the model valid? Maybe validating trait is blocking the insert. You can also try artisan tinker to test on the fly in the command line.

May 5, 2025 5:56 PM

> Is the model valid?

$discussion->save() fails silently .. and without any return value, either true, false, just nothing :-(

I've seen something of interest:

@glagh14 /laravels-eloquent-s-save-update-decoded-explained-73f73af2c50b">https://medium.com/@glagh14 /laravels-eloquent-s-save-update-decoded-explained-73f73af2c50b

suggests to plug in an "event listener", that would listen to the saving event.

BTW: is it a good idea, finally, to use the word Event ourselves? (instead of Action)

May 5, 2025 7:16 PM

> without any return value, either true, false, just nothing :-(

well no, I've got false as return value.

May 9, 2025 2:24 PM

About naming, I have the same problem with my freshly introduced context facade...


Sorry for the lack of activity on my side, I'm full at work until Monday

eyes
You've read everything in this discussion