Skip to content

Tag: laravel

Laravel Nova Self-referential Relationship

In Laravel, if I want to create a self-referential relationship I can do the following: How can I make a Laravel Nova resource display this connection? Answer You can achieve what you want like this: This will allow to choose a parent post when you create or update a post. When you are in the detail page of a…

Laravel Backpack, Show Address (Json) in Column

I want to show the name field from address json (using algolia), how do i do that? I tried this: But can’t manage to work. Also, it always return error. In preview, i want to show full address too, but only got json return. Thanks in advance Answer Managed to work with Custom Fields. Controller: Create …

Laravel 5.7 + Spatie Permissions + JWT auth

I’m setting up a REST API using Laravel 5.7. To validate authentication I JWT-auth and for permissions and roles I use Spatie. My problem: when trying to link a role to a user I get the following error The role do exist in the database: This is how I’m trying to assign a role to the user: As I&#82…

Laravel – Collections. How to separate array into 2 groups

I have created 2 collections(arrays) which each contain an array of 5 items/events. Output of the above: In my next loop, it simply goes through every item of the array 1 by 1. I need to split the 5 items into a further 2 groups: group of 2 group of 3 so I can wrap a div around each group.

How to print table data in Laravel 5.6?

in My Larvel 5.6 app I am working with mysql db. and in my application I have vehicle table with following columns, vehicles, and I am going to group all models of the table and printing here as My controller, my printing blade file is this, it is printing well as now I need print in-front of model name there