コード例 #1
0
 /**
  * Show the form for editing the specified Contracts.
  * @param  int $id
  * @return Response
  */
 public function edit($id)
 {
     $contracts = $this->contractsRepository->find($id);
     if (empty($contracts)) {
         Flash::error('Contracts not found');
         return redirect(route('contracts.index'));
     }
     $users = \DB::table('users')->lists('email', 'id');
     $contracttypes = \DB::table('contracttypes')->lists('type', 'id');
     $outlinesports = \DB::table('outlinesports')->lists('sport', 'id');
     $naturezas = \DB::table('naturezas')->lists('natureza', 'id');
     $profitcenters = \DB::table('profitcenters')->lists('profitcenter', 'id');
     $taxationtypes = \DB::table('taxationtypes')->lists('type', 'id');
     $gyms = \App\Gym::all();
     $gymb = \DB::table('contract_gym')->where('contract_id', $id)->get(['gym_id']);
     $catracas = \App\Catraca::all();
     $catracab = \DB::table('catraca_contract')->where('contract_id', $id)->get(['catraca_id']);
     $turmas = \App\Turma::all();
     $turmab = \DB::table('contract_turma')->where('contract_id', $id)->get(['turma_id']);
     return view('contracts.edit')->with('contracts', $contracts)->with('users', $users)->with('contracttypes', $contracttypes)->with('outlinesports', $outlinesports)->with('naturezas', $naturezas)->with('profitcenters', $profitcenters)->with('taxationtypes', $taxationtypes)->with('gyms', $gyms)->with('catracas', $catracas)->with('turmas', $turmas)->with('gymb', $gymb)->with('catracab', $catracab)->with('turmab', $turmab);
 }
コード例 #2
0
 /**
  * Update the specified Gyms in storage.
  * @param  int              $id
  * @param UpdateGymsRequest $request
  * @return Response
  */
 public function update($id, UpdateGymsRequest $request)
 {
     $gyms = $this->gymsRepository->find($id);
     if (empty($gyms)) {
         Flash::error('Gyms not found');
         return redirect(route('gyms.index'));
     }
     $logotipoAtual = $gyms->logotipo;
     $logotipoNovo = $request->logotipo;
     $gyms = $this->gymsRepository->updateRich($request->all(), $id);
     if ($logotipoNovo) {
         if ($logotipoAtual) {
             if (\File::exists(base_path() . '/public/images/' . $logotipoAtual)) {
                 \File::Delete(base_path() . '/public/images/' . $logotipoAtual);
             }
         }
         $name = Input::file('logotipo')->getClientOriginalName();
         Image::make(Input::file('logotipo'))->save(base_path() . '/public/images/' . $name);
         $gym = \App\Gym::find($id);
         $gym->logotipo = $name;
         $gym->save();
     }
     Flash::success('Gyms updated successfully.');
     return redirect(route('gyms.index'));
 }
コード例 #3
0
 /**
  * Show the form for editing the specified Services.
  * @param  int $id
  * @return Response
  */
 public function edit($id)
 {
     $services = $this->servicesRepository->find($id);
     if (empty($services)) {
         Flash::error('Services not found');
         return redirect(route('services.index'));
     }
     $users = \DB::table('users')->lists('email', 'id');
     $naturezas = \DB::table('naturezas')->lists('natureza', 'id');
     $profitcenters = \DB::table('profitcenters')->lists('profitcenter', 'id');
     $taxationtypes = \DB::table('taxationtypes')->lists('type', 'id');
     $gyms = \App\Gym::all();
     $gymb = \DB::table('gym_service')->where('service_id', $id)->get(['gym_id']);
     return view('services.edit')->with('services', $services)->with('users', $users)->with('naturezas', $naturezas)->with('profitcenters', $profitcenters)->with('taxationtypes', $taxationtypes)->with('gyms', $gyms)->with('gymb', $gymb);
 }
コード例 #4
0
 /**
  * Update the specified resource in storage.
  *
  * @param  Gym
  * @param  GymRequest
  * @return \Illuminate\Http\Response
  */
 public function update(Gym $gym, GymRequest $request)
 {
     $gym->update($request->all());
     return redirect()->action('GymsController@show', $gym);
 }
コード例 #5
0
 /**
  * Store a newly created resource in storage.
  * 
  * @param  Organization
  * @param  Gym
  * @return \Illuminate\Http\Response
  */
 public function store(Gym $gym, Request $request)
 {
     $role = new GymRole($request->all());
     $gym->roles()->save($role);
     return redirect()->action('GymsController@edit', $role->gym);
 }