/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit($id) { $array['offre'] = OffreStage::where('offre_stages.id', $id)->with('competences')->first(); if (isset($array['offre']->date_debut)) { $array['offre']->date_debut = date('Y-m', strtotime($array['offre']->date_debut)); } $array['competences']['mine'] = $array['offre']->competences->lists('id'); $array['promotions'] = Promotion::all(); $array['competences']['all'] = Competence::all(); $array['entreprises'] = Entreprise::all(); return $array; }
/** * Retoure la liste des offres de stages dont la promotion associée * est rattachée au modérateur. * * @return mixed */ public function getOffreStageModerateurAvecEntreprises() { return OffreStage::where('valide', 0)->whereHas('promotion.moderateurs', function ($q) { $q->where('moderateurs.id', Auth::user()->user->id); })->with('entreprise')->get(); }