/**
  * Show the form for creating a new resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function create(Request $request)
 {
     if ($request->isMethod('get')) {
         //menampilkan form
         return View('product.create');
     } else {
         //save ke db
         $input = $request->only('name', 'purcase_price', 'sell_price');
         Product::create($input);
         return redirect('product/create');
     }
 }
示例#2
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(Request $request)
 {
     $inputData = $request->all();
     Product::create($inputData);
 }