PHP code example of armincms / nova-tab

1. Go to this page and download the library: Download armincms/nova-tab library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

armincms / nova-tab example snippets

 
    use Armincms\Tab\Tab;    



    /**
     * Get the fields displayed by the resource.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array
     */
    public function fields(Request $request)
    {
        return Tab::make('general', function($tab) {
          $tab->group('general', [
              ID::make()->sortable(),  

              Select::make('Tag')->options(function() {
                  return ['*' => 'all'];
              })->default('*'),     
          ])->label(__('General')); 

          $tab->group('SEO', [ 
              Text::make('Title'), 
          ])->active();  

          $tab->group('Relations', [
              MorphToMany::make('Tag'),  
          ])->label('Relations');  
        })->toArray(); 
    }
 
    use Armincms\Tab\Tab;    



    /**
     * Get the fields displayed by the resource.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array
     */
    public function fields(Request $request)
    {
        return Tab::make('general', function($tab) {
          $tab->group('general', [$this, 'generalFields'])->label(__('General')); 

          $tab->group('SEO', [ 
              Text::make('Title'), 
          ])->active();  

          $tab->group('Relations', [
              MorphToMany::make('Tag'),  
          ])->label('Relations');  
        })->fullwidth()->toArray(); 
    }

    public function generalFields() 
    {
      return $this->merge([
        ID::make()->sortable(),   
        Select::make('Tag')->options(function() {
            return ['*' => 'all'];
        })->default('*'),
      ]);
    }


    use Armincms\Tab\Tab;    



    /**
     * Get the fields displayed by the resource.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array
     */
    public function fields(Request $request)
    {
        return [       
            Tab::make('first-tab', function($tab) {
                $tab->group('general', [$this, 'generalFields'])->label(__('General')); 

                $tab->group('SEO', [ 
                    Text::make('Title'), 
                ])->active();  

                $tab->group('Relations', [
                    MorphToMany::make('Tag'),  
                ])->label('Relations');  
            }),  
            Tab::make('second-tab', function($tab) {
                $tab->group('general', [
                    ID::make()->sortable(),  

                    Select::make('Tag')->options(function() {
                        return ['*' => 'all'];
                    })->default('*'),     
                ])->label(__('General')); 

                $tab->group('SEO', [ 
                    Text::make('Title'), 
                ])->active();  

                $tab->group('Relations', [
                    MorphToMany::make('Category'),  
                ])->label('Relations');  
            }),    
        ]; 
    }

    
    public function generalFields() 
    {
      return $this->merge([
        ID::make()->sortable(),   
        Select::make('Tag')->options(function() {
            return ['*' => 'all'];
        })->default('*'),
      ]);
    }


    use Armincms\Tab\Tab;    



    /**
     * Get the fields displayed by the resource.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array
     */
    public function fields(Request $request)
    {
        return [     
            new Panel('First Panel', [  
                Tab::make('general', function($tab) {
                    $tab->group('general', [
                        ID::make()->sortable(),  

                        Select::make('Tag')->options(function() {
                            return ['*' => 'all'];
                        })->default('*'),     
                    ])->label(__('General')); 

                    $tab->group('SEO', [ 
                        Text::make('Title'), 
                    ])->active();  

                    $tab->group('Relations', [
                        MorphToMany::make('Tag'),  
                    ])->label('Relations');  
                }), 
            ]), 
    }


    use Armincms\Tab\Tab;    



    /**
     * Get the fields displayed by the resource.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array
     */
    public function fields(Request $request)
    {
        return [     
            new Panel('My Panel', [  
                Tab::make('general', function($tab) {
                    $tab->group('Author', [
                        ID::make()->sortable(),  

                        BelogsTo::make('User'),   
                    ])->label(__('General'));  

                    $tab->group('Relations', [
                        MorphToMany::make('Tag'),  
                    ])->label('Relations');  
                }), 
            ])   
        ]; 
    }