public function index() { $professores = User::select('users.id', 'users.name')->where('tipo_usuario', '=', 1)->get(); $turmas = Turma::all(); // Show the page return view('admin.professorturmas.index', compact('professores', 'turmas')); }
public function create(Aluno $a, Turma $t) { $alunos = $a->all()->lists('alu_nome', 'id')->sortByDesc('id')->toArray(); $totalDeAlunos = count($alunos); $turmas = $t->all()->lists('tur_nome', 'id')->sortByDesc('id')->toArray(); $flag = array('acao' => 'cadastrar'); return view('pagamento.create', ['turmas' => $turmas, 'alunos' => $alunos, 'totalDeAlunos' => $totalDeAlunos, 'flag' => $flag]); }
public function destroy($id) { $aluno = Aluno::find($id); $aluno->delete(); $t = new Turma(); $turmas = $t->all()->lists('tur_nome', 'id'); $a = new Aluno(); $alunos = $a->all(); return view('aluno.create', ['alunos' => $alunos, 'turmas' => $turmas]); }
/** * 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); }
public function getJsonTurmas(Turma $turmas, Request $requests) { if ($requests->has("term")) { $result = $turmas->where("tur_nome", "like", "%" . $requests->term . "%")->get(); } else { $result = $turmas->all(); } $list = []; foreach ($result as $key => $value) { $list[$key]['id'] = $value->id; $list[$key]['text'] = $value->tur_nome; } return $list; }