web.php 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. /*
  3. |--------------------------------------------------------------------------
  4. | Web Routes
  5. |--------------------------------------------------------------------------
  6. |
  7. | Here is where you can register web routes for your application. These
  8. | routes are loaded by the RouteServiceProvider within a group which
  9. | contains the "web" middleware group. Now create something great!
  10. |
  11. */
  12. /** @var \Illuminate\Routing\Router $this */
  13. $this->get('/tasks', 'TasksController@index');
  14. $this->get('/tasks/{task}', 'TasksController@show');
  15. /*
  16. Route::get('/tasks', function () {
  17. $name = 'Fred';
  18. // $tasks = DB::table('tasks')->get();
  19. $tasks = Task::all();
  20. // Return a JSON response from the serialized results.
  21. // return $tasks;
  22. return view('tasks.index', compact('name', 'tasks'));
  23. });
  24. Route::get('/tasks/{task}', function ($id) {
  25. // $task = DB::table('tasks')->find($id);
  26. $task = Task::find($id);
  27. // Return a JSON response from the serialized results.
  28. // return $tasks;
  29. return view('tasks.show', compact('task'));
  30. });
  31. */