I am using Laravel 8. I want to fetch single data and use it. Answer Please don’t use print_r to dump your records. kindly use dd() or dump(). So you have a clear idea about collections. So as of now, you fetch as if you have multiple models you can use loops.
Tag: laravel
Laravel – Correct way to catch cURL exceception
I am building a simple REST API package using cURL and would like to catch an error and then return a view. I am able to throw an error if I dd($e) but if I try and return a view it just continues with the code after the catch function. Shouldn’t PHP kill the process and just go to the
Laravel multiple foreign keys get specific value using querybuilder
I have a table of contracts and here is the example data And i got another table of spec and the values are how can i get the text from spec table? do i need to multiple join them? what I want is something like im selecting from contracts table I tried but its wrong and got some errors. Thanks
Laravel DOMDocument : failed to open stream: Permission denied
I’m trying to generate xml file in Laravel, I use DOMdocument but I got this error message when I try to save the file : Code in blade file : I know it’s something with permission but i’m not sure where to change the permission and for what. Thank you for help in advance. Answer Seems you ne…
laravel – how to add prefix in all url without affecting route existing
i have url like this mysite.com/company, i want add prefix to url to become mysite.com/home/company. I’ve tried to add a route group, but that requires me to update all existing routes. can i add a prefix in all url without affecting the existing route ? i used laravel 5.6 Answer I have created a sandbo…
justify content space between not working in dompdf
I have such a report that generated by DOMPDF and created with Laravel. I want to display text, one in text-align: left, and another one in text-align: right (both in a same line). But it’s not working in my code. Anybody would to help me with this issue please? I’ve been looking for this but stil…
Laravel/PHP: is there a limit on number of arguments passed to closure function
When I was trying to override the default password reset function, I ran into some weird issue with closure. The 3rd variable $pwAge has to be passed to the closure via if passed along side with the first two arguments as this: I will get the following error when this function is called: What am I missing her…
Concatenate php in laravel
I am not very good at php. I have a function to check for an empty field and the correctness of email There is also a code in php.blade in which you need to insert this check How to do it correctly? I just pasted into @php and it doesn’t work Answer Here is a solution where you dont show
Can I enter from admin to an authenticated user dashboard?
I am working in a project in laravel with livewire. I am working in the admin dashboard that has all user data in a simple table. In this table, I have been requested that when I click on user name, I have to be sent to the specified user dashboard that has been created with livewire. The problem is that
How to update a column by joining four tables in laravel
I have four tables default_products_product_mileage_gap default_products_mileage_gap default_products_products default_products_products_mileage_gaps I am trying to update a column number_of_products_sold to some value using laravel What I have tried is: Here number_of_products_sold is not updating. How to up…