laravel nova card duplicate key code example

Example 1: laravel nova card duplicate keys

// Pass parameter in the NovaServiceProvider
 (new ShareCard('MT'))->canSee(function ($request) { return true; }),

// Set key in the __construct;
class ShareCard extends Card {
  	public $width = '1/3';

    public function __construct($stock) {
        parent::__construct();

        $this->withMeta(['uriKey' => $stock]);
        $this->withMeta(['setTitle' => 'Single Share' ]);
        $this->withMeta(['model' => 'i3\ExchangeStock']);
        $this->withMeta(['selectColumns' => ['id','json','name','bid_price','ask_price','last_price'] ]);
        $this->withMeta(['usingWhere' => (object) [ 
                                            "name_short"=>$stock
                                            ] ]);
        $this->withMeta(['groupBy' => [] ]);
        $this->key  = $stock;
    }
 
}

Example 2: laravel nova card duplicate keys

[Vue warn]: Duplicate keys detected: 'my-custom-card.undefined'. This may cause an update error.

found in

---> <Cards> at resources/js/components/Cards.vue
       <Dashboard> at resources/js/views/Dashboard.vue
         <Root>

Tags:

Php Example