/** * Store a newly created resource in storage. * * @return Response */ public function store(OffreStageRequest $request, OffreStage $offre, CompetenceRepository $competence) { //Champs à vérifier pour mettre à NULL s'ils n'ont pas //été remplis. $date = Input::get('date_debut'); $duree = Input::get('duree'); $offre->date_debut = $date != "" ? date('Y-m-d', strtotime($date)) : null; $offre->title = Input::get('title'); $offre->duree = $duree == 0 ? null : $duree; $offre->promotion_id = Promotion::find(Input::get('promotion'))->id; $offre->specialite_id = Input::get('specialite'); $offre->description = Input::get('description'); $offre->nom_contact = Input::get('nom_contact'); $offre->email = Input::get('email'); $offre->tel = Input::get('tel'); $offre->horaire = Input::get('horaire'); $offre->adresse_stage = Input::get('adresse_stage'); $offre->gratification = Input::get('gratification'); $offre->user_id = Auth::user()->id; $result = $offre->save(); $competence->saveMultipe(Input::get('competence'), $offre); return $result; }