web.php 1015 B

1234567891011121314151617181920212223242526272829303132333435363738
  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. Route::get('/tasks', 'TasksController@index');
  13. Route::get('/tasks/{task}', 'TasksController@show');
  14. /*
  15. Route::get('/tasks', function () {
  16. $name = 'Fred';
  17. // $tasks = DB::table('tasks')->get();
  18. $tasks = Task::all();
  19. // Return a JSON response from the serialized results.
  20. // return $tasks;
  21. return view('tasks.index', compact('name', 'tasks'));
  22. });
  23. Route::get('/tasks/{task}', function ($id) {
  24. // $task = DB::table('tasks')->find($id);
  25. $task = Task::find($id);
  26. // Return a JSON response from the serialized results.
  27. // return $tasks;
  28. return view('tasks.show', compact('task'));
  29. });
  30. */