예제 #1
0
 /**
  * Update the specified resource in storage.
  *
  * @param UpdateCompanyRequest $request
  * @param Company              $company
  *
  * @return \Illuminate\Http\Response
  */
 public function update(UpdateCompanyRequest $request, Company $company)
 {
     $user = Auth::user();
     if (!$this->userRepository->hasCompany($user, $company)) {
         Flash::error(trans('ahk_messages.you_do_not_have_the_necessary_privileges'));
         return back()->withInput();
     }
     $file = $request->file('logo_path');
     if (null !== $file) {
         $this->fileRepository->update($company->logo, [File::CLIENT_ORIGINAL_NAME => $file->getClientOriginalName(), File::TEMPORARY_PATH => $file->getRealPath()]);
     }
     if (!($company = $this->companyRepository->update($company, $request->all()))) {
         Flash::error(trans('ahk_messages.unknown_error_occurred'));
         return redirect()->back();
     }
     Flash::success(trans('ahk_messages.company_successfully_updated'));
     return redirect()->route('my.companies.edit', ['slug' => $company->slug]);
 }
예제 #2
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $companies = $this->companyRepository->paginate(4);
     $industries = $this->industryRepository->all();
     return view('ahk.companies.index', compact('companies', 'industries'));
 }
예제 #3
0
 /**
  * @return array
  */
 public function indexCompanies()
 {
     $companiesPagination = $this->companyRepository->paginate();
     $companies = $this->companyApiTransformer->transformCollection($companiesPagination);
     return $this->respondWithPagination($companiesPagination, ['data' => $companies]);
 }