Exemplo n.º 1
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     //
     $v = Validator::make(Request::all(), ['name' => 'required|max:30|unique:industries']);
     if ($v->fails()) {
         return redirect()->back()->withErrors($v->errors())->withInput();
     } else {
         $industry = new Industry();
         $industry->name = Request::get('name');
         $industry->save();
         return redirect('industries');
     }
 }
 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function create(Request $request)
 {
     if ($request['industryId'] != 0) {
         $retindustry = Industry::whereId($request['industryId'])->first();
         if ($retindustry) {
             $industry = Industry::find($request['industryId']);
             $industry->name = $request['name'];
             $industry->save();
             Session::flash('message', 'Industry Updated Successfully');
         }
     } else {
         $industry = new Industry();
         $industry->name = $request['name'];
         $industry->save();
         Session::flash('message', 'Industry added Successfully');
     }
     return Redirect::to('industry');
 }
Exemplo n.º 3
0
 public function updateIndustry(Request $request)
 {
     $rUser = new Industry();
     $rUser->name = $request['name'];
     $rUser->save();
     return redirect("/dataUpdate");
 }