forked from projects/thebadspace
ro
0eeab6355e
changed the the way files are uploaded to go into their own directory called 'references' organized by location, identified by uuid. the 'references' directory was added to git ignore to those images are not saved in the repo, since every install will have their own set of images also updated reference links to be shown on the front end if they have been added to a location unnecessary links where moved from the admin member template since they have been incorporated into the appropriate area. a template for editing member account information has also been added.
99 lines
2.9 KiB
PHP
99 lines
2.9 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Support\Facades\Auth;
|
|
use App\Repositories\LocationRepository;
|
|
use App\Repositories\SourceRepository;
|
|
use App\Services\PaginationService;
|
|
|
|
class DenController extends Controller
|
|
{
|
|
protected $pagination;
|
|
protected $source;
|
|
|
|
public function __construct(
|
|
PaginationService $paginationService,
|
|
SourceRepository $sourceRepository,
|
|
LocationRepository $locationRepository
|
|
) {
|
|
$this->pagination = $paginationService;
|
|
$this->source = $sourceRepository;
|
|
$this->location = $locationRepository;
|
|
}
|
|
|
|
//
|
|
public function start(Request $request)
|
|
{
|
|
$member = Auth::user();
|
|
return view('back.start', [
|
|
'handle' => $member->handle,
|
|
'title' => "This is The Den",
|
|
'role' => $member->role
|
|
]);
|
|
}
|
|
|
|
public function profile(Request $request)
|
|
{
|
|
$member = Auth::user();
|
|
return view('back.profile', [
|
|
'handle' => $member->handle,
|
|
'title' => "Your Profile",
|
|
'role' => $member->role
|
|
]);
|
|
}
|
|
|
|
public function member(Request $request)
|
|
{
|
|
$member = Auth::user();
|
|
return view('back.member', [
|
|
'handle' => $member->handle,
|
|
'title' => "Manage Members"]);
|
|
}
|
|
|
|
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)
|
|
{
|
|
$member = Auth::user();
|
|
$page = $this->pagination->getPage($pageNum);
|
|
return view('back.locations', [
|
|
'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'),
|
|
]);
|
|
}
|
|
}
|