Why Custom Dashboard widgets not show What the wrong here?

Posted In Voyager
  • tag-dev 1 year ago
    **Hello First Thanks for reading and helping **
    I created custom widget like a video but not show in dashboard  also no show any error 
    1.  i installed voyager without dummy data by the way .
    2.  any one can help 
    3.  My code there 
    
    ><?php
    
    namespace App\Widgets;
    
    use Illuminate\Support\Str;
    use TCG\Voyager\Facades\Voyager;
    use TCG\Voyager\Widgets\BaseDimmer;
    use Illuminate\Support\Facades\Auth;
    use App\Feature;
    
    class FeaturesWidget extends BaseDimmer
    {
        /**
         * The configuration array.
         *
         * @var array
         */
        protected $config = [];
    
        /**
         * Treat this method as a controller action.
         * Return view() or other content to display.
         */
        public function run()
        {
            $count = Feature::count();
            $string = trans_choice('voyager::dimmer.post', $count);
    
            return view('voyager::dimmer', array_merge($this->config, [
                'icon'   => 'voyager-news',
                'title'  => "{$count} {$string}",
                'text'   => __('voyager::dimmer.post_text', ['count' => $count, 'string' => Str::lower($string)]),
                'button' => [
                    'text' => __('voyager::dimmer.post_link_text'),
                    'link' => route('voyager.posts.index'),
                ],
                'image' => voyager_asset('images/widget-backgrounds/02.jpg'),
            ]));
        }
    
        /**
         * Determine if the widget should be displayed.
         *
         * @return bool
         */
        public function shouldBeDisplayed()
        {
            return Auth::user()->can('browse', Voyager::model('Post'));
        }
    }
    -------------------- 
    // voyager.php 
    
    'widgets' => [
                'App\\Widgets\\FeaturesWidget',
            ],
    
    
    =============================
    No showen and not show any errors
    Thanks So Much for help

    **Hello First Thanks for reading and helping ** I created custom widget like a video but not show in dashboard also no show any error

    1. i installed voyager without dummy data by the way .
    2. any one can help
    3. My code there

    namespace App\Widgets;

    use Illuminate\Support\Str; use TCG\Voyager\Facades\Voyager; use TCG\Voyager\Widgets\BaseDimmer; use Illuminate\Support\Facades\Auth; use App\Feature;

    class FeaturesWidget extends BaseDimmer { /** * The configuration array. * * @var array */ protected $config = [];

    /**
     * Treat this method as a controller action.
     * Return view() or other content to display.
     */
    public function run()
    {
        $count = Feature::count();
        $string = trans_choice('voyager::dimmer.post', $count);
    
        return view('voyager::dimmer', array_merge($this->config, [
            'icon'   => 'voyager-news',
            'title'  => "{$count} {$string}",
            'text'   => __('voyager::dimmer.post_text', ['count' => $count, 'string' => Str::lower($string)]),
            'button' => [
                'text' => __('voyager::dimmer.post_link_text'),
                'link' => route('voyager.posts.index'),
            ],
            'image' => voyager_asset('images/widget-backgrounds/02.jpg'),
        ]));
    }
    
    /**
     * Determine if the widget should be displayed.
     *
     * @return bool
     */
    public function shouldBeDisplayed()
    {
        return Auth::user()->can('browse', Voyager::model('Post'));
    }
    

    }

    // voyager.php

    'widgets' => [ 'App\Widgets\FeaturesWidget', ],

    ============================= No showen and not show any errors Thanks So Much for help

  • devdojo 1 year ago
    Not sure if it will help, but here is a sample custom widget I created in our Ninja Media Script project:
    
    File stored at `app\Widgets\CommentDimmer.php`
    
    ```
    namespace App\Widgets;
    
    use Arrilot\Widgets\AbstractWidget;
    use Illuminate\Support\Str;
    use TCG\Voyager\Facades\Voyager;
    
    class CommentDimmer extends AbstractWidget
    {
        /**
         * The configuration array.
         *
         * @var array
         */
        protected $config = [];
    
        /**
         * Treat this method as a controller action.
         * Return view() or other content to display.
         */
        public function run()
        {
            $count = \App\Models\Comment::count();
            $string = 'Comments';
    
            return view('voyager::dimmer', array_merge($this->config, [
                'icon'   => 'voyager-news',
                'title'  => "{$count} {$string}",
                'text'   => "You have $count comments in your database. Click on button below to view all comments.",
                'button' => [
                    'text' => 'View All Comments',
                    'link' => '/admin/comments',
                ],
                'image' => Voyager::image('widgets/comments.png'),
            ]));
        }
    }
    ```
    
    Here is my widgets array inside my `config/voyager.php`
    
    ```
    'widgets' => [
        'App\\Widgets\\PostDimmer',
        'App\\Widgets\\CommentDimmer',
        'App\\Widgets\\UserDimmer',
    ],
    ```
    
    If you have a sample URL you can share with me, it might be easier to help out with the issue :)
    
    Thanks!

    Not sure if it will help, but here is a sample custom widget I created in our Ninja Media Script project:

    File stored at app\Widgets\CommentDimmer.php

    namespace App\Widgets;
    
    use Arrilot\Widgets\AbstractWidget;
    use Illuminate\Support\Str;
    use TCG\Voyager\Facades\Voyager;
    
    class CommentDimmer extends AbstractWidget
    {
        /**
         * The configuration array.
         *
         * @var array
         */
        protected $config = [];
    
        /**
         * Treat this method as a controller action.
         * Return view() or other content to display.
         */
        public function run()
        {
            $count = \App\Models\Comment::count();
            $string = 'Comments';
    
            return view('voyager::dimmer', array_merge($this->config, [
                'icon'   => 'voyager-news',
                'title'  => "{$count} {$string}",
                'text'   => "You have $count comments in your database. Click on button below to view all comments.",
                'button' => [
                    'text' => 'View All Comments',
                    'link' => '/admin/comments',
                ],
                'image' => Voyager::image('widgets/comments.png'),
            ]));
        }
    }
    

    Here is my widgets array inside my config/voyager.php

    'widgets' => [
        'App\\Widgets\\PostDimmer',
        'App\\Widgets\\CommentDimmer',
        'App\\Widgets\\UserDimmer',
    ],
    

    If you have a sample URL you can share with me, it might be easier to help out with the issue :)

    Thanks!

  • tag-dev 1 year ago
    Also dosent Work  No widgets No Errors too | i apperciate your effort for helping me .....  
    **NOTE**
    
    i INSTALLED VOYAGER BY  WITH OUT DUMMY DATA  IS THERE A PROBLEM IN THIS PARTICULAR POINT ?

    Also dosent Work No widgets No Errors too | i apperciate your effort for helping me .....
    NOTE

    i INSTALLED VOYAGER BY WITH OUT DUMMY DATA IS THERE A PROBLEM IN THIS PARTICULAR POINT ?

  • madi-reet 4 months ago
    I am an expert in different programming languages and I will try to help you in solving this problem of yours. Now you can [writemypapers.org reviews](https://topamericanwriters.com/writemypapers-org-review/) info to learn more new ideas to complete their work. I just need some time in finding bugs and figure out what you were doing. Thank you for this amazing post.

    I am an expert in different programming languages and I will try to help you in solving this problem of yours. Now you can writemypapers.org reviews info to learn more new ideas to complete their work. I just need some time in finding bugs and figure out what you were doing. Thank you for this amazing post.

  • sara-taylor-1 3 months ago
    After 8 years as a sleep expert in a couple of mattress stores and seeing thousands of people experiences with many brands, he decided to write and put all of these years of experience into help guides so others can make the right decision when buying sleep products without having to suffer sleepless nights as a result of choosing the wrong mattress.
    
    [best cooling sheets](https://topnaturalmattresses.com/best-cooling-sheets/)

    After 8 years as a sleep expert in a couple of mattress stores and seeing thousands of people experiences with many brands, he decided to write and put all of these years of experience into help guides so others can make the right decision when buying sleep products without having to suffer sleepless nights as a result of choosing the wrong mattress.

    best cooling sheets

  • sara-taylor-1 3 months ago
    After 8 years as a sleep expert in a couple of mattress stores and seeing thousands of people experiences with many brands, he decided to write and put all of these years of experience into help guides so others can make the right decision when buying sleep products without having to suffer sleepless nights as a result of choosing the wrong mattress.
    
    [why do i wake up tired](https://topnaturalmattresses.com/why-do-i-wake-up-tired/)
    

    After 8 years as a sleep expert in a couple of mattress stores and seeing thousands of people experiences with many brands, he decided to write and put all of these years of experience into help guides so others can make the right decision when buying sleep products without having to suffer sleepless nights as a result of choosing the wrong mattress.

    why do i wake up tired

  • ross-taylor 3 weeks ago
    Hey, great blog, but I don’t understand how to add your site in my  reader. Can you Help me please?
    http://kayaksign21.jigsy.com/entries/general/Selecting-a-Mattress-What-Is-usually-the-Greatest-Mattress-to-help-Buy
    

    Hey, great blog, but I don’t understand how to add your site in my reader. Can you Help me please? http://kayaksign21.jigsy.com/entries/general/Selecting-a-Mattress-What-Is-usually-the-Greatest-Mattress-to-help-Buy

  • jackie-davis 2 weeks ago
    Yes, great US Military force. Also, in his post you have given a chance to listen about US Military. I really appreciate your work. Thanks for sharing it.
    [youtube](http://https://www.youtube.com/watch?v=0gyQHNCyZp4&t=4s
    )
    

    Yes, great US Military force. Also, in his post you have given a chance to listen about US Military. I really appreciate your work. Thanks for sharing it. youtube

  • jackie-davis 1 week ago
    The first casualty of war is the truth
    [mens socks](http://https://www.storeboard.com/blogs/do-it-yourself/in-a-number-of-socks-your-guide-to-buying-the-socks-to-get-men/1673979
    )
    

    The first casualty of war is the truth mens socks

Please login or signup to leave a response.

Login

or Sign Up

Sign Up

or Login
×
Want to create your own SAAS?

I can teach you to create your own Software as a Service. Click here to learn more!

Visit SAAS Adventure!