NovaTextCard icon indicating copy to clipboard operation
NovaTextCard copied to clipboard

Install instructions?

Open MACscr opened this issue 4 years ago • 1 comments

The install instructions are a bit vague. Ive installed other cards (like Nova Charts) with no problems, but get the following error:

Error
Class 'App\Providers\TextCard' not found

Trying to add the text card in NoveServiceProvider.php

    /**
     * Get the cards that should be displayed on the default Nova dashboard.
     *
     * @return array
     */
    protected function cards()
    {
        return [
          (new StackedChart())
              ->title('Revenue')
              ->series(array([
                  'barPercentage' => 0.5,
                  'label' => 'Product #1',
                  'backgroundColor' => '#ffcc5c',
                  'data' => [30, 70, 80],
              ],[
                  'barPercentage' => 0.5,
                  'label' => 'Product #2',
                  'backgroundColor' => '#ff6f69',
                  'data' => [40, 62, 79],
              ]))
              ->options([
                  'xaxis' => [
                      'categories' => [ 'Jan', 'Feb', 'Mar' ]
                  ],
              ])
              ->width('1/3'),
              (new StackedChart())
                  ->title('Test')
                  ->series(array([
                      'barPercentage' => 0.5,
                      'label' => 'Product #1',
                      'backgroundColor' => '#ffcc5c',
                      'data' => [30, 70, 80],
                  ],[
                      'barPercentage' => 0.5,
                      'label' => 'Product #2',
                      'backgroundColor' => '#ff6f69',
                      'data' => [40, 62, 79],
                  ]))
                  ->options([
                      'xaxis' => [
                          'categories' => [ 'Jan', 'Feb', 'Mar' ]
                      ],
                  ])
                  ->width('1/3'),
              (new TextCard())
                  ->width('1/3')
                  ->height(100)
                  ->center(false)
                  ->heading('Custom card no centered')
                  ->text('Congue platea augue fames nullam morbi'),

          (new StackedChart())
              ->title('Revenue')
              ->animations([
                  'enabled' => true,
                  'easing' => 'easeinout',
              ])
              ->series(array([
                  'barPercentage' => 0.5,
                  'label' => 'Average Sales',
                  'backgroundColor' => '#999',
                  'data' => [80, 90, 80, 40, 62, 79, 79, 90, 90, 90, 92, 91],
              ],[
                  'barPercentage' => 0.5,
                  'label' => 'Average Sales 2',
                  'backgroundColor' => '#F87900',
                  'data' => [40, 62, 79, 80, 90, 79, 90, 90, 90, 92, 91, 80],
              ]))
              ->options([
                  'xaxis' => [
                      'categories' => [ 'Jan', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct' ]
                  ],
              ]),
        ];
    }

MACscr avatar Aug 06 '20 00:08 MACscr

@MACscr Include the full namespace like (new \Ericlagarda\NovaTextCard\TextCard())

smartens80 avatar Sep 11 '20 09:09 smartens80