Ejemplo n.º 1
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $rules = array('title' => 'required', 'type_id' => 'required', 'position' => 'integer|min:1', 'weight' => 'integer|min:1');
     $input = Input::except('_token');
     $validator = Validator::make($input, $rules);
     if ($validator->fails()) {
         return Redirect::action('AdminAboutUsController@create')->withErrors($validator)->withInput(Input::except('title'));
     } else {
         $viInputAboutUs = Input::only('type_id', 'title', 'description', 'weight');
         $viId = CommonNormal::create($viInputAboutUs);
         $enInput['title'] = Input::get('en_title');
         $enInput['description'] = Input::get('en_description');
         $typeNewIdRelate = Common::getValueLanguage('TypeAboutUs', Input::get('type_id'), 'relate_id');
         $enInput['type_id'] = $typeNewIdRelate;
         $enId = CommonNormal::create($enInput);
         //upload image new
         $inputImg['image_url'] = CommonUpload::uploadImage($viId, UPLOADIMG, 'image_url', UPLOAD_ABOUT);
         CommonNormal::update($viId, ['image_url' => $inputImg['image_url']]);
         CommonNormal::update($enId, ['image_url' => $inputImg['image_url']]);
         $language['model_name'] = 'AboutUs';
         $language['relate_name'] = 'AboutUs';
         $language['model_id'] = $viId;
         $language['relate_id'] = $enId;
         // $language['status'] = Input::get('status');
         // if(!empty(Input::get('position'))) {
         // 	$language['position'] = Input::get('position');
         // } else {
         // 	$language['position'] = 1;
         // }
         AdminLanguage::create($language);
         // insert ceo
         // CommonUpload::createSeo('AboutUs', $id, FOLDER_SEO_NEWS);
         return Redirect::action('AdminAboutUsController@index');
     }
 }
Ejemplo n.º 2
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $rules = array('name' => 'required', 'position' => 'required|integer|min: 1');
     $input = Input::except('_token');
     $validator = Validator::make($input, $rules);
     if ($validator->fails()) {
         return Redirect::action('AdminTypeAboutController@create')->withErrors($validator)->withInput(Input::except('name'));
     } else {
         $viInput = Input::only('name', 'name_shadow', 'position');
         $viInput['sort'] = Input::get('status');
         $id = CommonNormal::create($viInput);
         $enInput['name'] = Input::get('en_name');
         $enInput['name_shadow'] = Input::get('en_name_shadow');
         $enInput['position'] = Input::get('position');
         $enInput['sort'] = Input::get('status');
         $enId = CommonNormal::create($enInput);
         $language['model_name'] = 'TypeAboutUs';
         $language['relate_name'] = 'TypeAboutUs';
         $language['model_id'] = $id;
         $language['relate_id'] = $enId;
         $language['position'] = Input::get('position');
         $language['status'] = Input::get('status');
         AdminLanguage::create($language);
         return Redirect::action('AdminTypeAboutController@index');
     }
 }
Ejemplo n.º 3
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $input = Input::all();
     $viInput['title'] = $input['title'];
     $viInput['description'] = $input['description'];
     $viInput['css'] = $input['css'];
     $viInput['position'] = $input['position'];
     $idVi = CommonNormal::create($viInput);
     $enInput['title'] = $input['en_title'];
     $enInput['description'] = $input['en_description'];
     $enInput['css'] = $input['css'];
     $enInput['position'] = $input['position'];
     $idEn = CommonNormal::create($enInput);
     $language['model_name'] = 'Introduce';
     $language['relate_name'] = 'Introduce';
     $language['model_id'] = $idVi;
     $language['relate_id'] = $idEn;
     $language['position'] = $input['position'];
     $idLang = AdminLanguage::create($language)->id;
     if ($idLang) {
         return Redirect::action('AdminIntroduceController@index');
     }
     dd(123);
 }