4 improved formatting
source | link

shippingbar_post_listing.xml

shippingbar_post_listing.xml

CM\Shippingbar\Model\Status.php

CM\Shippingbar\Model\Status.php

CM\Shippingbar\Model\Shippingbar.php

CM\Shippingbar\Model\Shippingbar.php

shippingbar_post_listing.xml

CM\Shippingbar\Model\Status.php

CM\Shippingbar\Model\Shippingbar.php

shippingbar_post_listing.xml

CM\Shippingbar\Model\Status.php

CM\Shippingbar\Model\Shippingbar.php

3 Edited Tags
| link
    Became Hot Network Question
2 added 959 characters in body
source | link
  <?php 

namespace CM\Shippingbar\Model;

use Magento\Framework\Data\OptionSourceInterface;

/**
 * ProductStatus Class
 */
class Status implements OptionSourceInterface
{
    /**
     * Get@var options\CM\Shippingbar\Model\Productlabel
     */
     * @returnprotected array$model;
  

    */**
    public function* toOptionArray()Constructor
    {
  *
     * $options@param =\CM\Shippingbar\Model\ModelFile [$model
     */
   protected function _construct(\CM\Shippingbar\Model\Shippingbar $model)
    {
$this->model = $model;    
 }

   [ /**
     * Get options
     *
     * @return array
     */
    'label'public =>function 'Disable',toOptionArray()
    {
        $options[] = ['label' => '', 'value' => ''];
        $availableOptions 'value'=$this->model->getAvailableStatuses();
 => 0
      foreach ($availableOptions as $key => $value) {
            ],
$options[] = [
                'label' => $value,
    [
            'value' => $key,
            ];
  'label' => 'Enable',
    }
        return $options;
    }

}

CM\Shippingbar\Model\Shippingbar.php

 <?php
namespace CM\Shippingbar\Model;

class Shippingbar  extends \Magento\Framework\Model\AbstractModel 
{
    const 'value'STATUS_ENABLED =>= 11;
    const STATUS_DISABLED = 0;



    protected function _construct()
    {
       ] $this->_init('CM\Shippingbar\Model\ResourceModel\Shippingbar');
    }


     public function getAvailableStatuses()
    {
     ];
   return [self::STATUS_ENABLED => __('Enabled'), self::STATUS_DISABLED return=> $options;__('Disabled')];
    }
  }
<?php
namespace CM\Shippingbar\Model;

use Magento\Framework\Data\OptionSourceInterface;

/**
 * ProductStatus Class
 */
class Status implements OptionSourceInterface
{
    /**
     * Get options
     *
     * @return array
     */
    public function toOptionArray()
    {
        $options = [
                        [
                            'label' => 'Disable',
                            'value' => 0
                        ],
                        [
                            'label' => 'Enable',
                            'value' => 1
                        ]
                    ];
        return $options;
    }
}
  <?php 

namespace CM\Shippingbar\Model;

use Magento\Framework\Data\OptionSourceInterface;

/**
 * ProductStatus Class
 */
class Status implements OptionSourceInterface
{
 /**
     * @var \CM\Shippingbar\Model\Productlabel
     */
    protected $model;
 

    /**
     * Constructor
     *
     * @param \CM\Shippingbar\Model\ModelFile $model
     */
   protected function _construct(\CM\Shippingbar\Model\Shippingbar $model)
    {
$this->model = $model;    
 }

    /**
     * Get options
     *
     * @return array
     */
    public function toOptionArray()
    {
        $options[] = ['label' => '', 'value' => ''];
        $availableOptions =$this->model->getAvailableStatuses();
        foreach ($availableOptions as $key => $value) {
            $options[] = [
                'label' => $value,
                'value' => $key,
            ];
        }
        return $options;
    }

}

CM\Shippingbar\Model\Shippingbar.php

 <?php
namespace CM\Shippingbar\Model;

class Shippingbar  extends \Magento\Framework\Model\AbstractModel 
{
    const STATUS_ENABLED = 1;
    const STATUS_DISABLED = 0;



    protected function _construct()
    {
        $this->_init('CM\Shippingbar\Model\ResourceModel\Shippingbar');
    }


     public function getAvailableStatuses()
    {
        return [self::STATUS_ENABLED => __('Enabled'), self::STATUS_DISABLED => __('Disabled')];
    }
  }
1
source | link