Skip to content
Advertisement

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. So, @if(!$pl1 -> isEmpty())

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 appreciated. Result Answer You can try

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’ of a book,

TCGVoyager doesn’t get translation on relationship

I use Voyager admin interface (v.1.4) for Laravel (v8.0). Voyager supports multiple languages (official documentation: https://voyager-docs.devdojo.com/v/1.4-1/core-concepts/multilanguage). I have this relationship: Process belongsToMany WorkMachine Process hasMany Product Process model: WorkMachine model: Product model: In my controller: The problem is: the Process translatable text works, the output language depends from app()->getLocale(). But the workmachine texts and products texts aren’t translated. I try

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 this error: “Field “address” of type

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:

Advertisement