コード例 #1
0
 public function addTask(Request $req, $name_liste)
 {
     $param = $req::all();
     if ($param['task'] != "" && strtotime($param['date']) != 0) {
         $tache = new \App\Tache();
         $tache->name_user = Auth::user()->email;
         $tache->name_liste = $name_liste;
         $tache->etat_tache = "No";
         $tache->tache = $param['task'];
         $tache->date = $param['date'];
         $tache->save();
         // Update nombre de tâche de Liste
         $log = Auth::user()->email;
         $liste = new \App\Liste();
         $liste = Liste::where('name_liste', $name_liste)->where('name_user', $log)->first();
         $liste->tache_tot = $liste->tache_tot + 1;
         $liste->save();
         return redirect()->route('index');
     } else {
         //
         //$this->fail = 'erreur';
         //echo $this->fail ;
         if (Auth::check()) {
             $log = Auth::user()->email;
             $todo = DB::table('listes')->where('name_user', $log)->get();
         } else {
             $todo = null;
         }
         $this->erreur = "yes";
         return view('index', ['todo' => $todo, 'erreur' => $this->erreur]);
     }
 }
コード例 #2
0
 public function createTache(Request $request)
 {
     if (Auth::user()) {
         $id = Auth::user()->id;
     }
     $tache = new Tache();
     $tache->UserId = $id;
     $tache->name = $request->input('nom');
     $tache->Description = $request->input('Description');
     $tache->save();
     return redirect()->back();
 }
コード例 #3
0
 public function ajouttache(Requests\reqcreertache $req)
 {
     $param = $req->all();
     //verif voir Requests\reqcreertache
     //Stocker dans la bdd
     $tache = new \App\Tache();
     $tache->nom = $param['inputtacheprincipal'];
     $tache->idutilisateur = Auth::user()->id;
     $tache->description = $param['descriptionprincipal'];
     $tache->save();
     //Redirection vers accueil
     return redirect()->route('listtaches')->with('status', 'OK, c\'est enregistré');
 }
コード例 #4
0
 public function ajout_tache(Request $rq, $id_liste)
 {
     $info = $rq->all();
     $addTach = new Tache();
     $addTach->id_users = Auth::user()->id;
     $addTach->id_liste = $id_liste;
     $addTach->nom_tache = $info['nom_tache'];
     $addTach->Description = $info['Description'];
     $addTach->date_creation = $info['date_creation'];
     $addTach->accomplissement = $info['accomplissement'];
     $addTach->save();
     return redirect('membres/liste_tache/' . $id_liste);
 }
コード例 #5
0
ファイル: TachesController.php プロジェクト: lc0991/Todo
 public function createTache(TacheCreateRequest $req)
 {
     $tache = new Tache($req->all());
     $tache->save();
     return redirect()->back()->with('status', 'Tâche sauvegardée !');
 }