예제 #1
0
 function post()
 {
     foreach (json_decode(Input::get('json')) as $i) {
         $c = StoreSubcategory::find($i->id);
         $c->sort = $i->sort;
         $c->save();
     }
     Session::flash('Success Message', 'Saved sort order');
     return \Redirect::to("/admin/store-categories/" . Request::route('id1') . "/view");
 }
 function __construct()
 {
     parent::controllerClass('StoreProductSubcategories');
     parent::headerPlural('Store Product Sub-Categories');
     parent::headerSingular('Store Product Sub-Category');
     parent::baseRoute('/admin/store-products/{id1}/subcategories');
     parent::ajaxBaseRoute('/ajax/admin/store-products/{id1}/subcategories');
     parent::table(new StoreProductSubcategory());
     parent::tableName('store_product_subcategory');
     $this->level = 2;
     $this->parentHeader = 'Store Product';
     $this->foreignKeyField = 'store_product_id';
     parent::attributes([['title' => 'ID', 'id' => 'id'], ['title' => 'Sub-category', 'id' => 'store_subcategory.name']]);
     parent::inputs(function ($row) {
         return ['store_product_id' => (new MetaItem())->id('store_product_id')->defaultValue(Request::route('id1')), 'store_subcategory_id' => (new DropDown())->id('store_subcategory_id')->nullable(false)->label('Sub-category')->idField('id')->nameField('name')->rows(StoreSubcategory::all())->defaultValue($row ? $row->store_subcategory_id : '')];
     });
 }