When I’m going to add data an error appears “Call to a member function count() on null” View Controller rekap: but the data is successfully entered into the database, and what steps should I take to correct the error Answer error tells you that images or files or both variables are null, looks like you don’t use eager loading quick
Tag: laravel
problem lose class address when update composer 1 to 2
i have problem when install or update composer. When the composer is updated and generated, the autoload file for example autoload_classmap.php changes and no class or file is found. I do not know how to solve. Thanks for the help. composer.json file } and when update composer say: not found class App/ClearingHourTime class file is : Answer I think you
Laravel: Test not Using Mocked Method
I want getNumber to return 200 in the test case, but when I run the test and inspect the result with $response->dump() I can see that the mock is not overriding the method as it is showing array:1 [0 => 100]. What am I missing? Controller: Model: Test: I am using Laravel 8 and referencing this documentation: https://laravel.com/docs/8.x/mocking#mocking-objects Answer In
Join 2 tables in a Single Eloquent Laravel using multiple where clause
here I’d like to find the solution to simplify my query to get data using eloquent in Laravel. So here I have 2 Eloquent operations to get Rooms which not included in the Booking Table with specified requirements. So far I have no problem with it, but can you guys give me best practice to simplify from what I do?
how to create an alert if the same data has been added using laravel?
I made an add user feature, but if I add the same data there will be a problem, I want to limit the duplicate data, how to create a warning if the same data has been added? Source Code UserController Screenshot Error Image Answer There are two ways to do it. First is to add ‘unique’ to your validation. For
I want to write this MySql Query in Laravel Controller [closed]
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 3 months ago. Improve this question Answer Do it with to write you raw query .
Livewire views not found after deployment
After deployment to Forge, my Laravel Livewire site is throwing out a server error. I am using Digital Ocean as well. In the Forge site logs it says that my livewire view can’t be found. The app works perfectly on local. Any ideas what to do? I have attempted these commands Here is the site logs pt.1 and pt.2 I
How to implement authentication & authorization between microservices & API Gateway using Laravel
I’m trying to implement authentication & authorization of users between my microservices and API Gateway.What I have now: API Gateway which can request to any microservice. User microservice – where I’m storing all users. laravel/passport implemented to authenticate user in this microservice. Works as it should be, login route returns token which I’m using to authenticate user in this microservice.
Laravel CURL – Passing a string to HTTP URL (Postfields)
I use Laravel 9 and the built-in method Http::withHeaders ($headers)->post($url, $data). In the $data variable, I pass the string that resulted from http_build_request with the “&” separator. But Laravel tries to make an array out of it and send data. The API service returns me an error. Please tell me how you can force Laravel to pass exactly a STRING(!),
How to check if predefined selected column is null is laravel
I have this code : I want to check if correctTime is null then dont show this data. I have tried ->whereNotNull(‘correctTime’) it is giving error say column not found. Answer Since its a derived column you have to use having clause, the best thing of the raw query is that you can use multiple types of operators such as