/**
  * Update the specified resource in storage.
  *
  * @param  int $id
  * @return Response
  */
 public function update(CompanyRequest $request, $id)
 {
     $company = Company::findOrFail($id);
     $input = $request->all();
     $company->update($input);
     return redirect('company');
 }
Beispiel #2
0
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(CompanyRequest $request, $id)
 {
     $companies = \App\Company::findOrFail($id);
     $companies->update($request->all());
     flash()->success('Company ' . $companies->company_name . ' successfully updated!');
     #dd(flash());
     return redirect('/companies');
 }
Beispiel #3
0
 /**
  * Update the specified resource in storage.
  *
  * @param  CompanyRequest  $request
  * @return JsonResponse
  */
 public function update(CompanyRequest $request)
 {
     $data = $request->only('title', 'short_description', 'description');
     if (!empty($_FILES['avatar']['tmp_name'])) {
         $path = config('image.paths.company');
         $fileName = Auth::user()->id . '.' . date('His.dmY') . '.jpg';
         $image = new Image();
         $image->setFile($_FILES['avatar']['tmp_name']);
         $image->setPath($path);
         $image->fit(Image::MEDIUM)->upload($fileName);
         if (!empty(Auth::user()->company->avatar)) {
             $image->delete(Auth::user()->company->avatar);
         }
         $data['avatar'] = $fileName;
     }
     Auth::user()->company->update($data);
     return redirect('m/agency/create')->with('flash_message', Lang::get('system.update'));
 }
 public function update($id, CompanyRequest $request)
 {
     $company = Company::findOrFail($id);
     $company->update($request->all());
     return Redirect::to('empresas');
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(\App\Http\Requests\CompanyRequest $request, $id)
 {
     # try
     # {
     #    \DB::beginTransaction();
     $company = $this->companies->find($id);
     $this->companies->update($request->except(['phone', 'email', 'address', '_token', '_method']), $company->id);
     $this->companies->updateEmails($request->get('email'), $company->id);
     $this->companies->updatePhones($request->get('phone'), $company->id);
     $this->companies->updateAddress($request->get('address'), $company->id);
     #    	\DB::commit();
     #  }
     # catch(Exception $e)
     # {
     #    \DB::rollback();
     #   \Session::flash('delete_message', 'Something went wrong.');
     #   return redirect ('companies.edit', $company->id);
     #}
     \Session::flash('update_message', 'Company has been updated');
     return redirect('companies');
 }
Beispiel #6
0
 /**
  * Update the photo on user model resource in storage.
  *
  * @param  \Illuminate\Http\Request $request
  * @param  int $id
  * @return \Illuminate\Http\Response
  */
 public function updateLogo(CompanyRequest $request, $slug)
 {
     $company = Company::where(compact('slug'))->firstOrFail();
     // Check authorisation and throw 404 if not
     if (!Auth::user()->allowedTo('edit', 'company', $company)) {
         return view('errors/404');
     }
     $file = $request->file('logo');
     $path = "filebank/company/" . $company->id;
     $name = "logo." . strtolower($file->getClientOriginalExtension());
     $path_name = $path . '/' . $name;
     $file->move($path, $name);
     Image::make(url($path_name))->fit(740)->save($path_name);
     $company->logo_profile = $path_name;
     $company->save();
     Toastr::success("Saved changes");
     return redirect('/company/' . $company->slug . '/settings/logo');
 }
Beispiel #7
0
 /**
  * Update the specified resource in storage.
  *
  * @param  CompanyRequest   $request
  * @param  Company          $company
  * @return Response
  */
 public function update(CompanyRequest $request, Company $company)
 {
     $company->update($request->all());
     return redirect('quan-tri/cong-ty')->with('flash_message', Lang::get('system.update'));
 }
Beispiel #8
0
 /**
  * Function Store
  * to Save/Update Brand From Brand Form
  * @Request @Name,@Code etc
  *
  * @return json
  */
 public function onStore(\App\Http\Requests\CompanyRequest $request)
 {
     $is_exist = \App\Models\Company::where('name', $request->get('name'))->where('id', '!=', $request->get('id'))->get(['id'])->first();
     if ($is_exist) {
         $param['error'] = true;
         $param['message'] = Lang::get('message.companies unique name');
         return json_encode($param);
     }
     $companies = new \App\Models\Company();
     if ($request->has('id')) {
         $companies = $companies->where('id', $request->get('id'))->first();
         $companies->updated_at = date('Y-m-d H:i:s');
         $companies->updated_by = Auth::user()->id;
     } else {
         $companies->created_at = date('Y-m-d H:i:s');
         $companies->created_by = Auth::user()->id;
     }
     $companies->_id = $request->get('company_id');
     $companies->name = $request->get('name');
     $companies->active = $request->get('active') ? $request->get('active') : 0;
     $companies->save();
     $param['id'] = $companies->id;
     $param['message'] = $request->get('id') ? Lang::get('info.updated') : Lang::get('info.inserted');
     $param['error'] = false;
     return json_encode($param);
 }