public function store(Request $request)
 {
     $note = new Note();
     $note->content = $request->get('content');
     $note->save();
     return back();
 }
Beispiel #2
0
 public function store(Request $request)
 {
     $note = new Note();
     $note->fill($request->all());
     $note->user_id = Auth::user()->id;
     $note->save();
     return redirect()->back()->withSuccess(config('constants.SAVED'));
 }
Beispiel #3
0
 /**
  * Get the note for this property.
  */
 public function note()
 {
     $foreignKey = 'strKey';
     $localKey = 'strKey';
     $instance = new Note();
     $instance->setConnection($this->getConnectionName());
     //dd($instance->getConnection());
     return new HasOne($instance->newQuery(), $this, $foreignKey, $localKey);
     //return $this->hasOne('App\Note','strKey' ,'strKey' );
 }
 public function post(Note $note, Request $request)
 {
     if (Auth::check()) {
         $this->validate($request, ['title' => ['required', 'min:3'], 'content' => ['required', 'min:3']]);
         $input = $request->only('title', 'content');
         $input = array_add($input, 'user_id', Auth::user()->id);
         $note->create($input);
         return back();
     } else {
         $errors = ['ERROR: You are not logged in, and are not authorized to add posts.'];
         return back()->withErrors(compact('errors'));
     }
 }
 public function store()
 {
     $this->validate(request(), ['note' => ['required', 'max:200']]);
     $data = request()->all();
     Note::create($data);
     return redirect()->to('notes');
 }
 public function test_notes_summary_and_notes_details()
 {
     $text = 'Begin of the note. Dicta laborum animi nostrum qui sed dolorum. Enim magni odit est dignissimos ut et laboriosam. Facere laboriosam et dolorem et laborum blanditiis. Corrupti fugit et in eos omnis voluptas.';
     $text .= 'End of the note';
     $note = Note::create(['note' => $text]);
     $this->visit('notes')->see('Begin of the note')->seeInElement('.label', 'Others')->dontSee('End of the note')->seeLink('View note')->click('View note')->see($text);
 }
Beispiel #7
0
 public function test_notes_summary_and_notes_details()
 {
     $text = 'Begin of the note Unde rerum odio magni aut aut aut voluptatem consequatur. Doloribus nemo facere voluptas saepe. Vel id aperiam quia qui ex ipsum. Consequatur quas recusandae ut consequatur veniam. Ipsa fugit dolorem quaerat blanditiis.';
     $text .= 'End of the note';
     $note = Note::create(['note' => $text]);
     $this->visit('notes')->see('Begin of the note')->seeInElement('.label', 'Others')->dontSee('End of the note')->seeLink('View note')->click('View note')->see($text)->seeLink('View all notes', 'notes');
 }
 public function setTop($id, $result, Request $request)
 {
     $note = Note::findOrFail($id);
     $note->istop = $result;
     $note->save();
     return redirect(URL::previous());
 }
 public function search(Request $request)
 {
     $results = array();
     $term = $request->get('term');
     $goals = Goal::where('body', 'like', '%' . $term . '%')->orderBy('body', 'asc')->get();
     $objectives = Objective::where('body', 'like', '%' . $term . '%')->orderBy('body', 'asc')->get();
     $actions = Action::where('body', 'like', '%' . $term . '%')->orderBy('body', 'asc')->get();
     $tasks = Task::where('body', 'like', '%' . $term . '%')->orderBy('body', 'asc')->get();
     $teams = Team::where('name', 'like', '%' . $term . '%')->orderBy('name', 'asc')->get();
     $departments = Department::where('name', 'like', '%' . $term . '%')->orderBy('name', 'asc')->get();
     $users = User::where('name', 'like', '%' . $term . '%')->orderBy('name', 'asc')->get()->all();
     foreach (User::where('email', 'like', '%' . $term . '%')->orderBy('name', 'asc')->get() as $matching_user_email) {
         if (in_array($matching_user_email, $users)) {
             continue;
         }
         $users[] = $matching_user_email;
     }
     $notes = Note::where('content', 'like', '%' . $term . '%')->orderBy('content', 'asc')->get();
     $types = [$goals, $objectives, $actions, $tasks, $teams, $departments, $users, $notes];
     foreach ($types as $type) {
         foreach ($type as $result) {
             $results[] = $result;
         }
     }
     return view('search.show')->with('results', $results)->with('term', $term);
 }
Beispiel #10
0
 public function destroy($note_id)
 {
     $user = Auth::user();
     $note = Note::findOrFail($note_id);
     $note->delete();
     return redirect('/home');
 }
Beispiel #11
0
 public function test_notes_list()
 {
     // having
     Note::create(['note' => 'My first note']);
     Note::create(['note' => 'Second note']);
     // When
     $this->visit('notes')->see('My first note')->see('Second note');
 }
Beispiel #12
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(Request $request)
 {
     //return $request->get('note_id');
     $note = Note::find($request->get('note_id'));
     if (count($note) > 0) {
         $note->past = 1;
         $note->save();
     }
     $stripped_note = str_replace("'", ''', $request->get('note'));
     $new_note = new Note();
     $new_note->user_id = $request->get('user_id');
     $new_note->note = $stripped_note;
     $new_note->device_id = $request->get('device_id');
     $new_note->past = 0;
     $new_note->save();
     return redirect()->back();
 }
 public function delete(Request $request)
 {
     $notes = Note::all();
     foreach ($notes as $note) {
         $note->delete();
     }
     return back();
 }
Beispiel #14
0
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id, Request $request)
 {
     $actif = 'notes';
     $note = Note::FindOrFail($id);
     $note->update($request->all());
     /* a changer mettre la vue show normalement*/
     return redirect(route('notes.index'));
 }
Beispiel #15
0
 /**
  *  Returns all next related notes (next means bigger id)
  *
  *  @return  App\Note  The next notes
  */
 public function next()
 {
     // Eager load all attached notes with a bigger ID than this
     $nextNotes = Note::whereHas('notes', function ($query) {
         $query->where('note2_id', '=', $this->id);
         $query->where('note1_id', '>', $this->id);
     })->get(['id']);
     return $nextNotes;
 }
Beispiel #16
0
 public function saveNotes()
 {
     $input = \Input::all();
     $user = \App\User::where('email', Session::get('email'))->first();
     $notes = \App\Note::where('user_id', $user->id)->first();
     $note = \input::get('notes');
     $site = null;
     for ($i = 1; $i < count($input); $i++) {
         if (array_key_exists("website" . $i, $input)) {
             if (strlen(\input::get('website' . $i)) > 0) {
                 $site = $site . \input::get('website' . $i);
                 $site = $site . "\r\n";
             }
         }
     }
     $tbd = \input::get('tbd');
     $image = \Input::file('file');
     $file = null;
     if ($image != null) {
         $file = file_get_contents($image);
     }
     if ($notes == null) {
         $notes = Note::create(array('note' => $note, 'website' => $site, 'tbd' => $tbd, 'user_id' => $user->id, 'image1' => $file));
     } else {
         $notes->note = $note;
         $notes->website = $site;
         $notes->tbd = $tbd;
         $notes->user_id = $user->id;
         if ($notes->image1 == null) {
             $notes->image1 = $file;
         } elseif ($notes->image2 == null) {
             $notes->image2 = $file;
         } elseif ($notes->image3 == null) {
             $notes->image3 = $file;
         } elseif ($notes->image4 == null) {
             $notes->image4 = $file;
         }
         $notes->save();
     }
     if (\input::get('delete1') == 1) {
         $notes->image1 = null;
         $notes->save();
     }
     if (\input::get('delete2') == 1) {
         $notes->image2 = null;
         $notes->save();
     }
     if (\input::get('delete3') == 1) {
         $notes->image3 = null;
         $notes->save();
     }
     if (\input::get('delete4') == 1) {
         $notes->image4 = null;
         $notes->save();
     }
     return view('notes')->with('notes', $notes);
 }
 public function destroy($id)
 {
     $note = Note::findOrFail($id);
     if ($note->delete()) {
         return response(204);
     } else {
         return response(500);
     }
 }
 public function index()
 {
     $heads = Head::lists('name', 'id');
     $notes = Note::latest('id')->paginate(20);
     $bizs = Busines::all();
     $orgs = Organization::all();
     $forumHeads = forumHead::all();
     return view('admin.index', compact('notes', 'bizs', 'orgs', 'forumHeads', 'heads'));
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Contact $contact, Request $request, $id)
 {
     //
     $note = Note::find($id);
     $note->update($request->except('note_date'));
     $note->note_date = Carbon::parse($request->input('note_date'));
     $note->save();
     return redirect()->route('contacts.show', ['id' => $contact->id]);
 }
Beispiel #20
0
 public function deleteNote(Request $request)
 {
     $noteid = $request['noteid'];
     $note = Note::find($noteid);
     $user = Auth::user();
     if ($note->user_id == $user->id) {
         $note->delete();
         return 1;
     }
 }
 public function index()
 {
     $activities = Activity::where('istop', 1)->where('states', 0)->orderBy('order_number')->get();
     $guides = Guide::where('isbest', '=', 1)->orderBy('orders')->take(6)->get();
     $topNotes = Note::topNotes()->with('user')->take(6)->get();
     //$users = User::topUsers()->take(10)->get();
     $adverts = Banner::where('tag', 'indexAdvert')->take(2)->get();
     $banners = Banner::where('tag', 'indexBanner')->orderBy('orders')->get();
     return view('index', compact('activities', 'guides', 'topNotes', 'adverts', 'banners'));
 }
 public function show($id)
 {
     $guide = Guide::findOrFail($id);
     $topNotes = Note::topNotes()->with('user')->take(6)->get();
     $guide->load('comments.user');
     $guide->incHits();
     $faved = Auth::check() && GuideFav::exists(Auth::user()->id, $guide->id);
     $liked = Auth::check() && GuideLike::exists(Auth::user()->id, $guide->id);
     return view('guide.show', compact('guide', 'faved', 'liked', 'topNotes'));
 }
 /**
  * Show the application welcome screen to the user.
  *
  * @return Response
  */
 public function index()
 {
     $actif = 0;
     $preference = Preference::first();
     $notes = Note::where('etat', 1)->orderBy('created_at', 'desc')->paginate(5);
     $contacts = Contact::where('etat', 1)->orderBy('created_at', 'desc')->paginate(5);
     $societes = Societe::where('etat', 1)->orderBy('created_at', 'desc')->paginate(5);
     $devis = Devis::where('etat_devis', 1)->orderBy('created_at', 'desc')->paginate(5);
     return view('accueil', compact('actif', 'preference', 'notes', 'contacts', 'societes', 'devis'));
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $user = Auth::user()->id;
     $categories = Category::where('user_id', '=', $user)->get();
     foreach ($categories as $category) {
         $noteCount = Note::where('category_id', '=', $category->id)->count();
         $category->count = $noteCount;
     }
     return Response::json($categories, 200);
 }
Beispiel #25
0
 /**
  *  Shows a tag and displays all associated notes
  *
  *  @param   integer  $id  Tag id
  *
  *  @return  Response
  */
 public function show($id)
 {
     if (!$id || $id <= 0) {
         return redirect(url('/tags/index'))->withErrors(['message' => 'No such tag']);
     }
     $tag = Tag::find($id);
     $notes = Note::whereHas('tags', function ($query) use($id) {
         $query->where('tag_id', '=', $id);
     })->get();
     return view('tags.show', compact('notes', 'tag'));
 }
Beispiel #26
0
 /**
  *  Looper function that traverses all possible trails
  *
  *  @param   App\Note   $note    The current note (also a node)
  *  @param   boolean  $isRoot  Only given for the "start" note in index function
  *
  *  @return  Illuminate\Support\Collection            A collection of all notes found
  */
 public function getTrails($note, $isRoot = false)
 {
     $nextNotes = $note->next();
     if (count($nextNotes) > 0) {
         if ($isRoot) {
             $nr = [];
         } else {
             $nr = new Collection();
         }
         foreach ($nextNotes as $next) {
             if ($isRoot) {
                 $nr[] = $this->getTrails($next)->prepend($note->id);
             } else {
                 $nr = $nr->merge($this->getTrails($next)->prepend($note->id));
             }
         }
         return $nr;
     } else {
         return new Collection($note->id);
     }
 }
Beispiel #27
0
 /**
  * Show the application dashboard.
  *
  * @return \Illuminate\Http\Response
  */
 public function home()
 {
     // Some general statistics
     $notes = Note::all();
     $noteCount = count($notes);
     $references = Reference::all();
     $referenceCount = count($references);
     $tags = Tag::all();
     $tagCount = count($tags);
     $outlines = Outline::all();
     $outlineCount = count($outlines);
     return view('app.main', compact('noteCount', 'referenceCount', 'tagCount', 'outlineCount'));
 }
 public function likeNote($id)
 {
     $userId = Auth::user()->id;
     if (!NoteLike::exists($userId, $id)) {
         $note = Note::findOrFail($id);
         $noteLike = new NoteLike();
         $noteLike->note_id = $id;
         $noteLike->user_id = $userId;
         $noteLike->save();
         $note->updateLikes();
         return $note->likes;
     }
     return -1;
 }
 public function showPastAuditions()
 {
     $auditionsStatuses = AuditionStatus::where('user_id', Auth::user()->id)->get();
     $auditions = collect();
     foreach ($auditionsStatuses as $audition) {
         $audition_details = Audition::find($audition->audition_id);
         if ($audition_details->ended) {
             $audition_details->status = $audition;
             $audition_details->notes = Note::where('audition_status_id', $audition->id)->get();
             $auditions->push($audition_details);
         }
     }
     return view('past', ['auditions' => $auditions]);
 }
Beispiel #30
0
 /**
  * Show the application dashboard.
  *
  * @return \Illuminate\Http\Response
  */
 public function index(Request $request)
 {
     // show the user home page
     $user = Auth::user();
     // authenticated user
     $tags = Note::existingTags()->sortBy('slug');
     $filter = $request->f;
     if ($filter !== null) {
         $notes = $user->notes()->withAnyTag($filter)->latest('updated_at')->paginate(5);
     } else {
         $notes = $user->notes()->latest('updated_at')->paginate(5);
     }
     return view('home', compact('user', 'notes', 'tags', 'filter'));
 }