/** * Extend the product model with a packaging field * @return [type] [description] */ public function boot() { Product::extend(function ($model) { $model->belongsTo['packaging'] = ['Bedard\\USPS\\Models\\Packaging']; }); Event::listen('backend.form.extendFields', function ($widget) { if (!$widget->getController() instanceof Products) { return; } if (!$widget->model instanceof Product) { return; } $widget->addSecondaryTabFields(['packaging_id' => ['tab' => 'bedard.shop::lang.products.details_tab', 'label' => 'Packaging', 'comment' => 'Select the smallest packaging this product can be mailed in.', 'type' => 'dropdown', 'options' => Packaging::all()->lists('name', 'id'), 'span' => 'right']]); }); }