PostsController.php 805 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. /*
  3. * This file is part of the Jiannei/lumen-api-starter.
  4. *
  5. * (c) Jiannei <longjian.huang@foxmail.com>
  6. *
  7. * This source file is subject to the MIT license that is bundled
  8. * with this source code in the file LICENSE.
  9. */
  10. namespace App\Http\Controllers;
  11. use App\Repositories\Models\Post;
  12. use App\Services\PostService;
  13. use Jiannei\Response\Laravel\Support\Facades\Response;
  14. class PostsController extends Controller
  15. {
  16. private $service;
  17. public function __construct(PostService $service)
  18. {
  19. // $this->middleware('auth:api', ['except' => []]);
  20. $this->service = $service;
  21. }
  22. public function index()
  23. {
  24. // $this->authorize('viewAny', Post::class);
  25. $posts = $this->service->handleSearchList();
  26. return Response::success($posts);
  27. }
  28. }