PlaceController.php 519 B

1234567891011121314151617181920212223
  1. <?php
  2. namespace App\Http\Controllers;
  3. use Illuminate\Http\Request;
  4. use App\{
  5. Place,
  6. Status
  7. };
  8. class PlaceController extends Controller
  9. {
  10. public function show(Request $request, $id, $slug)
  11. {
  12. // TODO: Replace with vue component + apis
  13. $place = Place::whereSlug($slug)->findOrFail($id);
  14. $posts = Status::wherePlaceId($place->id)
  15. ->whereScope('public')
  16. ->orderByDesc('created_at')
  17. ->paginate(10);
  18. return view('discover.places.show', compact('place', 'posts'));
  19. }
  20. }