/**
  * Send back all notes as JSON
  *
  * @return Response
  */
 public function index()
 {
     return Response::json(Note::orderBy('created_at', 'DESC')->get());
 }
Example #2
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $notes = Note::orderBy('updated_at', 'desc')->get();
     $actif = 'notes';
     return view('notes.index', compact('notes', 'actif'));
 }
<?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();
});
 public function index()
 {
     $notes = Note::orderBy('updated_at', 'desc')->get();
     return view('notes.index', ['pageTitle' => 'Notes'])->with(['notes' => $notes]);
 }
 public function index()
 {
     $notes = Note::orderBy('id', 'desc')->get();
     return view('index', ['notes' => $notes]);
 }