/** * Store a newly created product in storage. * * @return Response */ public function store() { $validator = Validator::make(Input::all(), CustomerType::$rules); if ($validator->passes()) { CustomerType::create(Input::all()); return Response::json(array('success' => true, 'message' => array('type' => 'success', 'msg' => 'Thêm loại khách hàng thành công!'))); } else { return Response::json(array('success' => false, 'errors' => $validator->errors())); } }
public function run() { CustomerType::create(['customer_type' => 'Chủ cửa hàng']); CustomerType::create(['customer_type' => 'Nhà cung cấp']); CustomerType::create(['customer_type' => 'Khách bán lẻ']); }