/** * Store a newly created resource in storage. * * @return Response */ public function store(Services $services, ServiceRequest $request) { $imageModel = ImageUploadFacade::attachmentUpload($request->file('upl'), new Attachment(), 'services'); $services->attachment_id = $imageModel->id; $services->fill($request->all()); $services->save(); return redirect()->route('admin.services.index'); }
/** * Creates a new Services model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new Services(); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['view', 'id' => $model->id]); } else { return $this->render('create', ['model' => $model]); } }
/** * Creates a new Services model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new Services(); if ($model->load(Yii::$app->request->post())) { $model->service_status = 'Y'; if ($model->save()) { Yii::$app->session->setFlash('success', 'Layanan berhasil disimpan'); } return $this->redirect(['index']); } else { return $this->render('create', ['model' => $model]); } }