Exemplo n.º 1
0
 /**
  * 增加商品
  * @author Hanxiang
  */
 public function add()
 {
     $user = Auth::user();
     if ($user->role == User::ROLE_ADMIN) {
         $suppliers = Supplier::all();
     } else {
         // TODO: supplier_id != user_id
         $suppliers = Supplier::where('id', $user->id)->get();
     }
     $itemTypes = ItemType::orderBy('sort')->get();
     $setting = Setting::getByKey(Setting::KEY_COMMISSIONS_RATE);
     return view('admin/items/add')->with('suppliers', $suppliers)->with('itemTypes', $itemTypes)->with('setting', $setting);
 }