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);
 }
 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');
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(NoteRequest $request)
 {
     $data = $request->all();
     $data['user_id'] = Auth::user()->id;
     $n = Note::create($data);
     return redirect('/store/' . $n->store_id);
 }
Exemple #4
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store()
 {
     $this->validate(request(), ['note' => ['required', 'max:200']]);
     $data = request()->all();
     Note::create($data);
     return redirect()->to('notes');
 }
Exemple #5
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');
 }
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $input = Input::all();
     $input['user'] = Auth::id();
     print_r($input);
     Note::create($input);
     return redirect('/')->with('msg', 'success');
 }
 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 save()
 {
     $data = Input::all();
     $note = Note::create($data);
     if ($note) {
         return response()->json($note);
     } else {
         return response(500);
     }
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Contact $contact, Request $request)
 {
     //
     $note = Note::create($request->except('note_date'));
     $note->note_date = Carbon::createFromFormat('n/d/Y', $request->input('note_date'));
     $note->user_id = $contact->id;
     $note->create_user_id = \Auth::user()->id;
     $note->save();
     return redirect()->route('contacts.show', ['id' => $contact->id]);
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(NoteRequest $request)
 {
     $note = Note::create($request->all());
     $uid = Auth::user()->id;
     $note->creator = $uid;
     $note->updateDescription();
     $thumb = $request->file('thumb');
     $note->saveThumb($thumb);
     return redirect('/u/' . $uid . '/notes');
 }
 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'));
     }
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store()
 {
     $rules = ['title' => 'required|min:2', 'body_text' => 'required|min:5|max:10000', 'is_public' => 'required'];
     $validator = \Validator::make(Input::only('title', 'body_text', 'is_public'), $rules);
     if ($validator->fails()) {
         return redirect()->back()->withInput()->withErrors($validator);
     }
     $note = Note::create(['title' => Input::get('title'), 'body_text' => $this->clear_tags(Input::get('body_text')), 'is_public' => Input::get('is_public')]);
     if (Input::get('collection') > 0) {
         $collection = Collection::find(Input::get('collection'));
         $collection->notes()->save($note);
     }
     $user = Auth::User();
     $user->notes()->save($note);
     $note->save();
     Flash::success('Note created!');
     return redirect()->route('notes.show', $note->id);
 }
Exemple #13
0
 public function handleAction(Request $request)
 {
     $action = $request->input('_action');
     if ($action == 'addNote') {
         $param = '';
         if ($request['private'] == 'yes') {
             $param = 'PRIVATE';
         } else {
             $param = 'PUBLIC';
         }
         $note = Note::create($request->all());
         $note->scope = $param;
         $note->save();
         return response(['status' => 'success']);
     } else {
         if ($action == "deleteNote") {
             $note = Note::find($request->input('id'));
             $note->delete();
             return response(['status' => 'success']);
         } else {
             return response(['status' => 'error']);
         }
     }
 }
 public function run()
 {
     DB::table('notes')->delete();
     Note::create(['note' => 'The Name']);
 }
Exemple #15
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(Request $request)
 {
     $actif = 'notes';
     $note = Note::create($request->all());
     return view('notes.create', compact('actif', 'note'));
 }
<?php

use Illuminate\Http\Request;
Route::get('/', ['as' => 'notes.index', 'uses' => 'NoteController@index']);
Route::get('/api/store', ['as' => 'notes.store', 'uses' => 'APINoteController@store']);
Route::post('/api/store', function (Request $request) {
    \App\Note::create($request->all());
});
Route::get('/delete', ['as' => 'notes.delete', 'uses' => 'NoteController@delete']);
Route::get('/api/all', function () {
    return \App\Note::orderBy('id', 'desc')->limit(15)->get();
});
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(Request $request)
 {
     $actif = 'contact';
     $note = Note::create($request->all());
     if (isset($request->contact_id_create)) {
         $id = $request->contact_id_create;
         return redirect(route('contact.show', $id));
     } else {
         return view('notes.aff_note', compact('note', 'actif'));
     }
     /*return redirect(route('notes.index'));
     		return view('notes.create',compact('actif','note'));*/
 }
 /**
  * Function that submits a note response of specified order.
  *
  * @return Response
  */
 public function orderNoteResponse()
 {
     // Validate Input.
     $validator = Validator::make(Input::all(), array('orderId' => 'required', 'noteResponse' => 'required'));
     if ($validator->fails()) {
         return response()->json(['error' => 'Se debe escribir algo en la nota!']);
     }
     // Check that user is part of authorized staff.
     if (Auth::user()->Type != 1) {
         // If they are unauthorized no point in returning anything.
         return response()->json(array());
     }
     // Get the current user Id.
     $userId = Auth::user()->Id;
     // Create note.
     Note::create(array('OrderId' => Input::get('orderId'), 'UserId' => $userId, 'Date' => date('Y-m-d'), 'Content' => Input::get('noteResponse')));
     return response()->json(['response' => 'success']);
 }