2023-08-15 23:05:51 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
|
|
|
|
use Illuminate\Http\Request;
|
|
|
|
use Illuminate\Support\Facades\Auth;
|
2024-02-20 23:33:49 +01:00
|
|
|
use App\Repositories\LocationRepository;
|
|
|
|
use App\Repositories\SourceRepository;
|
|
|
|
use App\Services\PaginationService;
|
2023-08-15 23:05:51 +02:00
|
|
|
|
|
|
|
class DenController extends Controller
|
|
|
|
{
|
2024-02-20 23:33:49 +01:00
|
|
|
protected $pagination;
|
|
|
|
protected $source;
|
|
|
|
|
|
|
|
public function __construct(
|
|
|
|
PaginationService $paginationService,
|
|
|
|
SourceRepository $sourceRepository,
|
|
|
|
LocationRepository $locationRepository
|
|
|
|
) {
|
|
|
|
$this->pagination = $paginationService;
|
|
|
|
$this->source = $sourceRepository;
|
|
|
|
$this->location = $locationRepository;
|
|
|
|
}
|
|
|
|
|
2023-08-15 23:05:51 +02:00
|
|
|
//
|
|
|
|
public function start(Request $request)
|
|
|
|
{
|
|
|
|
$member = Auth::user();
|
2023-08-19 03:50:33 +02:00
|
|
|
return view('back.start', [
|
|
|
|
'handle' => $member->handle,
|
2024-02-21 23:47:05 +01:00
|
|
|
'title' => "This is The Den",
|
|
|
|
'role' => $member->role
|
2023-08-19 03:50:33 +02:00
|
|
|
]);
|
2023-08-15 23:05:51 +02:00
|
|
|
}
|
2023-08-16 22:03:06 +02:00
|
|
|
|
2024-09-13 23:12:43 +02:00
|
|
|
public function profile(Request $request)
|
|
|
|
{
|
|
|
|
$member = Auth::user();
|
|
|
|
return view('back.profile', [
|
|
|
|
'handle' => $member->handle,
|
|
|
|
'title' => "Your Profile",
|
|
|
|
'role' => $member->role
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
2023-08-16 22:03:06 +02:00
|
|
|
public function member(Request $request)
|
|
|
|
{
|
|
|
|
$member = Auth::user();
|
2023-08-19 03:50:33 +02:00
|
|
|
return view('back.member', [
|
|
|
|
'handle' => $member->handle,
|
|
|
|
'title' => "Manage Members"]);
|
2023-08-16 22:03:06 +02:00
|
|
|
}
|
2023-08-17 02:52:02 +02:00
|
|
|
|
2024-02-21 23:47:05 +01:00
|
|
|
public function locations(Request $request)
|
|
|
|
{
|
|
|
|
$member = Auth::user();
|
|
|
|
return view('back.locations', [
|
|
|
|
'handle' => $member->handle,
|
|
|
|
'title' => "Manage Locations"]);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function listings(Request $request, $pageNum = 1)
|
2023-08-17 02:52:02 +02:00
|
|
|
{
|
|
|
|
$member = Auth::user();
|
2024-02-20 23:33:49 +01:00
|
|
|
$page = $this->pagination->getPage($pageNum);
|
2023-08-19 03:50:33 +02:00
|
|
|
return view('back.locations', [
|
2024-02-20 23:33:49 +01:00
|
|
|
'handle' => $member->handle,
|
|
|
|
'title' => "Manage Locations",
|
|
|
|
'sources' => count($this->source->getActive()),
|
|
|
|
"totalPages" => $page['pageCount'],
|
|
|
|
"prev" => $page['prev'],
|
|
|
|
"next" => $page['next'],
|
|
|
|
'pageNum' => $pageNum,
|
|
|
|
'locations' => $page['locations']
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function locationEdit(Request $request, $uuid = 0)
|
|
|
|
{
|
|
|
|
$location = $this->location->getLocation($uuid);
|
|
|
|
$sources = $this->source->getActive();
|
|
|
|
$name = "NO LOCATION FOUND";
|
|
|
|
if ($location) {
|
|
|
|
$name = $location->name;
|
|
|
|
}
|
|
|
|
$links = explode(",", $location->archive_links);
|
|
|
|
return view('back.location', [
|
|
|
|
'title' => str_replace(".", " ", $name),
|
|
|
|
'location' => $location,
|
|
|
|
'actions' => $location->block_count + $location->silence_count,
|
|
|
|
'sources_count' => count($sources),
|
|
|
|
'images' => json_decode($location->images),
|
|
|
|
'archive_links' => $links,
|
|
|
|
'updated' => $location->updated_at->format('Y M d'),
|
|
|
|
]);
|
2023-08-17 02:52:02 +02:00
|
|
|
}
|
2023-08-15 23:05:51 +02:00
|
|
|
}
|