/**
  * Update the specified resource in storage.
  *
  * @param  int $id
  * @param StoreaddClientPostRequest $request
  * @return Response
  */
 public function update(Client $client, StoreaddClientPostRequest $request)
 {
     $input = $request->all();
     $client->fill($input)->save();
     Session::flash('flash_message', 'Client successfully Updated!');
     return redirect()->back();
 }
Example #2
0
 public function store()
 {
     $rules = array('name' => 'required', 'country' => 'required', 'state' => 'required', 'city' => 'required', 'zip' => 'required', 'address' => 'required', 'contact' => 'required', 'phone' => 'required', 'email' => 'required|email', 'website' => 'url');
     $validator = Validator::make(Request::all(), $rules);
     if ($validator->passes()) {
         $store = new Client();
         $store->fill(Request::all());
         $store->save();
         // Reload Table Data
         $data_client = array('client' => Client::orderBy('id', 'desc')->get(), 'refresh' => true);
         return view('clients.table')->with($data_client);
     } else {
         if (Request::ajax()) {
             return view('clients.create')->withErrors($validator)->withInput(Request::all());
         }
         return 0;
     }
 }