web.php 771 B

123456789101112131415161718192021222324252627
  1. <?php
  2. /*
  3. |--------------------------------------------------------------------------
  4. | Application Routes
  5. |--------------------------------------------------------------------------
  6. |
  7. | Here is where you can register all of the routes for an application.
  8. | It is a breeze. Simply tell Lumen the URIs it should respond to
  9. | and give it the Closure to call when that URI is requested.
  10. |
  11. */
  12. $router->get('/', function () use ($router) {
  13. return '欢迎来到由你';
  14. });
  15. $router->get('/test', function () use ($router) {
  16. return 'test';
  17. });
  18. $router->get('/fragment/detail/{id:[0-9]+}', ['as'=> 'fragment.detail', function ($id) use ($router) {
  19. $desc = \App\Models\Post::where('id',$id)->value('content');
  20. return view('post.detail', ['desc'=>$desc]);
  21. }]);