forked from projects/fipamo
implemented member repo class
a class for members was needed for long term handling of member functions like login, update, status checking, etc so that class was created and the AuthService class was removed as it was redundant and it's functionaity moved to the member class
This commit is contained in:
parent
36d04c8f68
commit
064407aa88
11 changed files with 115 additions and 71 deletions
|
@ -3,22 +3,24 @@
|
||||||
namespace App\Http\Controllers\API;
|
namespace App\Http\Controllers\API;
|
||||||
|
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Services\AuthService;
|
use App\Interfaces\MemberRepositoryInterface;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
class AuthAPIController extends Controller
|
class AuthAPIController extends Controller
|
||||||
{
|
{
|
||||||
|
protected $member;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
AuthService $authService
|
MemberRepositoryInterface $memberRepo
|
||||||
) {
|
) {
|
||||||
$this->auth = $authService;
|
$this->member = $memberRepo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function status(Request $request)
|
public function status(Request $request)
|
||||||
{
|
{
|
||||||
$result = [];
|
$result = [];
|
||||||
$data = json_decode($request->getContent());
|
$data = json_decode($request->getContent());
|
||||||
if ($this->auth::status()) {
|
if ($this->member::status()) {
|
||||||
$result = [
|
$result = [
|
||||||
'message' => 'Authorized',
|
'message' => 'Authorized',
|
||||||
'type' => 'apiUseAuthorized',
|
'type' => 'apiUseAuthorized',
|
||||||
|
|
|
@ -7,7 +7,7 @@ use Illuminate\Http\Request;
|
||||||
use App\Services\SettingsService;
|
use App\Services\SettingsService;
|
||||||
use App\Services\RenderService;
|
use App\Services\RenderService;
|
||||||
use App\Services\MaintenanceService;
|
use App\Services\MaintenanceService;
|
||||||
use App\Services\AuthService;
|
use App\Interfaces\MemberRepositoryInterface;
|
||||||
use App\Services\AssetService;
|
use App\Services\AssetService;
|
||||||
|
|
||||||
class SettingsAPIController extends Controller
|
class SettingsAPIController extends Controller
|
||||||
|
@ -15,20 +15,20 @@ class SettingsAPIController extends Controller
|
||||||
protected $settings;
|
protected $settings;
|
||||||
protected $render;
|
protected $render;
|
||||||
protected $mainteance;
|
protected $mainteance;
|
||||||
protected $auth;
|
protected $member;
|
||||||
protected $assets;
|
protected $assets;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
SettingsService $settingsService,
|
SettingsService $settingsService,
|
||||||
RenderService $renderService,
|
RenderService $renderService,
|
||||||
MaintenanceService $maintenanceService,
|
MaintenanceService $maintenanceService,
|
||||||
AuthService $authService,
|
MemberRepositoryInterface $memberRepo,
|
||||||
AssetService $assetService
|
AssetService $assetService
|
||||||
) {
|
) {
|
||||||
$this->settings = $settingsService;
|
$this->settings = $settingsService;
|
||||||
$this->render = $renderService;
|
$this->render = $renderService;
|
||||||
$this->maintenance = $maintenanceService;
|
$this->maintenance = $maintenanceService;
|
||||||
$this->auth = $authService;
|
$this->member = $memberRepo;
|
||||||
$this->assets = $assetService;
|
$this->assets = $assetService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ class SettingsAPIController extends Controller
|
||||||
|
|
||||||
public function downloadBackup(Request $request)
|
public function downloadBackup(Request $request)
|
||||||
{
|
{
|
||||||
if ($this->auth::status()) {
|
if ($this->member::status()) {
|
||||||
$latest = $this->settings->getGlobal()['last_backup'];
|
$latest = $this->settings->getGlobal()['last_backup'];
|
||||||
$file = 'backup-' . $latest . '.zip';
|
$file = 'backup-' . $latest . '.zip';
|
||||||
return response()->download('../content/backups/' . $file, $file, ['Content-Type: application/zip']);
|
return response()->download('../content/backups/' . $file, $file, ['Content-Type: application/zip']);
|
||||||
|
|
|
@ -3,15 +3,17 @@
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use App\Services\Data\AuthService;
|
use App\Interfaces\MemberRepositoryInterface;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
class AuthController extends Controller
|
class AuthController extends Controller
|
||||||
{
|
{
|
||||||
|
protected $member;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
AuthService $authService
|
MemberRepositoryInterface $memberRepository
|
||||||
) {
|
) {
|
||||||
$this->auth = $authService;
|
$this->member = $memberRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function enter(Request $request): Response
|
public function enter(Request $request): Response
|
||||||
|
@ -24,7 +26,7 @@ class AuthController extends Controller
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if ($credentials) {
|
if ($credentials) {
|
||||||
$result = $this->auth->check($request);
|
$result = $this->member->auth($request);
|
||||||
if ($result['status']) {
|
if ($result['status']) {
|
||||||
//$request->session()->regenerate();
|
//$request->session()->regenerate();
|
||||||
return redirect()->intended('dashboard/start');
|
return redirect()->intended('dashboard/start');
|
||||||
|
|
|
@ -3,25 +3,25 @@
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use App\Interfaces\PageRepositoryInterface;
|
use App\Interfaces\PageRepositoryInterface;
|
||||||
use App\Services\Data\AuthService;
|
use App\Interfaces\MemberRepositoryInterface;
|
||||||
use App\Services\Data\ThemeService;
|
use App\Services\Data\ThemeService;
|
||||||
use App\Services\Data\SortingService;
|
use App\Services\Data\SortingService;
|
||||||
|
|
||||||
class DashController extends Controller
|
class DashController extends Controller
|
||||||
{
|
{
|
||||||
protected PageRepositoryInterface $pages;
|
protected PageRepositoryInterface $pages;
|
||||||
protected AuthService $auth;
|
protected MemberRepositoryInterface $member;
|
||||||
protected ThemeService $themes;
|
protected ThemeService $themes;
|
||||||
protected SortingService $sort;
|
protected SortingService $sort;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
PageRepositoryInterface $pageRepository,
|
PageRepositoryInterface $pageRepository,
|
||||||
AuthService $authService,
|
MemberRepositoryInterface $memberRepo,
|
||||||
ThemeService $themeService,
|
ThemeService $themeService,
|
||||||
SortingService $sortingService
|
SortingService $sortingService
|
||||||
) {
|
) {
|
||||||
$this->pages = $pageRepository;
|
$this->pages = $pageRepository;
|
||||||
$this->auth = $authService;
|
$this->member = $memberRepo;
|
||||||
$this->themes = $themeService;
|
$this->themes = $themeService;
|
||||||
$this->sort = $sortingService;
|
$this->sort = $sortingService;
|
||||||
}
|
}
|
||||||
|
@ -54,11 +54,11 @@ class DashController extends Controller
|
||||||
|
|
||||||
public function login()
|
public function login()
|
||||||
{
|
{
|
||||||
if ($this->auth::status()) {
|
if ($this->member::status()) {
|
||||||
return redirect('dashboard');
|
return redirect('dashboard');
|
||||||
} else {
|
} else {
|
||||||
return view('back.login', [
|
return view('back.login', [
|
||||||
"status" => $this->auth::status(),
|
"status" => $this->member::status(),
|
||||||
"title" => "Hi!"
|
"title" => "Hi!"
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
@ -67,11 +67,11 @@ class DashController extends Controller
|
||||||
public function start()
|
public function start()
|
||||||
{
|
{
|
||||||
$result = [];
|
$result = [];
|
||||||
if ($this->auth::status()) {
|
if ($this->member::status()) {
|
||||||
$result = $this->pages->getGroup(1, 4);
|
$result = $this->pages->getGroup(1, 4);
|
||||||
}
|
}
|
||||||
return view('back.start', [
|
return view('back.start', [
|
||||||
"status" => $this->auth::status(),
|
"status" => $this->member::status(),
|
||||||
"result" => $result,
|
"result" => $result,
|
||||||
"title" => "Start"
|
"title" => "Start"
|
||||||
]);
|
]);
|
||||||
|
@ -80,7 +80,7 @@ class DashController extends Controller
|
||||||
public function book($pageFilter = 'all', $pageNum = 1)
|
public function book($pageFilter = 'all', $pageNum = 1)
|
||||||
{
|
{
|
||||||
$result = [];
|
$result = [];
|
||||||
if ($this->auth::status()) {
|
if ($this->member::status()) {
|
||||||
$result = $this->pages->getGroup($pageNum, 4, $pageFilter);
|
$result = $this->pages->getGroup($pageNum, 4, $pageFilter);
|
||||||
}
|
}
|
||||||
return view('back.book', [
|
return view('back.book', [
|
||||||
|
@ -101,7 +101,7 @@ class DashController extends Controller
|
||||||
$mode == 'edit' ? $views = $this->themes->getCustomViews($page['layout']) : $views[] = 'page';
|
$mode == 'edit' ? $views = $this->themes->getCustomViews($page['layout']) : $views[] = 'page';
|
||||||
|
|
||||||
return view('back.page', [
|
return view('back.page', [
|
||||||
"status" => $this->auth::status(),
|
"status" => $this->member::status(),
|
||||||
"mode" => $mode,
|
"mode" => $mode,
|
||||||
"page" => $page,
|
"page" => $page,
|
||||||
"views" => $views,
|
"views" => $views,
|
||||||
|
|
|
@ -5,7 +5,6 @@ namespace App\Http\Controllers;
|
||||||
use App\Interfaces\PageRepositoryInterface;
|
use App\Interfaces\PageRepositoryInterface;
|
||||||
use App\Services\Assets\AssetService;
|
use App\Services\Assets\AssetService;
|
||||||
use App\Services\Data\SettingsService;
|
use App\Services\Data\SettingsService;
|
||||||
use App\Services\Data\AuthService;
|
|
||||||
use App\Services\Data\SortingService;
|
use App\Services\Data\SortingService;
|
||||||
|
|
||||||
use function _\find;
|
use function _\find;
|
||||||
|
@ -13,7 +12,6 @@ use function _\find;
|
||||||
class FrontController extends Controller
|
class FrontController extends Controller
|
||||||
{
|
{
|
||||||
protected $settings;
|
protected $settings;
|
||||||
protected $auth;
|
|
||||||
protected PageRepositoryInterface $pages;
|
protected PageRepositoryInterface $pages;
|
||||||
protected AssetService $assets;
|
protected AssetService $assets;
|
||||||
protected SortingService $sort;
|
protected SortingService $sort;
|
||||||
|
@ -21,13 +19,11 @@ class FrontController extends Controller
|
||||||
public function __construct(
|
public function __construct(
|
||||||
PageRepositoryInterface $pageRepository,
|
PageRepositoryInterface $pageRepository,
|
||||||
SettingsService $settingsService,
|
SettingsService $settingsService,
|
||||||
AuthService $authService,
|
|
||||||
AssetService $assetService,
|
AssetService $assetService,
|
||||||
SortingService $sortService,
|
SortingService $sortService,
|
||||||
) {
|
) {
|
||||||
$this->pages = $pageRepository;
|
$this->pages = $pageRepository;
|
||||||
$this->settings = $settingsService;
|
$this->settings = $settingsService;
|
||||||
$this->auth = $authService;
|
|
||||||
$this->assets = $assetService;
|
$this->assets = $assetService;
|
||||||
$this->sort = $sortService;
|
$this->sort = $sortService;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use App\Services\Data\AuthService;
|
use App\Interfaces\MemberRepositoryInterface;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
class RouteController extends Controller
|
class RouteController extends Controller
|
||||||
|
@ -11,20 +11,20 @@ class RouteController extends Controller
|
||||||
protected $gate;
|
protected $gate;
|
||||||
protected $theme;
|
protected $theme;
|
||||||
protected $front;
|
protected $front;
|
||||||
protected $auth;
|
protected $member;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
DashController $dashController,
|
DashController $dashController,
|
||||||
AuthController $authController,
|
AuthController $authController,
|
||||||
ThemeController $themeController,
|
ThemeController $themeController,
|
||||||
FrontController $frontController,
|
FrontController $frontController,
|
||||||
AuthService $authService,
|
MemberRepositoryInterface $memberRepo,
|
||||||
) {
|
) {
|
||||||
$this->dash = $dashController;
|
$this->dash = $dashController;
|
||||||
$this->gate = $authController;
|
$this->gate = $authController;
|
||||||
$this->theme = $themeController;
|
$this->theme = $themeController;
|
||||||
$this->front = $frontController;
|
$this->front = $frontController;
|
||||||
$this->auth = $authService;
|
$this->member = $memberRepo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function get($first = null, $second = null, $third = null, $fourth = null)
|
public function get($first = null, $second = null, $third = null, $fourth = null)
|
||||||
|
@ -32,14 +32,14 @@ class RouteController extends Controller
|
||||||
if (isset($first) && !is_numeric($first)) {
|
if (isset($first) && !is_numeric($first)) {
|
||||||
switch ($first) {
|
switch ($first) {
|
||||||
case 'dashboard':
|
case 'dashboard':
|
||||||
if ($this->auth::status()) {
|
if ($this->member::status()) {
|
||||||
return $this->dash->init($second, $third, $fourth);
|
return $this->dash->init($second, $third, $fourth);
|
||||||
} else {
|
} else {
|
||||||
return $this->dash->login();
|
return $this->dash->login();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'theme':
|
case 'theme':
|
||||||
if ($this->auth::status()) {
|
if ($this->member::status()) {
|
||||||
if (isset($second)) {
|
if (isset($second)) {
|
||||||
return $this->theme->getView($third);
|
return $this->theme->getView($third);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -4,27 +4,27 @@ namespace App\Http\Controllers;
|
||||||
|
|
||||||
use App\Interfaces\PageRepositoryInterface;
|
use App\Interfaces\PageRepositoryInterface;
|
||||||
use App\Services\Assets\AssetService;
|
use App\Services\Assets\AssetService;
|
||||||
use App\Services\Data\AuthService;
|
use App\Interfaces\MemberRepositoryInterface;
|
||||||
use App\Services\Data\SortingService;
|
use App\Services\Data\SortingService;
|
||||||
use App\Services\Data\ThemeService;
|
use App\Services\Data\ThemeService;
|
||||||
|
|
||||||
class ThemeController extends Controller
|
class ThemeController extends Controller
|
||||||
{
|
{
|
||||||
protected PageRepositoryInterface $pages;
|
protected PageRepositoryInterface $pages;
|
||||||
protected AuthService $auth;
|
protected MemberRepositoryInterface $member;
|
||||||
protected AssetService $assets;
|
protected AssetService $assets;
|
||||||
protected SortingService $sort;
|
protected SortingService $sort;
|
||||||
protected ThemeService $themes;
|
protected ThemeService $themes;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
PageRepositoryInterface $pageRepository,
|
PageRepositoryInterface $pageRepository,
|
||||||
AuthService $authService,
|
MemberRepositoryInterface $memberRepo,
|
||||||
AssetService $assetService,
|
AssetService $assetService,
|
||||||
SortingService $sortService,
|
SortingService $sortService,
|
||||||
ThemeService $themeService,
|
ThemeService $themeService,
|
||||||
) {
|
) {
|
||||||
$this->pages = $pageRepository;
|
$this->pages = $pageRepository;
|
||||||
$this->auth = $authService;
|
$this->member = $memberRepo;
|
||||||
$this->assets = $assetService;
|
$this->assets = $assetService;
|
||||||
$this->sort = $sortService;
|
$this->sort = $sortService;
|
||||||
$this->themes = $themeService;
|
$this->themes = $themeService;
|
||||||
|
@ -32,9 +32,9 @@ class ThemeController extends Controller
|
||||||
|
|
||||||
public function start()
|
public function start()
|
||||||
{
|
{
|
||||||
if ($this->auth::status()) {
|
if ($this->member::status()) {
|
||||||
return view('theme.start', [
|
return view('theme.start', [
|
||||||
"status" => $this->auth::status(),
|
"status" => $this->member::status(),
|
||||||
"title" => "Fipamo Theme Kit",
|
"title" => "Fipamo Theme Kit",
|
||||||
"pages" => $this->themes->getCustomViews('page')
|
"pages" => $this->themes->getCustomViews('page')
|
||||||
]);
|
]);
|
||||||
|
@ -73,7 +73,7 @@ class ThemeController extends Controller
|
||||||
$page = $this->pages->getById('F4429D34-25E7-4CA9-9B0A-742810277505');
|
$page = $this->pages->getById('F4429D34-25E7-4CA9-9B0A-742810277505');
|
||||||
$pageData = $this->sort->page($page);
|
$pageData = $this->sort->page($page);
|
||||||
}
|
}
|
||||||
if ($this->auth::status()) {
|
if ($this->member::status()) {
|
||||||
return view($template, $pageData);
|
return view($template, $pageData);
|
||||||
} else {
|
} else {
|
||||||
return redirect('dashboard/start');
|
return redirect('dashboard/start');
|
||||||
|
|
22
app/Interfaces/MemberRepositoryInterface.php
Normal file
22
app/Interfaces/MemberRepositoryInterface.php
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Interfaces;
|
||||||
|
|
||||||
|
interface MemberRepositoryInterface
|
||||||
|
{
|
||||||
|
public function getAll();
|
||||||
|
|
||||||
|
public function getByID($id);
|
||||||
|
|
||||||
|
public function getByHandle($handle);
|
||||||
|
|
||||||
|
public function delete($id);
|
||||||
|
|
||||||
|
public function create($member);
|
||||||
|
|
||||||
|
public function update($id);
|
||||||
|
|
||||||
|
public function auth($request);
|
||||||
|
|
||||||
|
public static function status();
|
||||||
|
}
|
|
@ -6,6 +6,8 @@ use Illuminate\Support\ServiceProvider;
|
||||||
//Repos
|
//Repos
|
||||||
use App\Repositories\PageRepository;
|
use App\Repositories\PageRepository;
|
||||||
use App\Interfaces\PageRepositoryInterface;
|
use App\Interfaces\PageRepositoryInterface;
|
||||||
|
use App\Repositories\MemberRepository;
|
||||||
|
use App\Interfaces\MemberRepositoryInterface;
|
||||||
//Asset Services
|
//Asset Services
|
||||||
use App\Services\Assets\AssetService;
|
use App\Services\Assets\AssetService;
|
||||||
use App\Services\Assets\DocService;
|
use App\Services\Assets\DocService;
|
||||||
|
@ -13,7 +15,6 @@ use App\Services\Assets\FileUploadService;
|
||||||
use App\Services\Assets\RenderService;
|
use App\Services\Assets\RenderService;
|
||||||
//Data Services
|
//Data Services
|
||||||
use App\Services\Data\SettingsService;
|
use App\Services\Data\SettingsService;
|
||||||
use App\Services\Data\AuthService;
|
|
||||||
use App\Services\Data\ContentService;
|
use App\Services\Data\ContentService;
|
||||||
use App\Services\Data\PaginateService;
|
use App\Services\Data\PaginateService;
|
||||||
use App\Services\Data\ThemeService;
|
use App\Services\Data\ThemeService;
|
||||||
|
@ -34,10 +35,6 @@ class FipamoServiceProvider extends ServiceProvider
|
||||||
return new SettingsService(new DocService(), new ContentService());
|
return new SettingsService(new DocService(), new ContentService());
|
||||||
});
|
});
|
||||||
|
|
||||||
$this->app->bind(AuthService::class, function ($app) {
|
|
||||||
return new AuthService(new SettingsService(new DocService(), new ContentService()));
|
|
||||||
});
|
|
||||||
|
|
||||||
$this->app->bind(ContentService::class, function ($app) {
|
$this->app->bind(ContentService::class, function ($app) {
|
||||||
return new ContentService();
|
return new ContentService();
|
||||||
});
|
});
|
||||||
|
@ -103,5 +100,6 @@ class FipamoServiceProvider extends ServiceProvider
|
||||||
public function boot(): void
|
public function boot(): void
|
||||||
{
|
{
|
||||||
$this->app->bind(PageRepositoryInterface::class, PageRepository::class);
|
$this->app->bind(PageRepositoryInterface::class, PageRepository::class);
|
||||||
|
$this->app->bind(MemberRepositoryInterface::class, MemberRepository::class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,25 +1,62 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Services\Data;
|
namespace App\Repositories;
|
||||||
|
|
||||||
|
use App\Interfaces\MemberRepositoryInterface;
|
||||||
use ReallySimpleJWT\Token;
|
use ReallySimpleJWT\Token;
|
||||||
|
|
||||||
use function _\find;
|
use function _\find;
|
||||||
|
|
||||||
class AuthService
|
class MemberRepository implements MemberRepositoryInterface
|
||||||
{
|
{
|
||||||
protected $config;
|
protected $folks;
|
||||||
protected $request;
|
|
||||||
|
|
||||||
public function __construct(SettingsService $config)
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->config = $config;
|
if (file_exists(env('FOLKS_PATH'))) {
|
||||||
|
$this->folks = json_decode(file_get_contents(env('FOLKS_PATH')), true);
|
||||||
|
} else {
|
||||||
|
$this->folks = json_decode(file_get_contents('../content/init/folks-template.json'), true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function check($request)
|
public function getAll()
|
||||||
{
|
{
|
||||||
$folks = $this->config->getFolks();
|
return $this->$folks;
|
||||||
$found = find($folks, ['handle' => $request->handle]);
|
}
|
||||||
|
|
||||||
|
public function getById($id)
|
||||||
|
{
|
||||||
|
$member = find($this->folks, ['id' => $id]);
|
||||||
|
return $member;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getByHandle($handle)
|
||||||
|
{
|
||||||
|
$member = find($this->folks, ['handle' => $handle]);
|
||||||
|
return $member;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function delete($id)
|
||||||
|
{
|
||||||
|
//delete member stuff
|
||||||
|
}
|
||||||
|
|
||||||
|
public function create($member)
|
||||||
|
{
|
||||||
|
//make new member
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update($id)
|
||||||
|
{
|
||||||
|
//update member data
|
||||||
|
}
|
||||||
|
|
||||||
|
public function auth($request)
|
||||||
|
{
|
||||||
|
//suth stuff
|
||||||
|
$folks = $this->folks;
|
||||||
|
$found = $this->getByHandle($request->handle);
|
||||||
if ($found) {
|
if ($found) {
|
||||||
if (password_verify($request->password, $found['password'])) {
|
if (password_verify($request->password, $found['password'])) {
|
||||||
$member = [
|
$member = [
|
|
@ -10,20 +10,12 @@ use function _\find;
|
||||||
class SettingsService
|
class SettingsService
|
||||||
{
|
{
|
||||||
protected $settings;
|
protected $settings;
|
||||||
protected $folks;
|
|
||||||
protected $tags;
|
protected $tags;
|
||||||
protected $docs;
|
protected $docs;
|
||||||
protected $contents;
|
protected $contents;
|
||||||
|
|
||||||
public function __construct(DocService $docService, ContentService $contentService)
|
public function __construct(DocService $docService, ContentService $contentService)
|
||||||
{
|
{
|
||||||
//if config files aren't avaiable, load templates
|
|
||||||
if (file_exists(env('FOLKS_PATH'))) {
|
|
||||||
$this->folks = json_decode(file_get_contents(env('FOLKS_PATH')), true);
|
|
||||||
} else {
|
|
||||||
$this->folks = json_decode(file_get_contents('../content/init/folks-template.json'), true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (file_exists(env('TAGS_PATH'))) {
|
if (file_exists(env('TAGS_PATH'))) {
|
||||||
$this->tags = json_decode(file_get_contents(env('TAGS_PATH')), true);
|
$this->tags = json_decode(file_get_contents(env('TAGS_PATH')), true);
|
||||||
} else {
|
} else {
|
||||||
|
@ -74,11 +66,6 @@ class SettingsService
|
||||||
return $this->tags;
|
return $this->tags;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getFolks()
|
|
||||||
{
|
|
||||||
return $this->folks;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function updatePageIndex()
|
public function updatePageIndex()
|
||||||
{
|
{
|
||||||
$this->settings = $this->loadSettings();
|
$this->settings = $this->loadSettings();
|
||||||
|
|
Loading…
Reference in a new issue