mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-26 00:03:16 +00:00
Update PlaceController, add place directory methods
This commit is contained in:
parent
8f5c0dd4ed
commit
37b88bcb1b
1 changed files with 23 additions and 2 deletions
|
@ -12,12 +12,33 @@ class PlaceController extends Controller
|
||||||
{
|
{
|
||||||
public function show(Request $request, $id, $slug)
|
public function show(Request $request, $id, $slug)
|
||||||
{
|
{
|
||||||
// TODO: Replace with vue component + apis
|
|
||||||
$place = Place::whereSlug($slug)->findOrFail($id);
|
$place = Place::whereSlug($slug)->findOrFail($id);
|
||||||
$posts = Status::wherePlaceId($place->id)
|
$posts = Status::wherePlaceId($place->id)
|
||||||
|
->whereNull('uri')
|
||||||
->whereScope('public')
|
->whereScope('public')
|
||||||
->orderByDesc('created_at')
|
->orderByDesc('created_at')
|
||||||
->paginate(10);
|
->simplePaginate(10);
|
||||||
|
|
||||||
return view('discover.places.show', compact('place', 'posts'));
|
return view('discover.places.show', compact('place', 'posts'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function directoryHome(Request $request)
|
||||||
|
{
|
||||||
|
$places = Place::select('country')
|
||||||
|
->distinct('country')
|
||||||
|
->simplePaginate(48);
|
||||||
|
|
||||||
|
return view('discover.places.directory.home', compact('places'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function directoryCities(Request $request, $country)
|
||||||
|
{
|
||||||
|
$country = urldecode($country);
|
||||||
|
$places = Place::whereCountry($country)
|
||||||
|
->orderBy('name', 'asc')
|
||||||
|
->distinct('name')
|
||||||
|
->simplePaginate(48);
|
||||||
|
|
||||||
|
return view('discover.places.directory.cities', compact('places'));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue