Skip to content

Tag: laravel

Laravel validate at least one item in a form array

I have a form with a series of numbers in an array: I would like to validate that there is at least one of those input fields that has a value. I tried the following in my OrderCreateRequest, yet the test is passing: Am I missing something? Answer I think you need a custom validation rule like the following b…

Laravel 5.4 fopen(): Filename cannot be empty

I want to upload image in laravel 5.4 Here’s the code: in FilesystemAdapter.php (line 146) I checked the FileSystemAdapter.php and saw that the problem is in this line: When I var dump the $file variable it returns the correct info, but when I var_dump($file->getRealPath(); it says bool(false) and I …

Laravel 5.4 Combining two collections

So I Have two collections, sales and costs. Now I need them to combine into one collection for my foreach condition (I’m not sure if I can use two collections in one foreach) RAW Queries: Here’s my query for these two collections: Things I’ve tried testing: Converting the collections into ar…