mirror of
https://koodu.h-i.works/projects/thebadspace
synced 2025-06-25 16:04:37 -05:00
admin account set up
after the site is installed and the DB set up, there needed to be a way to create the first account that will be used as the admin to access the den, the admin section of tbs the system makes a check to see if this account exists and if there isn't one present, it shows the admin account set up screen on the index. it goes away after the account is created.
This commit is contained in:
@ -6,39 +6,49 @@ use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use App\Repositories\LocationRepository;
|
||||
use App\Repositories\SourceRepository;
|
||||
use App\Repositories\MemberRepository;
|
||||
use App\Services\PaginationService;
|
||||
|
||||
class FrontIndexController extends Controller
|
||||
{
|
||||
protected $location;
|
||||
protected $source;
|
||||
protected $member;
|
||||
protected $pagination;
|
||||
|
||||
public function __construct(
|
||||
LocationRepository $locationRepository,
|
||||
SourceRepository $sourceRepository,
|
||||
MemberRepository $memberRepository,
|
||||
PaginationService $paginationService
|
||||
) {
|
||||
$this->location = $locationRepository;
|
||||
$this->source = $sourceRepository;
|
||||
$this->member = $memberRepository;
|
||||
$this->pagination = $paginationService;
|
||||
}
|
||||
|
||||
public function start()
|
||||
{
|
||||
//for fresh installs that dont have any source data yet
|
||||
$latest_update = 'Never Run';
|
||||
if(count($this->location->getRecent()) != 0)
|
||||
{
|
||||
$latest_update = $this->location->getRecent()[0]->updated_at->format('Y M d');
|
||||
//check to see if there are any accounts
|
||||
if (count($this->member->getAll()) == 0) {
|
||||
return view('back.member', [
|
||||
'mode' => 'admin-create',
|
||||
'title' => "Welcome, welcome"]);
|
||||
} else {
|
||||
//for fresh installs that dont have any source data yet
|
||||
$latest_update = 'Never Run';
|
||||
if (count($this->location->getRecent()) != 0) {
|
||||
$latest_update = $this->location->getRecent()[0]->updated_at->format('Y M d');
|
||||
}
|
||||
return view('front.index', [
|
||||
'count' => count($this->location->getActiveLocations()),
|
||||
'sources' => count($this->source->getActive()),
|
||||
'recent' => $this->location->getRecent(),
|
||||
'latest_date' => $latest_update,
|
||||
'title' => "The Bad Space"
|
||||
]);
|
||||
}
|
||||
return view('front.index', [
|
||||
'count' => count($this->location->getActiveLocations()),
|
||||
'sources' => count($this->source->getActive()),
|
||||
'recent' => $this->location->getRecent(),
|
||||
'latest_date' => $latest_update,
|
||||
'title' => "The Bad Space"
|
||||
]);
|
||||
}
|
||||
|
||||
public function indexSearch(Request $request)
|
||||
|
Reference in New Issue
Block a user