Skip to content

Tag: laravel

Call to undefined method stdClass::isEmpty() error

I am trying to check if the $pl1 is empty but it does not seems to work. I tried using count() but does not seems to work either. controller: blade.php: Answer The variable $paperlist1 is the Collection, so ->isEmpty() will only work on $paperlist1 and not on $pl1 as $pl1 is each value of the collection. S…

Export array to Excelwith MaatwebsiteExcel

I am beginner web developer. I make my project with use Laravel 8 and Maatwebsite Excel. I make this code to prepare data to save to excel file: Generate data work fine. My debug return this: I have problem with save my data to excel file. When I run my code I have downloaded empty file (without my data). How

Select DISTINCT returns duplicates data Laravel 8

I’m trying to get groups that belong to a supervisor to be displayed for him. And I’m using join to get each gpid information base on supervisor_id, query its okay but returns duplicate data of the last row. I can’t figure out why it is duplicating the last record. Any help would be much app…

Laravel fetch data by something else than id

So I’m a total newbie in laravel and I don’t know if it can be done but I saw that in the controller I can display data of a specific ‘id’ with this in my api.php: And this in my BookController.php : I’m using Angular for the front and I have a searchbar to search by ‘title…

Lighthouse graphql custom resolver

Quite new to GraphQL and lighthouse library, don’t be too harsh. Since I can’t use any models because my data source is an API. I’m trying to create a custom resolver that will pass data to a service who will do everything necessary to retrieve data from the API. And it constantly returns me…

order by where in in laravel with requests

I want to make products to be ordered according to each user request as code below and here is the code it return error orderby doesn’t exist on collection Answer Your orderBy() statements have to be added to the query before you run paginate: