Laravel Nova Metric card position

All we need is an easy explanation of the problem, so here it is.

Is it possible to move the card below the block with detail?

Laravel Nova Metric card position

How to solve :

I know you bored from this bug, So we are here to help you! Take a deep breath and look at the explanation of your problem. We have many solutions to this problem, But we recommend you to use the first method because it is tested & true method that will 100% work for you.

Method 1

While Laravel Nova doesn’t allow this, you can use custom vanilla JavaScript to cut and paste it. It’s a bit hacky but it works 🤷‍♂️

This is all in the Card.vue that the artisan nova:card yourname/customcard command creates.

Give the card an id so we can find it later:

 <card class="flex flex-col justify-center" id="custom-card">

Then find it again:

let customCard = document.querySelector('#custom-card');

The listing of the details of that resource has a div with a custom dusk element and the value is set to resourcename-detail-component where resourcename is e.g. user. You need to find that element and then append the card snippet to it:

let anotherComponent = document.querySelector('div[dusk=resourcename-detail-component]');
anotherComponent.appendChild(customCard);

I’ve written this up here: Laravel Nova: Move cards in Resource Detail View

Note: Use and implement method 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply