Exemplo n.º 1
0
 /**
  * Creates a new ProductType model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new ProductType();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
Exemplo n.º 2
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request $request
  * @return \Illuminate\Http\Response
  */
 public function store(ProductTypeRequest $request)
 {
     $product_type = new ProductType();
     $product_type->title = $request->input(['title']);
     $product_type->status = 1;
     $product_type->created_at = time();
     $product_type->created_by = Auth::user()->id;
     $product_type->save();
     Session()->flash('flash_message', 'Data has been Saved');
     return redirect('product_types');
 }
Exemplo n.º 3
0
 protected function fakeProductType()
 {
     $fakeProductType = new ProductType();
     $fakeProductType->product_type_name = "Fake Product Type";
     $fakeProductType->save();
     return $fakeProductType;
 }