Initial Commit

The initial public commit of MVGL website code.
This commit is contained in:
Jimmy B. 2024-01-14 13:51:43 -06:00
commit b39ecf1638
2043 changed files with 215154 additions and 0 deletions

15
.editorconfig Normal file
View file

@ -0,0 +1,15 @@
root = true
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
[*.md]
trim_trailing_whitespace = false
[*.{yml,yaml}]
indent_size = 2

5
.gitattributes vendored Normal file
View file

@ -0,0 +1,5 @@
* text=auto
*.css linguist-vendored
*.scss linguist-vendored
*.js linguist-vendored
CHANGELOG.md export-ignore

40
.gitignore vendored Normal file
View file

@ -0,0 +1,40 @@
/node_modules
/public/hot
/public/storage
/public/css
/public/js
/public/media
/public/plugins
/public/demo1
/public/demo2
/public/demo3
/public/demo4
/public/demo5
/public/demo6
/public/demo7
/public/demo8
/public/demo9
/public/demo10
/public/demo11
/public/demo12
/public/demo13
/storage/*.key
/vendor
.env
.env.backup
.env.example
.phpunit.result.cache
docker-compose.override.yml
Homestead.json
Homestead.yaml
npm-debug.log
yarn-error.log
_ide_helper.php
_ide_helper_models.php
.phpstorm.meta.php
composer.lock
.push.settings.jsonc
config/changelog.php

8
.phpcs.xml Normal file
View file

@ -0,0 +1,8 @@
<?xml version="1.0"?>
<ruleset name="Ignored Directories">
<exclude-pattern>*/node_modules/*</exclude-pattern>
<exclude-pattern>*/resources/assets/*</exclude-pattern>
<exclude-pattern>*/storage/*</exclude-pattern>
<exclude-pattern>*/vendor/*</exclude-pattern>
<rule ref="PSR12" />
</ruleset>

13
.styleci.yml Normal file
View file

@ -0,0 +1,13 @@
php:
preset: laravel
disabled:
- no_unused_imports
finder:
not-name:
- index.php
- server.php
js:
finder:
not-name:
- webpack.mix.js
css: true

41
app/Console/Kernel.php Normal file
View file

@ -0,0 +1,41 @@
<?php
namespace App\Console;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
class Kernel extends ConsoleKernel
{
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands = [
//
];
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
// $schedule->command('inspire')->hourly();
}
/**
* Register the commands for the application.
*
* @return void
*/
protected function commands()
{
$this->load(__DIR__ . '/Commands');
require base_path('routes/console.php');
}
}

View file

@ -0,0 +1,47 @@
<?php
namespace App\Core\Adapters;
abstract class BootstrapBase
{
public static function initBase()
{
theme()->addHtmlAttribute('body', 'id', 'kt_body');
if (theme()->isDarkModeEnabled() && theme()->getCurrentMode() === 'dark') {
theme()->addHtmlClass('body', 'dark-mode');
}
if (theme()->getOption('layout', 'main/body/background-image')) {
theme()->addHtmlAttribute('body', 'style', 'background-image: url(' . asset(theme()->getMediaUrlPath() . theme()->getOption('layout', 'main/body/background-image')) . ')');
}
if (theme()->getOption('layout', 'main/body/class')) {
theme()->addHtmlClass('body', theme()->getOption('layout', 'main/body/class'));
}
if (theme()->getOption('layout', 'main/body/attributes')) {
theme()->addHtmlAttributes('body', theme()->getOption('layout', 'main/body/attributes'));
}
if (theme()->getOption('layout', 'loader/display') === true) {
theme()->addHtmlClass('body', 'page-loading-enabled');
theme()->addHtmlClass('body', 'page-loading');
}
}
public static function run()
{
if (theme()->getOption('layout', 'base') === 'docs') {
return;
}
// Init base
static::initBase();
// Init layout
if (theme()->getOption('layout', 'main/type') === 'default') {
static::initLayout();
}
}
}

View file

@ -0,0 +1,61 @@
<?php
namespace App\Core\Adapters;
/**
* Adapter class to make the Metronic core lib compatible with the Laravel functions
*
* Class Menu
*
* @package App\Core\Adapters
*/
class Menu extends \App\Core\Menu
{
public function build()
{
ob_start();
parent::build();
return ob_get_clean();
}
/**
* Filter menu item based on the user permission using Spatie plugin
*
* @param $array
*/
public static function filterMenuPermissions(&$array)
{
if (!is_array($array)) {
return;
}
$user = auth()->user();
$checkPermission = $checkRole = false;
if (auth()->check()) {
// check if the spatie plugin functions exist
$checkPermission = method_exists($user, 'hasAnyPermission');
$checkRole = method_exists($user, 'hasAnyRole');
}
foreach ($array as $key => &$value) {
if (is_callable($value)) {
continue;
}
if ($checkPermission && isset($value['permission']) && !$user->hasAnyPermission((array) $value['permission'])) {
unset($array[$key]);
}
if ($checkRole && isset($value['role']) && !$user->hasAnyRole((array) $value['role'])) {
unset($array[$key]);
}
if (is_array($value)) {
self::filterMenuPermissions($value);
}
}
}
}

501
app/Core/Adapters/Theme.php Normal file
View file

@ -0,0 +1,501 @@
<?php
namespace App\Core\Adapters;
use Illuminate\Contracts\View\View;
use Illuminate\Support\Facades\Route;
use Illuminate\Support\Str;
/**
* Adapter class to make the Metronic core lib compatible with the Laravel functions
*
* Class Theme
*
* @package App\Core\Adapters
*/
class Theme extends \App\Core\Theme
{
public static $page = '';
public function __construct()
{
}
/**
* Set demo to initialize
*
* @param string $demo
*/
public static function setDemo($demo = 'demo1')
{
Theme::$demo = $demo;
}
/**
* Print HTML classes in the HTML class attribute
*
* @param $scope
* @param bool $full
*
* @return false|string
*/
public static function printHtmlClasses($scope, $full = true)
{
ob_start();
// Call the function from core Theme
\App\Core\Theme::printHtmlClasses($scope, $full);
return ob_get_clean();
}
/**
* Print the SVG icon content as HTML
* Use {!! getSvgIcon !!} in blade template file
*
* @param $path
* @param string $class
* @param string $svgClass
*
* @return mixed
*/
public static function getSvgIcon($path, $class = '', $svgClass = '')
{
// Call the function from core Theme
return get_svg_icon($path, $class, $svgClass);
}
/**
* Get the route or URL
*
* @param $path
* @param string $demo
*
* @return string
*/
public static function getPageUrl($path, $demo = '', $mode = null)
{
$params = [];
if (isset($_REQUEST['rtl']) && $_REQUEST['rtl']) {
$params['rtl'] = 1;
}
if (isset($_REQUEST['demo']) && $_REQUEST['demo']) {
$params['demo'] = $_REQUEST['demo'];
}
if ($mode !== null) {
if ($mode) {
$params['mode'] = $mode;
}
} elseif (isset($_REQUEST['mode']) && $_REQUEST['mode']) {
$params['mode'] = $_REQUEST['mode'];
}
if (!empty($demo)) {
$params['demo'] = $demo;
}
$a = '';
if (count($params) && $path !== '#') {
$a = '?' . http_build_query($params);
}
// check if the route exist in the laravel
$name = str_replace('/', '.', $path);
if (Route::has($name)) {
return route($name) . $a;
}
// otherwise return as url
return url($path) . $a;
}
/**
* Print HTML attributes
*
* @param $scope
*
* @return false|string
*/
public static function printHtmlAttributes($scope)
{
ob_start();
// Call the function from core Theme
\App\Core\Theme::printHtmlAttributes($scope);
return ob_get_clean();
}
/**
* Print CSS variables
*
* @param $scope
*
* @return false|string
*/
public static function printCssVariables($scope)
{
ob_start();
// Call the function from core Theme
\App\Core\Theme::printCssVariables($scope);
return ob_get_clean();
}
/**
* This function is wrapper function of Laravel view()
* All view files under "layout" has a demo, this helps to append the demo name into the path
*
* @param $path
* @param array $params
*
* @return View
*/
public static function getView($path, $params = array(), $once = false)
{
// Check if the layout file exist
if (view()->exists($path)) {
return view($path, $params);
}
// Append demo folder for layout view
if (Str::startsWith($path, 'layout')) {
$path = str_replace('layout', 'layout/' . self::$demo, $path);
}
$view = view($path, $params);
// Special fix to print _mega-menu content for Core/Theme.php
if (strpos($path, '_mega-menu') !== false) {
echo $view;
}
return $view;
}
/**
* Print fonts in the HTML head
*
* @param string $value
*/
public static function includeFonts($value = '')
{
if (self::hasOption('assets', 'fonts/google')) {
$fonts = self::getOption('assets', 'fonts/google');
echo '<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=' . implode('|', $fonts) . '"/>';
}
}
/**
* Check if the option has a value
*
* @param $scope
* @param false $path
*
* @return bool
*/
public static function hasOption($scope, $path = false)
{
return (bool) self::getOption($scope, $path);
}
/**
* Get the option's value from config
*
* @param $scope
* @param false $path
* @param null $default
*
* @return mixed|string
*/
public static function getOption($scope, $path = false, $default = null)
{
$demo = self::getDemo() ?? 'demo1';
// Map the config path
if (array_key_exists($scope, config($demo . '.general', []))) {
$scope = 'general.' . $scope;
}
if (in_array($scope, ['page', 'pages'])) {
$scope = 'pages';
$segments = request()->segments();
$scope .= '.' . implode('.', $segments);
}
// Get current page path
$deepPath = '';
if (!empty($path)) {
$deepPath = '.' . str_replace('/', '.', $path);
}
// Demo config
$demoConfig = config($demo . '.' . $scope . $deepPath, $default);
// check if it is a callback
if (is_callable($demoConfig) && !is_string($demoConfig)) {
$demoConfig = $demoConfig();
}
return $demoConfig;
}
/**
* Get current demo
*
* @return string
*/
public static function getDemo()
{
if (class_exists('request')) {
return request()->input('demo', self::$demo);
}
return self::$demo;
}
/**
* Get the product name string wrapped with the <strong> tag
*
* @return string
*/
public static function getProductNameHtml()
{
return '<strong>' . self::getProductName() . ' Laravel</strong>&nbsp;';
}
/**
* Get plain product name text
*
* @return mixed|string
*/
public static function getProductName()
{
return self::getOption('product', 'name');
}
/**
* Get the version number string from config file
*
* @return mixed
*/
public static function getVersion()
{
$versions = array_keys(config('changelog', []));
if (isset($versions[0])) {
return str_replace('v', '', $versions[0]);
}
return null;
}
/**
* Get the current page title from config page.php
*/
public static function getPageTitle()
{
return theme()->getOption('page', 'title');
}
/**
* Get current route name and replace with a new route name
*
* @param $name
*
* @return string
*/
public static function subRoute($name)
{
$routes = explode('.', Route::currentRouteName());
array_pop($routes);
$parent = implode('.', $routes);
return $parent . '.' . $name;
}
public static function putProVersionTooltip($attr = array())
{
ob_start();
// Call the function from core Theme
parent::putProVersionTooltip($attr);
return ob_get_clean();
}
public static function getIllustrationUrl($file, $dark = true)
{
if ($dark === true) {
if (self::isDarkMode()) {
$file = str_replace(".svg", "-dark.svg", $file);
$file = str_replace(".png", "-dark.png", $file);
$file = str_replace(".jpg", "-dark.jpg", $file);
}
}
$folder = 'illustrations/' . self::getOption('layout', 'illustrations/set');
return self::getMediaUrlPath() . $folder . '/' . $file;
}
/**
* Check dark mode
*
* @return mixed|string
*/
public static function isDarkMode()
{
return self::getCurrentMode() === 'dark';
}
/**
* Get current skin
*
* @return mixed|string
*/
public static function getCurrentMode()
{
if (self::isDarkModeEnabled() && isset($_REQUEST['mode']) && $_REQUEST['mode']) {
return $_REQUEST['mode'];
}
return 'light';
}
/**
* Check if current theme has dark mode
*
* @return bool
*/
public static function isDarkModeEnabled()
{
return (bool) self::getOption('layout', 'main/dark-mode-enabled');
}
/**
* Get media path
*
* @return string
*/
public static function getMediaUrlPath()
{
return theme()->getDemo() . '/media/';
}
public static function getImageUrl($folder, $file, $dark = true)
{
if ($dark) {
if (self::isDarkMode()) {
$file = str_replace(".svg", "-dark.svg", $file);
$file = str_replace(".png", "-dark.png", $file);
$file = str_replace(".jpg", "-dark.jpg", $file);
}
}
return self::getMediaUrlPath() . $folder . '/' . $file;
}
/**
* Rebuild config and merge with main and page config level in boot
*/
public function initConfig()
{
$mainConfig = collect(config('global'));
$demoConfig = config(Theme::$demo);
$mergedConfig = $mainConfig->replaceRecursive($demoConfig);
config([Theme::$demo => $mergedConfig->all()]);
self::$config = $mergedConfig->all();
// Get config by url path
$configPath = Theme::$demo . '.pages.' . str_replace('/', '.', Theme::getPagePath());
$pageConfig = collect(config($configPath));
// Merge group config with child config
$pageGroupOptions = Theme::getPageGroupOptions(config(Theme::$demo . '.pages'), Theme::getPagePath());
if ($pageGroupOptions) {
$overridenConfig = $pageConfig->replaceRecursive($pageGroupOptions);
config([$configPath => $overridenConfig->all()]);
}
$generalConfig = collect(config(Theme::$demo . '.general'));
// Merge general config with page level config
config([Theme::$demo . '.general' => $generalConfig->replaceRecursive(config($configPath))->all()]);
}
/**
* Get current page path
*
* @return mixed
*/
public static function getPagePath()
{
// Override page path
$segments = request()->segments();
if (!empty($segments)) {
\App\Core\Theme::$page = implode('/', $segments);
}
return \App\Core\Theme::getPagePath();
}
/**
* Get menu array from config
*
* @return array
*/
public function getMenu()
{
$menus = self::getOption('menu');
$output = [];
foreach ($menus as $menu) {
if (is_array($menu)) {
$this->iterateMenu($menu, $output);
}
}
return $output;
}
/**
* Iterate menu array for self::getMenu() function
*
* @param $menus
* @param $output
*/
private function iterateMenu($menus, &$output)
{
if (!is_array($menus)) {
return;
}
if (isset($menus['path'])) {
$output[] = $menus;
}
if (is_array($menus)) {
foreach ($menus as $menu) {
$this->iterateMenu($menu, $output);
}
}
}
public static function getDemosTotal()
{
$total = 0;
foreach (self::getOption('product', 'demos') as $id => $demo) {
if ($demo['published'] === true) {
$total++;
}
}
return $total;
}
}

View file

@ -0,0 +1,70 @@
<?php
namespace App\Core\Adapters;
/**
* Adapter class to make the Metronic core lib compatible with the Laravel functions
*
* Class Util
*
* @package App\Core\Adapters
*/
class Util extends \App\Core\Util
{
/**
* Print the value if the condition met
*
* @param $cond
* @param $value
* @param string $alt
*
* @return false|string
*/
public static function putIf($cond, $value, $alt = '')
{
ob_start();
// Call the function from core Util
echo self::getIf($cond, $value, $alt);
return ob_get_clean();
}
/**
* Print the notice
*
* @param $text
* @param string $state
* @param string $icon
*/
public static function notice($text, $state = 'danger', $icon = 'icons/duotone/Tools/Compass.svg')
{
$html = '';
$html .= '<!--begin::Notice-->';
$html .= '<div class="d-flex align-items-center rounded py-4 px-4 bg-light-' . $state . ' ">';
if ($icon) {
$html .= ' <!--begin::Icon-->';
$html .= ' <div class="d-flex h-80px w-80px flex-shrink-0 flex-center position-relative ms-5 me-8">';
$html .= ' ' . Theme::getSvgIcon("icons/duotone/Layout/Layout-polygon.svg", "svg-icon-' . $state . ' position-absolute opacity-10", "w-80px h-80px");
$html .= ' ' . Theme::getSvgIcon($icon, 'svg-icon-3x svg-icon-' . $state . ' position-absolute');
$html .= ' </div>';
$html .= ' <!--end::Icon-->';
}
$html .= ' <!--begin::Description-->';
$html .= ' <div class="text-gray-600 fw-bold fs-6 lh-lg">';
$html .= $text;
$html .= ' </div>';
$html .= ' <!--end::Description-->';
$html .= '</div>';
$html .= '<!--end::Notice-->';
echo $html;
}
public static function putHtmlAttributes($attributes)
{
return self::getHtmlAttributes($attributes);
}
}

View file

@ -0,0 +1,200 @@
<?php
namespace App\Core\Bootstraps;
use App\Core\Adapters\BootstrapBase;
use App\Core\Adapters\Menu;
use App\Core\Adapters\Theme;
class BootstrapDemo1 extends BootstrapBase
{
// Private Properties
private static $asideMenu;
private static $horizontalMenu;
// Private Methods
private static function initHeader()
{
if (Theme::getOption('layout', 'header/width') == 'fluid') {
Theme::addHtmlClass('header-container', 'container-fluid');
} else {
Theme::addHtmlClass('header-container', 'container');
}
if (Theme::getOption('layout', 'header/fixed/desktop') === true) {
Theme::addHtmlClass('body', 'header-fixed');
}
if (Theme::getOption('layout', 'header/fixed/tablet-and-mobile') === true) {
Theme::addHtmlClass('body', 'header-tablet-and-mobile-fixed');
}
}
private static function initToolbar()
{
if (Theme::getOption('layout', 'toolbar/display') === false) {
return;
}
Theme::addHtmlClass('body', 'toolbar-enabled');
if (Theme::getOption('layout', 'toolbar/width') == 'fluid') {
Theme::addHtmlClass('toolbar-container', 'container-fluid');
} else {
Theme::addHtmlClass('toolbar-container', 'container');
}
if (Theme::getOption('layout', 'toolbar/fixed/desktop') === true) {
Theme::addHtmlClass('body', 'toolbar-fixed');
}
if (Theme::getOption('layout', 'toolbar/fixed/tablet-and-mobile') === true) {
Theme::addHtmlClass('body', 'toolbar-tablet-and-mobile-fixed');
}
// Height setup
$type = Theme::getOption('layout', 'toolbar/layout');
$typeOptions = Theme::getOption('layout', 'toolbar/layouts/' . $type);
if ($typeOptions) {
if (isset($typeOptions['height'])) {
Theme::addCssVariable('body', '--kt-toolbar-height', $typeOptions['height']);
}
if (isset($typeOptions['height-tablet-and-mobile'])) {
Theme::addCssVariable('body', '--kt-toolbar-height-tablet-and-mobile', $typeOptions['height-tablet-and-mobile']);
}
}
}
private static function initPageTitle()
{
if (Theme::getOption('layout', 'page-title/display') === false) {
return;
}
if (Theme::getOption('layout', 'page-title/direction') == 'column') {
Theme::addHtmlClass('page-title', 'flex-column align-items-start me-3');
} else {
Theme::addHtmlClass('page-title', 'align-items-center flex-wrap me-3');
}
if (Theme::getOption('layout', 'header/left') === 'page-title') {
Theme::setOption('layout', 'page-title/responsive-target', '#kt_header_nav');
}
if (Theme::getOption('layout', 'page-title/responsive') === true) {
Theme::addHtmlClass('page-title', 'mb-5 mb-lg-0');
$attr = array();
$attr['data-kt-swapper'] = 'true';
$attr['data-kt-swapper-mode'] = 'prepend';
$attr['data-kt-swapper-parent'] = "{default: '#kt_content_container', '" . Theme::getOption('layout', 'page-title/responsive-breakpoint') . "': '" . Theme::getOption('layout', 'page-title/responsive-target') . "'}";
Theme::addHtmlAttributes('page-title', $attr);
}
}
private static function initContent()
{
if (Theme::getOption('layout', 'content/width') == 'fluid') {
Theme::addHtmlClass('content-container', 'container-fluid');
} elseif (Theme::getOption('layout', 'content/width') == 'fixed') {
Theme::addHtmlClass('content-container', 'container-xxl');
}
if (Theme::getOption('layout', 'content/class')) {
Theme::addHtmlClass('content', Theme::getOption('layout', 'content/class'));
}
if (Theme::getOption('layout', 'content/container-class')) {
Theme::addHtmlClass('content-container', Theme::getOption('layout', 'content/container-class'));
}
}
private static function initAside()
{
// Check if aside is displayed
if (Theme::getOption('layout', 'aside/display') != true) {
return;
}
Theme::addHtmlClass('body', 'aside-enabled');
Theme::addHtmlClass('aside', 'aside-' . Theme::getOption('layout', 'aside/theme'));
// Fixed aside
if (Theme::getOption('layout', 'aside/fixed')) {
Theme::addHtmlClass('body', 'aside-fixed');
}
// Default minimized
if (Theme::getOption('layout', 'aside/minimized')) {
Theme::addHtmlAttribute('body', 'data-kt-aside-minimize', 'on');
}
// Hoverable on minimize
if (Theme::getOption('layout', 'aside/hoverable')) {
Theme::addHtmlClass('aside', 'aside-hoverable');
}
}
private static function initAsideMenu()
{
self::$asideMenu = new Menu(Theme::getOption('menu', 'main'), Theme::getPagePath());
if (Theme::getOption('layout', 'aside/menu-icons-display') === false) {
self::$asideMenu->displayIcons(false);
}
self::$asideMenu->setIconType(Theme::getOption('layout', 'aside/menu-icon'));
}
private static function initHorizontalMenu()
{
self::$horizontalMenu = new Menu(Theme::getOption('menu', 'horizontal'), Theme::getPagePath());
self::$horizontalMenu->setItemLinkClass('py-3');
self::$horizontalMenu->setIconType(Theme::getOption('layout', 'header/menu-icon', 'svg'));
}
private static function initFooter()
{
if (Theme::getOption('layout', 'footer/width') == 'fluid') {
Theme::addHtmlClass('footer-container', 'container-fluid');
} else {
Theme::addHtmlClass('footer-container', 'container-xxl');
}
}
// Public Methods
public static function initLayout()
{
self::initHeader();
self::initPageTitle();
self::initToolbar();
self::initContent();
self::initAside();
self::initFooter();
self::initAsideMenu();
self::initHorizontalMenu();
}
public static function getAsideMenu()
{
return self::$asideMenu;
}
public static function getHorizontalMenu()
{
return self::$horizontalMenu;
}
public static function getBreadcrumb()
{
$options = array(
'skip-active' => false
);
return self::getAsideMenu()->getBreadcrumb($options);
}
}

View file

@ -0,0 +1,160 @@
<?php
namespace App\Core\Bootstraps;
use App\Core\Adapters\BootstrapBase;
use App\Core\Adapters\Menu;
use App\Core\Adapters\Theme;
class BootstrapDemo2 extends BootstrapBase
{
// Private Properties
private static $asideMenu;
private static $horizontalMenu;
// Private Methods
private static function initPage()
{
Theme::addHtmlAttribute('body', 'style', 'background-image: url(' . asset(Theme::getMediaUrlPath() . 'patterns/' . (Theme::isDarkMode() ? 'header-bg-dark.png' : 'header-bg.jpg')) . ')');
}
private static function initHeader()
{
if (Theme::getOption('layout', 'header/width') == 'fluid') {
Theme::addHtmlClass('header-container', 'container-fluid');
} else {
Theme::addHtmlClass('header-container', 'container');
}
if (Theme::getOption('layout', 'header/fixed/desktop') === true) {
Theme::addHtmlClass('body', 'header-fixed');
}
if (Theme::getOption('layout', 'header/fixed/tablet-and-mobile') === true) {
Theme::addHtmlClass('body', 'header-tablet-and-mobile-fixed');
}
}
private static function initToolbar()
{
if (Theme::getOption('layout', 'toolbar/display') === false) {
return;
}
Theme::addHtmlClass('body', 'toolbar-enabled');
if (Theme::getOption('layout', 'toolbar/width') == 'fluid') {
Theme::addHtmlClass('toolbar-container', 'container-fluid');
} else {
Theme::addHtmlClass('toolbar-container', 'container');
}
}
private static function initPageTitle()
{
if (Theme::getOption('layout', 'page-title/display') === false) {
return;
}
}
private static function initContent()
{
if (Theme::getOption('layout', 'content/width') == 'fluid') {
Theme::addHtmlClass('content-container', 'container-fluid');
} elseif (Theme::getOption('layout', 'content/width') == 'fixed') {
Theme::addHtmlClass('content-container', 'container');
}
if (Theme::getOption('layout', 'content/class')) {
Theme::addHtmlClass('content', Theme::getOption('layout', 'content/class'));
}
if (Theme::getOption('layout', 'content/container-class')) {
Theme::addHtmlClass('content-container', Theme::getOption('layout', 'content/container-class'));
}
}
private static function initAside()
{
// Check if aside is displayed
if (Theme::getOption('layout', 'aside/display') != true) {
return;
}
Theme::addHtmlClass('body', 'aside-enabled');
}
private static function initAsideMenu()
{
self::$asideMenu = new Menu(Theme::getOption('menu', 'main'), Theme::getPagePath());
if (Theme::getOption('layout', 'aside/menu-icons-display') === false) {
self::$asideMenu->displayIcons(false);
}
self::$asideMenu->setIconType(Theme::getOption('layout', 'aside/menu-icon'));
}
private static function initHorizontalMenu()
{
self::$horizontalMenu = new Menu(Theme::getOption('menu', 'horizontal'), Theme::getPagePath());
self::$horizontalMenu->setItemLinkClass('py-3');
self::$horizontalMenu->setIconType(Theme::getOption('layout', 'header/menu-icon'));
}
private static function initFooter()
{
if (Theme::getOption('layout', 'footer/width') == 'fluid') {
Theme::addHtmlClass('footer-container', 'container-fluid');
} else {
Theme::addHtmlClass('footer-container', 'container');
}
}
private static function initScripts()
{
Theme::addPageJs('js/custom/widgets.js');
Theme::addPageJs('js/custom/apps/chat/chat.js');
Theme::addPageJs('js/custom/modals/create-app.js');
Theme::addPageJs('js/custom/modals/upgrade-plan.js');
if (Theme::getViewMode() !== 'release') {
Theme::addPageJs('js/custom/intro.js');
}
}
// Public Methods
public static function getAsideMenu()
{
return self::$asideMenu;
}
public static function getHorizontalMenu()
{
return self::$horizontalMenu;
}
public static function getBreadcrumb()
{
$options = array(
'skip-active' => false
);
return self::getHorizontalMenu()->getBreadcrumb($options);
}
public static function initLayout()
{
self::initPage();
self::initHeader();
self::initPageTitle();
self::initToolbar();
self::initContent();
self::initAside();
self::initFooter();
self::initAsideMenu();
self::initHorizontalMenu();
self::initScripts();
}
}

View file

@ -0,0 +1,116 @@
<?php
namespace App\Core\Bootstraps;
use App\Core\Adapters\BootstrapBase;
use App\Core\Adapters\Menu;
use App\Core\Adapters\Theme;
class BootstrapDemo3 extends BootstrapBase
{
// Private Properties
private static $menu;
// Private Methods
private static function initHeader()
{
if (Theme::getOption('layout', 'header/width') == 'fluid') {
Theme::addHtmlClass('header-container', 'container-fluid');
} else {
Theme::addHtmlClass('header-container', 'container');
}
if (Theme::getOption('layout', 'header/fixed/desktop') === true) {
Theme::addHtmlClass('body', 'header-fixed');
}
if (Theme::getOption('layout', 'header/fixed/tablet-and-mobile') === true) {
Theme::addHtmlClass('body', 'header-tablet-and-mobile-fixed');
}
}
private static function initContent()
{
if (Theme::getOption('layout', 'content/width') == 'fluid') {
Theme::addHtmlClass('content-container', 'container-fluid');
} elseif (Theme::getOption('layout', 'content/width') == 'fixed') {
Theme::addHtmlClass('content-container', 'container');
}
if (Theme::getOption('layout', 'content/class')) {
Theme::addHtmlClass('content', Theme::getOption('layout', 'content/class'));
}
if (Theme::getOption('layout', 'content/container-class')) {
Theme::addHtmlClass('content-container', Theme::getOption('layout', 'content/container-class'));
}
}
private static function initAside()
{
// Aside enabled
if (Theme::getOption('layout', 'aside/display')) {
Theme::addHtmlClass('body', 'aside-enabled');
}
}
private static function initSidebar()
{
// Sidebar enabled
if (Theme::getOption('layout', 'sidebar/display')) {
Theme::addHtmlClass('body', 'sidebar-enabled');
}
}
private static function initMenu()
{
self::$menu = new Menu(Theme::getOption('menu', 'main'), Theme::getPagePath());
}
private static function initFooter()
{
if (Theme::getOption('layout', 'footer/width') == 'fluid') {
Theme::addHtmlClass('footer-container', 'container-fluid');
} else {
Theme::addHtmlClass('footer-container', 'container');
}
}
private static function initScripts()
{
Theme::addPageJs('js/custom/widgets.js');
Theme::addPageJs('js/custom/apps/chat/chat.js');
Theme::addPageJs('js/custom/modals/create-app.js');
Theme::addPageJs('js/custom/modals/upgrade-plan.js');
if (Theme::getViewMode() !== 'release') {
Theme::addPageJs('js/custom/intro.js');
}
}
// Public Methods
public static function getMenu()
{
return self::$menu;
}
public static function getBreadcrumb()
{
$options = array(
'skip-active' => false
);
return self::getMenu()->getBreadcrumb($options);
}
public static function initLayout()
{
self::initHeader();
self::initContent();
self::initAside();
self::initSidebar();
self::initFooter();
self::initMenu();
self::initScripts();
}
}

View file

@ -0,0 +1,127 @@
<?php
namespace App\Core\Bootstraps;
use App\Core\Adapters\BootstrapBase;
use App\Core\Adapters\Menu;
use App\Core\Adapters\Theme;
class BootstrapDemo4 extends BootstrapBase
{
// Private Properties
private static $asideMenu;
private static $horizontalMenu;
// Private Methods
private static function initHeader()
{
if (Theme::getOption('layout', 'header/width') == 'fluid') {
Theme::addHtmlClass('header-container', 'container-fluid');
} else {
Theme::addHtmlClass('header-container', 'container-xxl');
}
if (Theme::getOption('layout', 'header/fixed/desktop') === true) {
Theme::addHtmlClass('body', 'header-fixed');
}
if (Theme::getOption('layout', 'header/fixed/tablet-and-mobile') === true) {
Theme::addHtmlClass('body', 'header-tablet-and-mobile-fixed');
}
}
private static function initContent()
{
if (Theme::getOption('layout', 'content/width') == 'fluid') {
Theme::addHtmlClass('content-container', 'container-fluid');
} else {
Theme::addHtmlClass('content-container', 'container');
}
}
private static function initAside()
{
// Fixed aside
if (Theme::getOption('layout', 'aside/fixed')) {
Theme::addHtmlClass('body', 'aside-fixed');
}
// Default minimized
if (Theme::getOption('layout', 'aside/minimized')) {
Theme::addHtmlAttribute('body', 'data-kt-aside-minimize', 'on');
Theme::addHtmlClass('asideToggle', 'active');
}
// Aside Secondary
if (Theme::getOption('layout', 'aside/secondary-display') === true) {
Theme::addHtmlClass('body', 'aside-secondary-enabled');
} else {
Theme::addHtmlClass('body', 'aside-secondary-disabled');
}
}
private static function initAsideMenu()
{
self::$asideMenu = new Menu(Theme::getOption('menu', 'compact'), Theme::getPagePath());
self::$asideMenu->setIconType(Theme::getOption('layout', 'aside/menu-icon', 'svg'));
}
private static function initHorizontalMenu()
{
self::$horizontalMenu = new Menu(Theme::getOption('menu', 'horizontal'), Theme::getPagePath());
self::$horizontalMenu->setItemLinkClass('py-3');
self::$horizontalMenu->setIconType(Theme::getOption('layout', 'header/menu-icon', 'svg'));
}
private static function initFooter()
{
if (Theme::getOption('layout', 'footer/width') == 'fluid') {
Theme::addHtmlClass('footer-container', 'container-fluid');
} else {
Theme::addHtmlClass('footer-container', 'container-xxl');
}
}
private static function initScripts()
{
Theme::addPageJs('js/custom/widgets.js');
Theme::addPageJs('js/custom/apps/chat/chat.js');
Theme::addPageJs('js/custom/modals/create-app.js');
Theme::addPageJs('js/custom/modals/upgrade-plan.js');
if (Theme::getViewMode() !== 'release') {
Theme::addPageJs('js/custom/intro.js');
}
}
// Public Methods
public static function getAsideMenu()
{
return self::$asideMenu;
}
public static function getHorizontalMenu()
{
return self::$horizontalMenu;
}
public static function getBreadcrumb()
{
$options = array(
'skip-active' => false
);
return self::getHorizontalMenu()->getBreadcrumb($options);
}
public static function initLayout()
{
self::initHeader();
self::initContent();
self::initAside();
self::initFooter();
self::initAsideMenu();
self::initHorizontalMenu();
self::initScripts();
}
}

View file

@ -0,0 +1,99 @@
<?php
namespace App\Core\Bootstraps;
use App\Core\Adapters\BootstrapBase;
use App\Core\Adapters\Menu;
use App\Core\Adapters\Theme;
class BootstrapDemo5 extends BootstrapBase
{
// Private Properties
private static $horizontalMenu;
// Private Methods
private static function initHeader()
{
if (Theme::getOption('layout', 'header/width') == 'fluid') {
Theme::addHtmlClass('header-container', 'container-fluid');
} else {
Theme::addHtmlClass('header-container', 'container-xxl');
}
if (Theme::getOption('layout', 'header/fixed/desktop') === true) {
Theme::addHtmlClass('body', 'header-fixed');
}
if (Theme::getOption('layout', 'header/fixed/tablet-and-mobile') === true) {
Theme::addHtmlClass('body', 'header-tablet-and-mobile-fixed');
}
}
// Private Methods
private static function initContent()
{
if (Theme::getOption('layout', 'content/width') == 'fluid') {
Theme::addHtmlClass('content-container', 'container-fluid');
} else {
Theme::addHtmlClass('content-container', 'container-xxl');
}
}
private static function initAside()
{
if (Theme::getOption('layout', 'aside/display') === true) {
Theme::addHtmlClass('body', 'aside-enabled');
}
}
private static function initSidebar()
{
if (Theme::getOption('layout', 'sidebar/display') === true) {
Theme::addHtmlClass('body', 'sidebar-enabled');
}
}
private static function initHorizontalMenu()
{
self::$horizontalMenu = new Menu(Theme::getOption('menu', 'horizontal'), Theme::getPagePath());
self::$horizontalMenu->setItemLinkClass('py-3');
self::$horizontalMenu->setIconType(Theme::getOption('layout', 'header/menu-icon', 'svg'));
}
private static function initScripts()
{
Theme::addPageJs('js/custom/widgets.js');
Theme::addPageJs('js/custom/apps/chat/chat.js');
Theme::addPageJs('js/custom/modals/create-app.js');
Theme::addPageJs('js/custom/modals/upgrade-plan.js');
if (Theme::getViewMode() !== 'release') {
Theme::addPageJs('js/custom/intro.js');
}
}
// Public Methods
public static function initLayout()
{
self::initHeader();
self::initContent();
self::initAside();
self::initSidebar();
self::initHorizontalMenu();
self::initScripts();
}
public static function getHorizontalMenu()
{
return self::$horizontalMenu;
}
public static function getBreadcrumb()
{
$options = array(
'skip-active' => false
);
return self::getHorizontalMenu()->getBreadcrumb($options);
}
}

View file

@ -0,0 +1,177 @@
<?php
namespace App\Core\Bootstraps;
use App\Core\Adapters\BootstrapBase;
use App\Core\Adapters\Menu;
use App\Core\Adapters\Theme;
class BootstrapDemo6 extends BootstrapBase
{
// Private Properties
private static $asideMenu;
private static $horizontalMenu;
// Private Methods
private static function initPage()
{
if (Theme::getOption('layout', 'main/body/background-image')) {
Theme::addHtmlAttribute('body', 'style', 'background-image: url(' . Theme::getOption('layout', 'main/body/background-image') . ')');
}
}
private static function initHeader()
{
if (Theme::getOption('layout', 'header/width') == 'fluid') {
Theme::addHtmlClass('header-container', 'container-fluid');
} else {
Theme::addHtmlClass('header-container', 'container-xxl');
}
if (Theme::getOption('layout', 'header/fixed/desktop') === true) {
Theme::addHtmlClass('body', 'header-fixed');
}
if (Theme::getOption('layout', 'header/fixed/tablet-and-mobile') === true) {
Theme::addHtmlClass('body', 'header-tablet-and-mobile-fixed');
}
}
private static function initToolbar()
{
if (Theme::getOption('layout', 'toolbar/display') === false) {
return;
}
Theme::addHtmlClass('body', 'toolbar-enabled');
if (Theme::getOption('layout', 'toolbar/width') == 'fluid') {
Theme::addHtmlClass('toolbar-container', 'container-fluid');
} else {
Theme::addHtmlClass('toolbar-container', 'container-xxl');
}
if (Theme::getOption('layout', 'toolbar/fixed/desktop') === true) {
Theme::addHtmlClass('body', 'toolbar-fixed');
}
if (Theme::getOption('layout', 'toolbar/fixed/tablet-and-mobile') === true) {
Theme::addHtmlClass('body', 'toolbar-tablet-and-mobile-fixed');
}
}
private static function initPageTitle()
{
if (Theme::getOption('layout', 'page-title/display') === false) {
return;
}
if (Theme::getOption('layout', 'header/left') === 'page-title') {
Theme::setOption('layout', 'page-title/responsive-target', '#kt_header_nav');
}
if (Theme::getOption('layout', 'page-title/responsive') === true) {
Theme::addHtmlClass('page-title', 'mb-5 mb-lg-0');
$attr = array();
$attr['data-kt-swapper'] = 'true';
$attr['data-kt-swapper-mode'] = 'prepend';
$attr['data-kt-swapper-parent'] = "{default: '#kt_content_container', '" . Theme::getOption('layout', 'page-title/responsive-breakpoint') . "': '" . Theme::getOption('layout', 'page-title/responsive-target') . "'}";
Theme::addHtmlAttributes('page-title', $attr);
}
}
private static function initContent()
{
if (Theme::getOption('layout', 'content/width') == 'fluid') {
Theme::addHtmlClass('content-container', 'container-fluid');
} elseif (Theme::getOption('layout', 'content/width') == 'fixed') {
Theme::addHtmlClass('content-container', 'container-xxl');
}
}
private static function initAside()
{
// Check if aside is displayed
if (Theme::getOption('layout', 'aside/display') != true) {
return;
}
Theme::addHtmlClass('body', 'aside-enabled');
// Fixed aside
if (Theme::getOption('layout', 'aside/fixed')) {
Theme::addHtmlClass('body', 'aside-fixed');
}
}
private static function initAsideMenu()
{
self::$asideMenu = new Menu(Theme::getOption('menu', 'demo6-aside'), Theme::getPagePath());
self::$asideMenu->setIconType(Theme::getOption('layout', 'aside/menu-icon'));
}
private static function initHorizontalMenu()
{
self::$horizontalMenu = new Menu(Theme::getOption('menu', 'horizontal'), Theme::getPagePath());
self::$horizontalMenu->setItemLinkClass('py-3');
self::$horizontalMenu->setIconType(Theme::getOption('layout', 'header/menu-icon', 'svg'));
}
private static function initFooter()
{
if (Theme::getOption('layout', 'footer/width') == 'fluid') {
Theme::addHtmlClass('footer-container', 'container-fluid');
} else {
Theme::addHtmlClass('footer-container', 'container-xxl');
}
}
private static function initScripts()
{
Theme::addPageJs('js/custom/widgets.js');
Theme::addPageJs('js/custom/apps/chat/chat.js');
Theme::addPageJs('js/custom/modals/create-app.js');
Theme::addPageJs('js/custom/modals/upgrade-plan.js');
if (Theme::getViewMode() !== 'release') {
Theme::addPageJs('js/custom/intro.js');
}
}
// Public Methods
public static function getAsideMenu()
{
return self::$asideMenu;
}
public static function getHorizontalMenu()
{
return self::$horizontalMenu;
}
public static function getBreadcrumb()
{
$options = array(
'skip-active' => false
);
return self::getHorizontalMenu()->getBreadcrumb($options);
}
public static function initLayout()
{
self::initPage();
self::initHeader();
self::initPageTitle();
self::initToolbar();
self::initContent();
self::initAside();
self::initFooter();
self::initAsideMenu();
self::initHorizontalMenu();
self::initScripts();
}
}

View file

@ -0,0 +1,128 @@
<?php
namespace App\Core\Bootstraps;
use App\Core\Adapters\BootstrapBase;
use App\Core\Adapters\Menu;
use App\Core\Adapters\Theme;
class BootstrapDemo7 extends BootstrapBase
{
// Private Properties
private static $menu;
// Private Methods
private static function initPage()
{
Theme::addHtmlAttribute('body', 'style', 'background-image: url(' . Theme::getOption('layout', 'main/body/background-image') . ')');
}
private static function initHeader()
{
if (Theme::getOption('layout', 'header/width') == 'fluid') {
Theme::addHtmlClass('header-container', 'container-fluid');
} else {
Theme::addHtmlClass('header-container', 'container-xxl');
}
if (Theme::getOption('layout', 'header/fixed/desktop') === true) {
Theme::addHtmlClass('body', 'header-fixed');
}
if (Theme::getOption('layout', 'header/fixed/tablet-and-mobile') === true) {
Theme::addHtmlClass('body', 'header-tablet-and-mobile-fixed');
}
}
private static function initContent()
{
if (Theme::getOption('layout', 'content/width') == 'fluid') {
Theme::addHtmlClass('content-container', 'container-fluid');
} elseif (Theme::getOption('layout', 'content/width') == 'fixed') {
Theme::addHtmlClass('content-container', 'container-xxl');
}
}
private static function initAside()
{
// Fixed aside
if (Theme::getOption('layout', 'aside/fixed')) {
Theme::addHtmlClass('body', 'aside-fixed');
}
// Default minimized
if (Theme::getOption('layout', 'aside/minimized')) {
Theme::addHtmlAttribute('body', 'data-kt-aside-minimize', 'on');
Theme::addHtmlClass('asideToggle', 'active');
}
// Aside Secondary
if (Theme::getOption('layout', 'aside/secondary-display') === true) {
Theme::addHtmlClass('body', 'aside-secondary-enabled');
} else {
Theme::addHtmlClass('body', 'aside-secondary-disabled');
}
}
private static function initMenu()
{
self::$menu = new Menu(Theme::getOption('menu', 'main'), Theme::getPagePath());
if (Theme::getOption('layout', 'aside/menu-icons-display') === false) {
self::$menu->displayIcons(false);
}
self::$menu->setIconType(Theme::getOption('layout', 'aside/menu-icon'));
}
private static function initFooter()
{
if (Theme::getOption('layout', 'footer/width') == 'fluid') {
Theme::addHtmlClass('footer-container', 'container-fluid');
} else {
Theme::addHtmlClass('footer-container', 'container-xxl');
}
}
private static function initScripts()
{
// Global widgets
Theme::addPageJs('js/widgets.bundle.js');
// Custom widgets
Theme::addPageJs('js/custom/widgets.js');
// Chat app
Theme::addPageJs('js/custom/apps/chat/chat.js');
if (Theme::getViewMode() !== 'release') {
Theme::addPageJs('js/custom/intro.js');
}
}
// Public Methods
public static function getMenu()
{
return self::$menu;
}
public static function getBreadcrumb()
{
$options = array(
'skip-active' => false
);
return self::getMenu()->getBreadcrumb($options);
}
public static function initLayout()
{
self::initPage();
self::initHeader();
self::initContent();
self::initAside();
self::initFooter();
self::initMenu();
self::initScripts();
}
}

View file

@ -0,0 +1,97 @@
<?php
namespace App\Core\Bootstraps;
use App\Core\Adapters\BootstrapBase;
use App\Core\Adapters\Menu;
use App\Core\Adapters\Theme;
class BootstrapDemo8 extends BootstrapBase
{
// Private Properties
private static $asideMenu;
// Private Methods
private static function initHeader()
{
if (Theme::getOption('layout', 'header/width') == 'fluid') {
Theme::addHtmlClass('header-container', 'container-fluid');
} else {
Theme::addHtmlClass('header-container', 'container-xxl');
}
if (Theme::getOption('layout', 'header/fixed/tablet-and-mobile') === true) {
Theme::addHtmlClass('body', 'header-tablet-and-mobile-fixed');
}
}
private static function initContent()
{
if (Theme::getOption('layout', 'content/width') == 'fluid') {
Theme::addHtmlClass('content-container', 'container-fluid');
} elseif (Theme::getOption('layout', 'content/width') == 'fixed') {
Theme::addHtmlClass('content-container', 'container-xxl');
}
}
private static function initAside()
{
Theme::addHtmlClass('body', 'aside-enabled');
// Default minimized
if (Theme::getOption('layout', 'aside/minimized')) {
Theme::addHtmlAttribute('body', 'data-kt-aside-minimize', 'on');
}
}
private static function initAsideMenu()
{
self::$asideMenu = new Menu(Theme::getOption('menu', 'main'), Theme::getPagePath());
}
private static function initFooter()
{
if (Theme::getOption('layout', 'footer/width') == 'fluid') {
Theme::addHtmlClass('footer-container', 'container-fluid');
} else {
Theme::addHtmlClass('footer-container', 'container');
}
}
private static function initScripts()
{
Theme::addPageJs('js/custom/widgets.js');
Theme::addPageJs('js/custom/apps/chat/chat.js');
Theme::addPageJs('js/custom/modals/create-app.js');
Theme::addPageJs('js/custom/modals/upgrade-plan.js');
if (Theme::getViewMode() !== 'release') {
Theme::addPageJs('js/custom/intro.js');
}
}
// Public Methods
public static function initLayout()
{
self::initHeader();
self::initContent();
self::initAside();
self::initFooter();
self::initAsideMenu();
self::initScripts();
}
public static function getAsideMenu()
{
return self::$asideMenu;
}
public static function getBreadcrumb()
{
$options = array(
'skip-active' => false
);
return self::getAsideMenu()->getBreadcrumb($options);
}
}

View file

@ -0,0 +1,127 @@
<?php
namespace App\Core\Bootstraps;
use App\Core\Adapters\BootstrapBase;
use App\Core\Adapters\Menu;
use App\Core\Adapters\Theme;
class BootstrapDemo9 extends BootstrapBase
{
// Private Properties
private static $asideMenu;
private static $horizontalMenu;
// Private Methods
private static function initHeader()
{
if (Theme::getOption('layout', 'header/width') == 'fluid') {
Theme::addHtmlClass('header-container', 'container-fluid');
} else {
Theme::addHtmlClass('header-container', 'container-xxl');
}
if (Theme::getOption('layout', 'header/fixed/desktop') === true) {
Theme::addHtmlClass('body', 'header-fixed');
}
if (Theme::getOption('layout', 'header/fixed/tablet-and-mobile') === true) {
Theme::addHtmlClass('body', 'header-tablet-and-mobile-fixed');
}
}
private static function initContent()
{
if (Theme::getOption('layout', 'content/width') == 'fluid') {
Theme::addHtmlClass('content-container', 'container-fluid');
} else {
Theme::addHtmlClass('content-container', 'container-xxl');
}
}
private static function initAside()
{
// Fixed aside
if (Theme::getOption('layout', 'aside/fixed')) {
Theme::addHtmlClass('body', 'aside-fixed');
}
// Default minimized
if (Theme::getOption('layout', 'aside/minimized')) {
Theme::addHtmlAttribute('body', 'data-kt-aside-minimize', 'on');
Theme::addHtmlClass('asideToggle', 'active');
}
// Aside Secondary
if (Theme::getOption('layout', 'aside/secondary-display') === true) {
Theme::addHtmlClass('body', 'aside-secondary-enabled');
} else {
Theme::addHtmlClass('body', 'aside-secondary-disabled');
}
}
private static function initAsideMenu()
{
self::$asideMenu = new Menu(Theme::getOption('menu', 'demo9-aside'), Theme::getPagePath());
self::$asideMenu->setIconType(Theme::getOption('layout', 'aside/menu-icon', 'svg'));
}
private static function initHorizontalMenu()
{
self::$horizontalMenu = new Menu(Theme::getOption('menu', 'horizontal'), Theme::getPagePath());
self::$horizontalMenu->setItemLinkClass('py-3');
self::$horizontalMenu->setIconType(Theme::getOption('layout', 'header/menu-icon', 'svg'));
}
private static function initFooter()
{
if (Theme::getOption('layout', 'footer/width') == 'fluid') {
Theme::addHtmlClass('footer-container', 'container-fluid');
} else {
Theme::addHtmlClass('footer-container', 'container-xxl');
}
}
private static function initScripts()
{
Theme::addPageJs('js/custom/widgets.js');
Theme::addPageJs('js/custom/apps/chat/chat.js');
Theme::addPageJs('js/custom/modals/create-app.js');
Theme::addPageJs('js/custom/modals/upgrade-plan.js');
if (Theme::getViewMode() !== 'release') {
Theme::addPageJs('js/custom/intro.js');
}
}
// Public Methods
public static function getAsideMenu()
{
return self::$asideMenu;
}
public static function getHorizontalMenu()
{
return self::$horizontalMenu;
}
public static function getBreadcrumb()
{
$options = array(
'skip-active' => false
);
return self::getHorizontalMenu()->getBreadcrumb($options);
}
public static function initLayout()
{
self::initHeader();
self::initContent();
self::initAside();
self::initFooter();
self::initAsideMenu();
self::initHorizontalMenu();
self::initScripts();
}
}

81
app/Core/Components.php Normal file
View file

@ -0,0 +1,81 @@
<?php
namespace App\Core;
class Components
{
public static function getAvatar($options)
{
$avatarClasses = array();
$avatarInitialsClasses = array();
// Set default options
if (isset($options['circle']) === false) {
$options['circle'] = true;
}
if (isset($options['size']) === false) {
$options['size'] = '40px';
}
if (isset($options['initials'])) {
if (isset($options['initials']['font-size']) === false) {
$options['initials']['font-size'] = '40px';
}
}
// Class
if (isset($options['class'])) {
$avatarClasses[] = $options['class'];
}
// Size
if ($options['size']) {
$avatarClasses[] = 'symbol-' . $options['size'];
}
// Shape
if ($options['circle'] === true) {
$avatarClasses[] = 'symbol-circle';
}
// Initials
if (isset($options['initials'])) {
if (isset($options['initials']['state'])) {
$avatarInitialsClasses[] = 'bg-light-' . $options['initials']['state'];
$avatarInitialsClasses[] = 'text-' . $options['initials']['state'];
}
if (isset($options['initials']['font-size'])) {
$avatarInitialsClasses[] = $options['initials']['font-size'];
}
if (isset($options['initials']['font-weight'])) {
$avatarInitialsClasses[] = $options['initials']['font-weight'];
}
}
$html = '';
$html .= '<!--begin::Avatar-->';
$html .= '<div class="symbol ' . util()->getHtmlClass($avatarClasses, false) . '">';
if (isset($options['avatar'])) {
$html .= '<img alt="Pic" src="' . asset(theme()->getMediaUrlPath() . $options['avatar']) . '"/>';
} else {
$html .= '<span class="symbol-label ' . util()->getHtmlClass($avatarInitialsClasses, false) . '">';
$html .= $options['initials']['label'];
$html .= '</span>';
}
// Online badge
if (isset($options['badge'])) {
$html .= $options['badge'];
}
$html .= '</div>';
$html .= '<!--end::Avatar-->';
return $html;
}
}

622
app/Core/Data.php Normal file
View file

@ -0,0 +1,622 @@
<?php
namespace App\Core;
use function PHPSTORM_META\map;
class Data
{
public static function getCountriesList()
{
return array(
'AF' => array('name' => 'Afghanistan', 'flag' => 'flags/afghanistan.svg'),
'AX' => array('name' => 'Aland Islands', 'flag' => 'flags/aland-islands.svg'),
'AL' => array('name' => 'Albania', 'flag' => 'flags/albania.svg'),
'DZ' => array('name' => 'Algeria', 'flag' => 'flags/algeria.svg'),
'AS' => array('name' => 'American Samoa', 'flag' => 'flags/american-samoa.svg'),
'AD' => array('name' => 'Andorra', 'flag' => 'flags/andorra.svg'),
'AO' => array('name' => 'Angola', 'flag' => 'flags/angola.svg'),
'AI' => array('name' => 'Anguilla', 'flag' => 'flags/anguilla.svg'),
'AG' => array('name' => 'Antigua and Barbuda', 'flag' => 'flags/antigua-and-barbuda.svg'),
'AR' => array('name' => 'Argentina', 'flag' => 'flags/argentina.svg'),
'AM' => array('name' => 'Armenia', 'flag' => 'flags/armenia.svg'),
'AW' => array('name' => 'Aruba', 'flag' => 'flags/aruba.svg'),
'AU' => array('name' => 'Australia', 'flag' => 'flags/australia.svg'),
'AT' => array('name' => 'Austria', 'flag' => 'flags/austria.svg'),
'AZ' => array('name' => 'Azerbaijan', 'flag' => 'flags/azerbaijan.svg'),
'BS' => array('name' => 'Bahamas', 'flag' => 'flags/bahamas.svg'),
'BH' => array('name' => 'Bahrain', 'flag' => 'flags/bahrain.svg'),
'BD' => array('name' => 'Bangladesh', 'flag' => 'flags/bangladesh.svg'),
'BB' => array('name' => 'Barbados', 'flag' => 'flags/barbados.svg'),
'BY' => array('name' => 'Belarus', 'flag' => 'flags/belarus.svg'),
'BE' => array('name' => 'Belgium', 'flag' => 'flags/belgium.svg'),
'BZ' => array('name' => 'Belize', 'flag' => 'flags/belize.svg'),
'BJ' => array('name' => 'Benin', 'flag' => 'flags/benin.svg'),
'BM' => array('name' => 'Bermuda', 'flag' => 'flags/bermuda.svg'),
'BT' => array('name' => 'Bhutan', 'flag' => 'flags/bhutan.svg'),
'BO' => array('name' => 'Bolivia, Plurinational State of', 'flag' => 'flags/bolivia.svg'),
'BQ' => array('name' => 'Bonaire, Sint Eustatius and Saba', 'flag' => 'flags/bonaire.svg'),
'BA' => array('name' => 'Bosnia and Herzegovina', 'flag' => 'flags/bosnia-and-herzegovina.svg'),
'BW' => array('name' => 'Botswana', 'flag' => 'flags/botswana.svg'),
'BR' => array('name' => 'Brazil', 'flag' => 'flags/brazil.svg'),
'IO' => array('name' => 'British Indian Ocean Territory', 'flag' => 'flags/british-indian-ocean-territory.svg'),
'BN' => array('name' => 'Brunei Darussalam', 'flag' => 'flags/brunei.svg'),
'BG' => array('name' => 'Bulgaria', 'flag' => 'flags/bulgaria.svg'),
'BF' => array('name' => 'Burkina Faso', 'flag' => 'flags/burkina-faso.svg'),
'BI' => array('name' => 'Burundi', 'flag' => 'flags/burundi.svg'),
'KH' => array('name' => 'Cambodia', 'flag' => 'flags/cambodia.svg'),
'CM' => array('name' => 'Cameroon', 'flag' => 'flags/cameroon.svg'),
'CA' => array('name' => 'Canada', 'flag' => 'flags/canada.svg'),
'CV' => array('name' => 'Cape Verde', 'flag' => 'flags/cape-verde.svg'),
'KY' => array('name' => 'Cayman Islands', 'flag' => 'flags/cayman-islands.svg'),
'CF' => array('name' => 'Central African Republic', 'flag' => 'flags/central-african-republic.svg'),
'TD' => array('name' => 'Chad', 'flag' => 'flags/chad.svg'),
'CL' => array('name' => 'Chile', 'flag' => 'flags/chile.svg'),
'CN' => array('name' => 'China', 'flag' => 'flags/china.svg'),
'CX' => array('name' => 'Christmas Island', 'flag' => 'flags/christmas-island.svg'),
'CC' => array('name' => 'Cocos (Keeling) Islands', 'flag' => 'flags/cocos-island.svg'),
'CO' => array('name' => 'Colombia', 'flag' => 'flags/colombia.svg'),
'KM' => array('name' => 'Comoros', 'flag' => 'flags/comoros.svg'),
'CK' => array('name' => 'Cook Islands', 'flag' => 'flags/cook-islands.svg'),
'CR' => array('name' => 'Costa Rica', 'flag' => 'flags/costa-rica.svg'),
'CI' => array('name' => 'Côte d\'Ivoire', 'flag' => 'flags/ivory-coast.svg'),
'HR' => array('name' => 'Croatia', 'flag' => 'flags/croatia.svg'),
'CU' => array('name' => 'Cuba', 'flag' => 'flags/cuba.svg'),
'CW' => array('name' => 'Curaçao', 'flag' => 'flags/curacao.svg'),
'CZ' => array('name' => 'Czech Republic', 'flag' => 'flags/czech-republic.svg'),
'DK' => array('name' => 'Denmark', 'flag' => 'flags/denmark.svg'),
'DJ' => array('name' => 'Djibouti', 'flag' => 'flags/djibouti.svg'),
'DM' => array('name' => 'Dominica', 'flag' => 'flags/dominica.svg'),
'DO' => array('name' => 'Dominican Republic', 'flag' => 'flags/dominican-republic.svg'),
'EC' => array('name' => 'Ecuador', 'flag' => 'flags/ecuador.svg'),
'EG' => array('name' => 'Egypt', 'flag' => 'flags/egypt.svg'),
'SV' => array('name' => 'El Salvador', 'flag' => 'flags/el-salvador.svg'),
'GQ' => array('name' => 'Equatorial Guinea', 'flag' => 'flags/equatorial-guinea.svg'),
'ER' => array('name' => 'Eritrea', 'flag' => 'flags/eritrea.svg'),
'EE' => array('name' => 'Estonia', 'flag' => 'flags/estonia.svg'),
'ET' => array('name' => 'Ethiopia', 'flag' => 'flags/ethiopia.svg'),
'FK' => array('name' => 'Falkland Islands (Malvinas)', 'flag' => 'flags/falkland-islands.svg'),
'FJ' => array('name' => 'Fiji', 'flag' => 'flags/fiji.svg'),
'FI' => array('name' => 'Finland', 'flag' => 'flags/finland.svg'),
'FR' => array('name' => 'France', 'flag' => 'flags/france.svg'),
'PF' => array('name' => 'French Polynesia', 'flag' => 'flags/french-polynesia.svg'),
'GA' => array('name' => 'Gabon', 'flag' => 'flags/gabon.svg'),
'GM' => array('name' => 'Gambia', 'flag' => 'flags/gambia.svg'),
'GE' => array('name' => 'Georgia', 'flag' => 'flags/georgia.svg'),
'DE' => array('name' => 'Germany', 'flag' => 'flags/germany.svg'),
'GH' => array('name' => 'Ghana', 'flag' => 'flags/ghana.svg'),
'GI' => array('name' => 'Gibraltar', 'flag' => 'flags/gibraltar.svg'),
'GR' => array('name' => 'Greece', 'flag' => 'flags/greece.svg'),
'GL' => array('name' => 'Greenland', 'flag' => 'flags/greenland.svg'),
'GD' => array('name' => 'Grenada', 'flag' => 'flags/grenada.svg'),
'GU' => array('name' => 'Guam', 'flag' => 'flags/guam.svg'),
'GT' => array('name' => 'Guatemala', 'flag' => 'flags/guatemala.svg'),
'GG' => array('name' => 'Guernsey', 'flag' => 'flags/guernsey.svg'),
'GN' => array('name' => 'Guinea', 'flag' => 'flags/guinea.svg'),
'GW' => array('name' => 'Guinea-Bissau', 'flag' => 'flags/guinea-bissau.svg'),
'HT' => array('name' => 'Haiti', 'flag' => 'flags/haiti.svg'),
'VA' => array('name' => 'Holy See (Vatican City State)', 'flag' => 'flags/vatican-city.svg'),
'HN' => array('name' => 'Honduras', 'flag' => 'flags/honduras.svg'),
'HK' => array('name' => 'Hong Kong', 'flag' => 'flags/hong-kong.svg'),
'HU' => array('name' => 'Hungary', 'flag' => 'flags/hungary.svg'),
'IS' => array('name' => 'Iceland', 'flag' => 'flags/iceland.svg'),
'IN' => array('name' => 'India', 'flag' => 'flags/india.svg'),
'ID' => array('name' => 'Indonesia', 'flag' => 'flags/indonesia.svg'),
'IR' => array('name' => 'Iran, Islamic Republic of', 'flag' => 'flags/iran.svg'),
'IQ' => array('name' => 'Iraq', 'flag' => 'flags/iraq.svg'),
'IE' => array('name' => 'Ireland', 'flag' => 'flags/ireland.svg'),
'IM' => array('name' => 'Isle of Man', 'flag' => 'flags/isle-of-man.svg'),
'IL' => array('name' => 'Israel', 'flag' => 'flags/israel.svg'),
'IT' => array('name' => 'Italy', 'flag' => 'flags/italy.svg'),
'JM' => array('name' => 'Jamaica', 'flag' => 'flags/jamaica.svg'),
'JP' => array('name' => 'Japan', 'flag' => 'flags/japan.svg'),
'JE' => array('name' => 'Jersey', 'flag' => 'flags/jersey.svg'),
'JO' => array('name' => 'Jordan', 'flag' => 'flags/jordan.svg'),
'KZ' => array('name' => 'Kazakhstan', 'flag' => 'flags/kazakhstan.svg'),
'KE' => array('name' => 'Kenya', 'flag' => 'flags/kenya.svg'),
'KI' => array('name' => 'Kiribati', 'flag' => 'flags/kiribati.svg'),
'KP' => array('name' => 'Korea, Democratic People\'s Republic of', 'flag' => 'flags/north-korea.svg'),
'KW' => array('name' => 'Kuwait', 'flag' => 'flags/kuwait.svg'),
'KG' => array('name' => 'Kyrgyzstan', 'flag' => 'flags/kyrgyzstan.svg'),
'LA' => array('name' => 'Lao People\'s Democratic Republic', 'flag' => 'flags/laos.svg'),
'LV' => array('name' => 'Latvia', 'flag' => 'flags/latvia.svg'),
'LB' => array('name' => 'Lebanon', 'flag' => 'flags/lebanon.svg'),
'LS' => array('name' => 'Lesotho', 'flag' => 'flags/lesotho.svg'),
'LR' => array('name' => 'Liberia', 'flag' => 'flags/liberia.svg'),
'LY' => array('name' => 'Libya', 'flag' => 'flags/libya.svg'),
'LI' => array('name' => 'Liechtenstein', 'flag' => 'flags/liechtenstein.svg'),
'LT' => array('name' => 'Lithuania', 'flag' => 'flags/lithuania.svg'),
'LU' => array('name' => 'Luxembourg', 'flag' => 'flags/luxembourg.svg'),
'MO' => array('name' => 'Macao', 'flag' => 'flags/macao.svg'),
'MG' => array('name' => 'Madagascar', 'flag' => 'flags/madagascar.svg'),
'MW' => array('name' => 'Malawi', 'flag' => 'flags/malawi.svg'),
'MY' => array('name' => 'Malaysia', 'flag' => 'flags/malaysia.svg'),
'MV' => array('name' => 'Maldives', 'flag' => 'flags/maldives.svg'),
'ML' => array('name' => 'Mali', 'flag' => 'flags/mali.svg'),
'MT' => array('name' => 'Malta', 'flag' => 'flags/malta.svg'),
'MH' => array('name' => 'Marshall Islands', 'flag' => 'flags/marshall-island.svg'),
'MQ' => array('name' => 'Martinique', 'flag' => 'flags/martinique.svg'),
'MR' => array('name' => 'Mauritania', 'flag' => 'flags/mauritania.svg'),
'MU' => array('name' => 'Mauritius', 'flag' => 'flags/mauritius.svg'),
'MX' => array('name' => 'Mexico', 'flag' => 'flags/mexico.svg'),
'FM' => array('name' => 'Micronesia, Federated States of', 'flag' => 'flags/micronesia.svg'),
'MD' => array('name' => 'Moldova, Republic of', 'flag' => 'flags/moldova.svg'),
'MC' => array('name' => 'Monaco', 'flag' => 'flags/monaco.svg'),
'MN' => array('name' => 'Mongolia', 'flag' => 'flags/mongolia.svg'),
'ME' => array('name' => 'Montenegro', 'flag' => 'flags/montenegro.svg'),
'MS' => array('name' => 'Montserrat', 'flag' => 'flags/montserrat.svg'),
'MA' => array('name' => 'Morocco', 'flag' => 'flags/morocco.svg'),
'MZ' => array('name' => 'Mozambique', 'flag' => 'flags/mozambique.svg'),
'MM' => array('name' => 'Myanmar', 'flag' => 'flags/myanmar.svg'),
'NA' => array('name' => 'Namibia', 'flag' => 'flags/namibia.svg'),
'NR' => array('name' => 'Nauru', 'flag' => 'flags/nauru.svg'),
'NP' => array('name' => 'Nepal', 'flag' => 'flags/nepal.svg'),
'NL' => array('name' => 'Netherlands', 'flag' => 'flags/netherlands.svg'),
'NZ' => array('name' => 'New Zealand', 'flag' => 'flags/new-zealand.svg'),
'NI' => array('name' => 'Nicaragua', 'flag' => 'flags/nicaragua.svg'),
'NE' => array('name' => 'Niger', 'flag' => 'flags/niger.svg'),
'NG' => array('name' => 'Nigeria', 'flag' => 'flags/nigeria.svg'),
'NU' => array('name' => 'Niue', 'flag' => 'flags/niue.svg'),
'NF' => array('name' => 'Norfolk Island', 'flag' => 'flags/norfolk-island.svg'),
'MP' => array('name' => 'Northern Mariana Islands', 'flag' => 'flags/northern-mariana-islands.svg'),
'NO' => array('name' => 'Norway', 'flag' => 'flags/norway.svg'),
'OM' => array('name' => 'Oman', 'flag' => 'flags/oman.svg'),
'PK' => array('name' => 'Pakistan', 'flag' => 'flags/pakistan.svg'),
'PW' => array('name' => 'Palau', 'flag' => 'flags/palau.svg'),
'PS' => array('name' => 'Palestinian Territory, Occupied', 'flag' => 'flags/palestine.svg'),
'PA' => array('name' => 'Panama', 'flag' => 'flags/panama.svg'),
'PG' => array('name' => 'Papua New Guinea', 'flag' => 'flags/papua-new-guinea.svg'),
'PY' => array('name' => 'Paraguay', 'flag' => 'flags/paraguay.svg'),
'PE' => array('name' => 'Peru', 'flag' => 'flags/peru.svg'),
'PH' => array('name' => 'Philippines', 'flag' => 'flags/philippines.svg'),
'PL' => array('name' => 'Poland', 'flag' => 'flags/poland.svg'),
'PT' => array('name' => 'Portugal', 'flag' => 'flags/portugal.svg'),
'PR' => array('name' => 'Puerto Rico', 'flag' => 'flags/puerto-rico.svg'),
'QA' => array('name' => 'Qatar', 'flag' => 'flags/qatar.svg'),
'RO' => array('name' => 'Romania', 'flag' => 'flags/romania.svg'),
'RU' => array('name' => 'Russian Federation', 'flag' => 'flags/russia.svg'),
'RW' => array('name' => 'Rwanda', 'flag' => 'flags/rwanda.svg'),
'BL' => array('name' => 'Saint Barthélemy', 'flag' => 'flags/st-barts.svg'),
'KN' => array('name' => 'Saint Kitts and Nevis', 'flag' => 'flags/saint-kitts-and-nevis.svg'),
'LC' => array('name' => 'Saint Lucia', 'flag' => 'flags/st-lucia.svg'),
'MF' => array('name' => 'Saint Martin (French part)', 'flag' => 'flags/sint-maarten.svg'),
// 'PM' => array('name' => 'Saint Pierre and Miquelon', 'flag' => 'flags/saint-pierre.svg'),
'VC' => array('name' => 'Saint Vincent and the Grenadines', 'flag' => 'flags/st-vincent-and-the-grenadines.svg'),
'WS' => array('name' => 'Samoa', 'flag' => 'flags/samoa.svg'),
'SM' => array('name' => 'San Marino', 'flag' => 'flags/san-marino.svg'),
'ST' => array('name' => 'Sao Tome and Principe', 'flag' => 'flags/sao-tome-and-prince.svg'),
'SA' => array('name' => 'Saudi Arabia', 'flag' => 'flags/saudi-arabia.svg'),
'SN' => array('name' => 'Senegal', 'flag' => 'flags/senegal.svg'),
'RS' => array('name' => 'Serbia', 'flag' => 'flags/serbia.svg'),
'SC' => array('name' => 'Seychelles', 'flag' => 'flags/seychelles.svg'),
'SL' => array('name' => 'Sierra Leone', 'flag' => 'flags/sierra-leone.svg'),
'SG' => array('name' => 'Singapore', 'flag' => 'flags/singapore.svg'),
'SX' => array('name' => 'Sint Maarten (Dutch part)', 'flag' => 'flags/sint-maarten.svg'),
'SK' => array('name' => 'Slovakia', 'flag' => 'flags/slovakia.svg'),
'SI' => array('name' => 'Slovenia', 'flag' => 'flags/slovenia.svg'),
'SB' => array('name' => 'Solomon Islands', 'flag' => 'flags/solomon-islands.svg'),
'SO' => array('name' => 'Somalia', 'flag' => 'flags/somalia.svg'),
'ZA' => array('name' => 'South Africa', 'flag' => 'flags/south-africa.svg'),
'KR' => array('name' => 'South Korea', 'flag' => 'flags/south-korea.svg'),
'SS' => array('name' => 'South Sudan', 'flag' => 'flags/south-sudan.svg'),
'ES' => array('name' => 'Spain', 'flag' => 'flags/spain.svg'),
'LK' => array('name' => 'Sri Lanka', 'flag' => 'flags/sri-lanka.svg'),
'SD' => array('name' => 'Sudan', 'flag' => 'flags/sudan.svg'),
'SR' => array('name' => 'Suriname', 'flag' => 'flags/suriname.svg'),
'SZ' => array('name' => 'Swaziland', 'flag' => 'flags/swaziland.svg'),
'SE' => array('name' => 'Sweden', 'flag' => 'flags/sweden.svg'),
'CH' => array('name' => 'Switzerland', 'flag' => 'flags/switzerland.svg'),
'SY' => array('name' => 'Syrian Arab Republic', 'flag' => 'flags/syria.svg'),
'TW' => array('name' => 'Taiwan, Province of China', 'flag' => 'flags/taiwan.svg'),
'TJ' => array('name' => 'Tajikistan', 'flag' => 'flags/tajikistan.svg'),
'TZ' => array('name' => 'Tanzania, United Republic of', 'flag' => 'flags/tanzania.svg'),
'TH' => array('name' => 'Thailand', 'flag' => 'flags/thailand.svg'),
'TG' => array('name' => 'Togo', 'flag' => 'flags/togo.svg'),
'TK' => array('name' => 'Tokelau', 'flag' => 'flags/tokelau.svg'),
'TO' => array('name' => 'Tonga', 'flag' => 'flags/tonga.svg'),
'TT' => array('name' => 'Trinidad and Tobago', 'flag' => 'flags/trinidad-and-tobago.svg'),
'TN' => array('name' => 'Tunisia', 'flag' => 'flags/tunisia.svg'),
'TR' => array('name' => 'Turkey', 'flag' => 'flags/turkey.svg'),
'TM' => array('name' => 'Turkmenistan', 'flag' => 'flags/turkmenistan.svg'),
'TC' => array('name' => 'Turks and Caicos Islands', 'flag' => 'flags/turks-and-caicos.svg'),
'TV' => array('name' => 'Tuvalu', 'flag' => 'flags/tuvalu.svg'),
'UG' => array('name' => 'Uganda', 'flag' => 'flags/uganda.svg'),
'UA' => array('name' => 'Ukraine', 'flag' => 'flags/ukraine.svg'),
'AE' => array('name' => 'United Arab Emirates', 'flag' => 'flags/united-arab-emirates.svg'),
'GB' => array('name' => 'United Kingdom', 'flag' => 'flags/united-kingdom.svg'),
'US' => array('name' => 'United States', 'flag' => 'flags/united-states.svg'),
'UY' => array('name' => 'Uruguay', 'flag' => 'flags/uruguay.svg'),
'UZ' => array('name' => 'Uzbekistan', 'flag' => 'flags/uzbekistan.svg'),
'VU' => array('name' => 'Vanuatu', 'flag' => 'flags/vanuatu.svg'),
'VE' => array('name' => 'Venezuela, Bolivarian Republic of', 'flag' => 'flags/venezuela.svg'),
'VN' => array('name' => 'Vietnam', 'flag' => 'flags/vietnam.svg'),
'VI' => array('name' => 'Virgin Islands', 'flag' => 'flags/virgin-islands.svg'),
'YE' => array('name' => 'Yemen', 'flag' => 'flags/yemen.svg'),
'ZM' => array('name' => 'Zambia', 'flag' => 'flags/zambia.svg'),
'ZW' => array('name' => 'Zimbabwe', 'flag' => 'flags/zimbabwe.svg')
);
}
public static function getLanguagesList()
{
$countryArr = Data::getCountriesList();
return array(
'id' => array('name' => 'Bahasa Indonesia - Indonesian', 'country' => $countryArr['ID']),
'msa' => array('name' => 'Bahasa Melayu - Malay', 'country' => $countryArr['MY']),
'ca' => array('name' => 'Català - Catalan', 'country' => $countryArr['CA']),
'cs' => array('name' => 'Čeština - Czech', 'country' => $countryArr['CZ']),
'da' => array('name' => 'Dansk - Danish', 'country' => $countryArr['NL']),
'de' => array('name' => 'Deutsch - German', 'country' => $countryArr['DE']),
'en' => array('name' => 'English', 'country' => $countryArr['GB']),
'en-gb' => array('name' => 'English UK - British English', 'country' => $countryArr['GB']),
'es' => array('name' => 'Español - Spanish', 'country' => $countryArr['ES']),
'fil' => array('name' => 'Filipino', 'country' => $countryArr['PH']),
'fr' => array('name' => 'Français - French', 'country' => $countryArr['FR']),
'ga' => array('name' => 'Gaeilge - Irish (beta)', 'country' => $countryArr['GA']),
'gl' => array('name' => 'Galego - Galician (beta)', 'country' => $countryArr['GL']),
'hr' => array('name' => 'Hrvatski - Croatian', 'country' => $countryArr['HR']),
'it' => array('name' => 'Italiano - Italian', 'country' => $countryArr['IT']),
'hu' => array('name' => 'Magyar - Hungarian', 'country' => $countryArr['HU']),
'nl' => array('name' => 'Nederlands - Dutch', 'country' => $countryArr['NL']),
'no' => array('name' => 'Norsk - Norwegian', 'country' => $countryArr['NO']),
'pl' => array('name' => 'Polski - Polish', 'country' => $countryArr['PL']),
'pt' => array('name' => 'Português - Portuguese', 'country' => $countryArr['PT']),
'ro' => array('name' => 'Română - Romanian', 'country' => $countryArr['RO']),
'sk' => array('name' => 'Slovenčina - Slovak', 'country' => $countryArr['SK']),
'fi' => array('name' => 'Suomi - Finnish', 'country' => $countryArr['FI']),
'sv' => array('name' => 'Svenska - Swedish', 'country' => $countryArr['SV']),
'vi' => array('name' => 'Tiếng Việt - Vietnamese', 'country' => $countryArr['VI']),
'tr' => array('name' => 'Türkçe - Turkish', 'country' => $countryArr['TR']),
'el' => array('name' => 'Ελληνικά - Greek', 'country' => $countryArr['GR']),
'bg' => array('name' => 'Български език - Bulgarian', 'country' => $countryArr['BG']),
'ru' => array('name' => 'Русский - Russian', 'country' => $countryArr['RU']),
'sr' => array('name' => 'Српски - Serbian', 'country' => $countryArr['SR']),
'uk' => array('name' => 'Українська мова - Ukrainian', 'country' => $countryArr['UA']),
'he' => array('name' => 'עִבְרִית - Hebrew', 'country' => $countryArr['IL']),
'ur' => array('name' => 'اردو - Urdu (beta)', 'country' => $countryArr['PK']),
'ar' => array('name' => 'العربية - Arabic', 'country' => $countryArr['AR']),
'fa' => array('name' => 'فارسی - Persian', 'country' => $countryArr['AR']),
'mr' => array('name' => 'मराठी - Marathi', 'country' => $countryArr['MR']),
'hi' => array('name' => 'हिन्दी - Hindi', 'country' => $countryArr['IN']),
'bn' => array('name' => 'বাংলা - Bangla', 'country' => $countryArr['BD']),
'gu' => array('name' => 'ગુજરાતી - Gujarati', 'country' => $countryArr['GU']),
'ta' => array('name' => 'தமிழ் - Tamil', 'country' => $countryArr['IN']),
'kn' => array('name' => 'ಕನ್ನಡ - Kannada', 'country' => $countryArr['KN']),
'th' => array('name' => 'ภาษาไทย - Thai', 'country' => $countryArr['TH']),
'ko' => array('name' => '한국어 - Korean', 'country' => $countryArr['KR']),
'ja' => array('name' => '日本語 - Japanese', 'country' => $countryArr['JP']),
'zh-cn' => array('name' => '简体中文 - Simplified Chinese', 'country' => $countryArr['CN']),
'zh-tw' => array('name' => '繁體中文 - Traditional Chinese', 'country' => $countryArr['TW'])
);
}
public static function getCurrencyList()
{
$countryArr = Data::getCountriesList();
return array(
'USD' => array('name' => 'USA dollar', 'country' => $countryArr['US']),
'GBP' => array('name' => 'British pound', 'country' => $countryArr['GB']),
'AUD' => array('name' => 'Australian dollar', 'country' => $countryArr['AU']),
'JPY' => array('name' => 'Japanese yen', 'country' => $countryArr['JP']),
'SEK' => array('name' => 'Swedish krona', 'country' => $countryArr['SE']),
'CAD' => array('name' => 'Canadian dollar', 'country' => $countryArr['CA']),
'CHF' => array('name' => 'Swiss franc', 'country' => $countryArr['CH'])
);
}
public static function getTimeZonesList()
{
return array(
'International Date Line West' => array('name' => '(GMT-11:00) International Date Line West', 'offset' => '-39600'),
'Midway Island' => array('name' => '(GMT-11:00) Midway Island', 'offset' => '-39600'),
'Samoa' => array('name' => '(GMT-11:00) Samoa', 'offset' => '-39600'),
'Hawaii' => array('name' => '(GMT-10:00) Hawaii', 'offset' => '-36000'),
'Alaska' => array('name' => '(GMT-08:00) Alaska', 'offset' => '-28800'),
'Pacific Time (US & Canada)' => array('name' => '(GMT-07:00) Pacific Time (US & Canada)', 'offset' => '-25200'),
'Tijuana' => array('name' => '(GMT-07:00) Tijuana', 'offset' => '-25200'),
'Arizona' => array('name' => '(GMT-07:00) Arizona', 'offset' => '-25200'),
'Mountain Time (US & Canada)' => array('name' => '(GMT-06:00) Mountain Time (US & Canada)', 'offset' => '-21600'),
'Chihuahua' => array('name' => '(GMT-06:00) Chihuahua', 'offset' => '-21600'),
'Mazatlan' => array('name' => '(GMT-06:00) Mazatlan', 'offset' => '-21600'),
'Saskatchewan' => array('name' => '(GMT-06:00) Saskatchewan', 'offset' => '-21600'),
'Central America' => array('name' => '(GMT-06:00) Central America', 'offset' => '-21600'),
'Central Time (US & Canada)' => array('name' => '(GMT-05:00) Central Time (US & Canada)', 'offset' => '-18000'),
'Guadalajara' => array('name' => '(GMT-05:00) Guadalajara', 'offset' => '-18000'),
'Mexico City' => array('name' => '(GMT-05:00) Mexico City', 'offset' => '-18000'),
'Monterrey' => array('name' => '(GMT-05:00) Monterrey', 'offset' => '-18000'),
'Bogota' => array('name' => '(GMT-05:00) Bogota', 'offset' => '-18000'),
'Lima' => array('name' => '(GMT-05:00) Lima', 'offset' => '-18000'),
'Quito' => array('name' => '(GMT-05:00) Quito', 'offset' => '-18000'),
'Eastern Time (US & Canada)' => array('name' => '(GMT-04:00) Eastern Time (US & Canada)', 'offset' => '-14400'),
'Indiana (East)' => array('name' => '(GMT-04:00) Indiana (East)', 'offset' => '-14400'),
'Caracas' => array('name' => '(GMT-04:00) Caracas', 'offset' => '-14400'),
'La Paz' => array('name' => '(GMT-04:00) La Paz', 'offset' => '-14400'),
'Georgetown' => array('name' => '(GMT-04:00) Georgetown', 'offset' => '-14400'),
'Atlantic Time (Canada)' => array('name' => '(GMT-03:00) Atlantic Time (Canada)', 'offset' => '-10800'),
'Santiago' => array('name' => '(GMT-03:00) Santiago', 'offset' => '-10800'),
'Brasilia' => array('name' => '(GMT-03:00) Brasilia', 'offset' => '-10800'),
'Buenos Aires' => array('name' => '(GMT-03:00) Buenos Aires', 'offset' => '-10800'),
'Newfoundland' => array('name' => '(GMT-02:30) Newfoundland', 'offset' => '-9000'),
'Greenland' => array('name' => '(GMT-02:00) Greenland', 'offset' => '-7200'),
'Mid-Atlantic' => array('name' => '(GMT-02:00) Mid-Atlantic', 'offset' => '-7200'),
'Cape Verde Is.' => array('name' => '(GMT-01:00) Cape Verde Is.', 'offset' => '-3600'),
'Azores' => array('name' => '(GMT) Azores', 'offset' => '0'),
'Monrovia' => array('name' => '(GMT) Monrovia', 'offset' => '0'),
'UTC' => array('name' => '(GMT) UTC', 'offset' => '0'),
'Dublin' => array('name' => '(GMT+01:00) Dublin', 'offset' => '3600'),
'Edinburgh' => array('name' => '(GMT+01:00) Edinburgh', 'offset' => '3600'),
'Lisbon' => array('name' => '(GMT+01:00) Lisbon', 'offset' => '3600'),
'London' => array('name' => '(GMT+01:00) London', 'offset' => '3600'),
'Casablanca' => array('name' => '(GMT+01:00) Casablanca', 'offset' => '3600'),
'West Central Africa' => array('name' => '(GMT+01:00) West Central Africa', 'offset' => '3600'),
'Belgrade' => array('name' => '(GMT+02:00) Belgrade', 'offset' => '7200'),
'Bratislava' => array('name' => '(GMT+02:00) Bratislava', 'offset' => '7200'),
'Budapest' => array('name' => '(GMT+02:00) Budapest', 'offset' => '7200'),
'Ljubljana' => array('name' => '(GMT+02:00) Ljubljana', 'offset' => '7200'),
'Prague' => array('name' => '(GMT+02:00) Prague', 'offset' => '7200'),
'Sarajevo' => array('name' => '(GMT+02:00) Sarajevo', 'offset' => '7200'),
'Skopje' => array('name' => '(GMT+02:00) Skopje', 'offset' => '7200'),
'Warsaw' => array('name' => '(GMT+02:00) Warsaw', 'offset' => '7200'),
'Zagreb' => array('name' => '(GMT+02:00) Zagreb', 'offset' => '7200'),
'Brussels' => array('name' => '(GMT+02:00) Brussels', 'offset' => '7200'),
'Copenhagen' => array('name' => '(GMT+02:00) Copenhagen', 'offset' => '7200'),
'Madrid' => array('name' => '(GMT+02:00) Madrid', 'offset' => '7200'),
'Paris' => array('name' => '(GMT+02:00) Paris', 'offset' => '7200'),
'Amsterdam' => array('name' => '(GMT+02:00) Amsterdam', 'offset' => '7200'),
'Berlin' => array('name' => '(GMT+02:00) Berlin', 'offset' => '7200'),
'Bern' => array('name' => '(GMT+02:00) Bern', 'offset' => '7200'),
'Rome' => array('name' => '(GMT+02:00) Rome', 'offset' => '7200'),
'Stockholm' => array('name' => '(GMT+02:00) Stockholm', 'offset' => '7200'),
'Vienna' => array('name' => '(GMT+02:00) Vienna', 'offset' => '7200'),
'Cairo' => array('name' => '(GMT+02:00) Cairo', 'offset' => '7200'),
'Harare' => array('name' => '(GMT+02:00) Harare', 'offset' => '7200'),
'Pretoria' => array('name' => '(GMT+02:00) Pretoria', 'offset' => '7200'),
'Bucharest' => array('name' => '(GMT+03:00) Bucharest', 'offset' => '10800'),
'Helsinki' => array('name' => '(GMT+03:00) Helsinki', 'offset' => '10800'),
'Kiev' => array('name' => '(GMT+03:00) Kiev', 'offset' => '10800'),
'Kyiv' => array('name' => '(GMT+03:00) Kyiv', 'offset' => '10800'),
'Riga' => array('name' => '(GMT+03:00) Riga', 'offset' => '10800'),
'Sofia' => array('name' => '(GMT+03:00) Sofia', 'offset' => '10800'),
'Tallinn' => array('name' => '(GMT+03:00) Tallinn', 'offset' => '10800'),
'Vilnius' => array('name' => '(GMT+03:00) Vilnius', 'offset' => '10800'),
'Athens' => array('name' => '(GMT+03:00) Athens', 'offset' => '10800'),
'Istanbul' => array('name' => '(GMT+03:00) Istanbul', 'offset' => '10800'),
'Minsk' => array('name' => '(GMT+03:00) Minsk', 'offset' => '10800'),
'Jerusalem' => array('name' => '(GMT+03:00) Jerusalem', 'offset' => '10800'),
'Moscow' => array('name' => '(GMT+03:00) Moscow', 'offset' => '10800'),
'St. Petersburg' => array('name' => '(GMT+03:00) St. Petersburg', 'offset' => '10800'),
'Volgograd' => array('name' => '(GMT+03:00) Volgograd', 'offset' => '10800'),
'Kuwait' => array('name' => '(GMT+03:00) Kuwait', 'offset' => '10800'),
'Riyadh' => array('name' => '(GMT+03:00) Riyadh', 'offset' => '10800'),
'Nairobi' => array('name' => '(GMT+03:00) Nairobi', 'offset' => '10800'),
'Baghdad' => array('name' => '(GMT+03:00) Baghdad', 'offset' => '10800'),
'Abu Dhabi' => array('name' => '(GMT+04:00) Abu Dhabi', 'offset' => '14400'),
'Muscat' => array('name' => '(GMT+04:00) Muscat', 'offset' => '14400'),
'Baku' => array('name' => '(GMT+04:00) Baku', 'offset' => '14400'),
'Tbilisi' => array('name' => '(GMT+04:00) Tbilisi', 'offset' => '14400'),
'Yerevan' => array('name' => '(GMT+04:00) Yerevan', 'offset' => '14400'),
'Tehran' => array('name' => '(GMT+04:30) Tehran', 'offset' => '16200'),
'Kabul' => array('name' => '(GMT+04:30) Kabul', 'offset' => '16200'),
'Ekaterinburg' => array('name' => '(GMT+05:00) Ekaterinburg', 'offset' => '18000'),
'Islamabad' => array('name' => '(GMT+05:00) Islamabad', 'offset' => '18000'),
'Karachi' => array('name' => '(GMT+05:00) Karachi', 'offset' => '18000'),
'Tashkent' => array('name' => '(GMT+05:00) Tashkent', 'offset' => '18000'),
'Chennai' => array('name' => '(GMT+05:30) Chennai', 'offset' => '19800'),
'Kolkata' => array('name' => '(GMT+05:30) Kolkata', 'offset' => '19800'),
'Mumbai' => array('name' => '(GMT+05:30) Mumbai', 'offset' => '19800'),
'New Delhi' => array('name' => '(GMT+05:30) New Delhi', 'offset' => '19800'),
'Sri Jayawardenepura' => array('name' => '(GMT+05:30) Sri Jayawardenepura', 'offset' => '19800'),
'Kathmandu' => array('name' => '(GMT+05:45) Kathmandu', 'offset' => '20700'),
'Astana' => array('name' => '(GMT+06:00) Astana', 'offset' => '21600'),
'Dhaka' => array('name' => '(GMT+06:00) Dhaka', 'offset' => '21600'),
'Almaty' => array('name' => '(GMT+06:00) Almaty', 'offset' => '21600'),
'Urumqi' => array('name' => '(GMT+06:00) Urumqi', 'offset' => '21600'),
'Rangoon' => array('name' => '(GMT+06:30) Rangoon', 'offset' => '23400'),
'Novosibirsk' => array('name' => '(GMT+07:00) Novosibirsk', 'offset' => '25200'),
'Bangkok' => array('name' => '(GMT+07:00) Bangkok', 'offset' => '25200'),
'Hanoi' => array('name' => '(GMT+07:00) Hanoi', 'offset' => '25200'),
'Jakarta' => array('name' => '(GMT+07:00) Jakarta', 'offset' => '25200'),
'Krasnoyarsk' => array('name' => '(GMT+07:00) Krasnoyarsk', 'offset' => '25200'),
'Beijing' => array('name' => '(GMT+08:00) Beijing', 'offset' => '28800'),
'Chongqing' => array('name' => '(GMT+08:00) Chongqing', 'offset' => '28800'),
'Hong Kong' => array('name' => '(GMT+08:00) Hong Kong', 'offset' => '28800'),
'Kuala Lumpur' => array('name' => '(GMT+08:00) Kuala Lumpur', 'offset' => '28800'),
'Singapore' => array('name' => '(GMT+08:00) Singapore', 'offset' => '28800'),
'Taipei' => array('name' => '(GMT+08:00) Taipei', 'offset' => '28800'),
'Perth' => array('name' => '(GMT+08:00) Perth', 'offset' => '28800'),
'Irkutsk' => array('name' => '(GMT+08:00) Irkutsk', 'offset' => '28800'),
'Ulaan Bataar' => array('name' => '(GMT+08:00) Ulaan Bataar', 'offset' => '28800'),
'Seoul' => array('name' => '(GMT+09:00) Seoul', 'offset' => '32400'),
'Osaka' => array('name' => '(GMT+09:00) Osaka', 'offset' => '32400'),
'Sapporo' => array('name' => '(GMT+09:00) Sapporo', 'offset' => '32400'),
'Tokyo' => array('name' => '(GMT+09:00) Tokyo', 'offset' => '32400'),
'Yakutsk' => array('name' => '(GMT+09:00) Yakutsk', 'offset' => '32400'),
'Darwin' => array('name' => '(GMT+09:30) Darwin', 'offset' => '34200'),
'Adelaide' => array('name' => '(GMT+09:30) Adelaide', 'offset' => '34200'),
'Canberra' => array('name' => '(GMT+10:00) Canberra', 'offset' => '36000'),
'Melbourne' => array('name' => '(GMT+10:00) Melbourne', 'offset' => '36000'),
'Sydney' => array('name' => '(GMT+10:00) Sydney', 'offset' => '36000'),
'Brisbane' => array('name' => '(GMT+10:00) Brisbane', 'offset' => '36000'),
'Hobart' => array('name' => '(GMT+10:00) Hobart', 'offset' => '36000'),
'Vladivostok' => array('name' => '(GMT+10:00) Vladivostok', 'offset' => '36000'),
'Guam' => array('name' => '(GMT+10:00) Guam', 'offset' => '36000'),
'Port Moresby' => array('name' => '(GMT+10:00) Port Moresby', 'offset' => '36000'),
'Solomon Is.' => array('name' => '(GMT+10:00) Solomon Is.', 'offset' => '36000'),
'Magadan' => array('name' => '(GMT+11:00) Magadan', 'offset' => '39600'),
'New Caledonia' => array('name' => '(GMT+11:00) New Caledonia', 'offset' => '39600'),
'Fiji' => array('name' => '(GMT+12:00) Fiji', 'offset' => '43200'),
'Kamchatka' => array('name' => '(GMT+12:00) Kamchatka', 'offset' => '43200'),
'Marshall Is.' => array('name' => '(GMT+12:00) Marshall Is.', 'offset' => '43200'),
'Auckland' => array('name' => '(GMT+12:00) Auckland', 'offset' => '43200'),
'Wellington' => array('name' => '(GMT+12:00) Wellington', 'offset' => '43200'),
'Nuku\'alofa' => array('name' => '(GMT+13:00) Nuku\'alofa', 'offset' => '46800')
);
}
public static function getSampleUserInfo($index = -1)
{
$users = array(
array(
'name' => 'Emma Smith',
'avatar' => 'avatars/300-6.jpg',
'email' => 'e.smith@kpmg.com.au',
'position' => 'Art Director',
"online" => false
),
array(
'name' => 'Melody Macy',
'initials' => array('label' => 'M', 'state' => 'danger'),
'email' => 'melody@altbox.com',
'position' => 'Marketing Analytic',
"online" => true
),
array(
'name' => 'Max Smith',
'avatar' => 'avatars/300-1.jpg',
'email' => 'max@kt.com',
'position' => 'Software Enginer',
"online" => false
),
array(
'name' => 'Sean Bean',
'avatar' => 'avatars/300-5.jpg',
'email' => 'sean@dellito.com',
'position' => 'Web Developer',
"online" => false
),
array(
'name' => 'Brian Cox',
'avatar' => 'avatars/300-25.jpg',
'email' => 'brian@exchange.com',
'position' => 'UI/UX Designer',
"online" => false
),
array(
'name' => 'Mikaela Collins',
'initials' => array('label' => 'C', 'state' => 'warning'),
'email' => 'mikaela@pexcom.com',
'position' => 'Head Of Marketing',
"online" => true
),
array(
'name' => 'Francis Mitcham',
'avatar' => 'avatars/300-9.jpg',
'email' => 'f.mitcham@kpmg.com.au',
'position' => 'Software Arcitect',
"online" => false
),
array(
'name' => 'Olivia Wild',
'initials' => array('label' => 'O', 'state' => 'danger'),
'email' => 'olivia@corpmail.com',
'position' => 'System Admin',
"online" => true
),
array(
'name' => 'Neil Owen',
'initials' => array('label' => 'N', 'state' => 'primary'),
'email' => 'owen.neil@gmail.com',
'position' => 'Account Manager',
"online" => true
),
array(
'name' => 'Dan Wilson',
'avatar' => 'avatars/300-23.jpg',
'email' => 'dam@consilting.com',
'position' => 'Web Desinger',
"online" => false
),
array(
'name' => 'Emma Bold',
'initials' => array('label' => 'E', 'state' => 'danger'),
'email' => 'emma@intenso.com',
'position' => 'Corporate Finance',
"online" => true
),
array(
'name' => 'Ana Crown',
'avatar' => 'avatars/300-12.jpg',
'email' => 'ana.cf@limtel.com',
'position' => 'Customer Relationship',
"online" => false
),
array(
'name' => 'Robert Doe',
'initials' => array('label' => 'A', 'state' => 'info'),
'email' => 'robert@benko.com',
'position' => 'Marketing Executive',
"online" => true
),
array(
'name' => 'John Miller',
'avatar' => 'avatars/300-13.jpg',
'email' => 'miller@mapple.com',
'position' => 'Project Manager',
"online" => false
),
array(
'name' => 'Lucy Kunic',
'initials' => array('label' => 'L', 'state' => 'success'),
'email' => 'lucy.m@fentech.com',
'position' => 'SEO Master',
"online" => true
),
array(
'name' => 'Ethan Wilder',
'avatar' => 'avatars/300-21.jpg',
'email' => 'ethan@loop.com.au',
'position' => 'Accountant',
"online" => true
)
);
$total = count($users);
if ($index === -1 || isset($users[$index]) === false) {
$index = rand(0, $total - 1);
}
return $users[$index];
}
public static function getSampleStatus($index = -1)
{
$statuses = array(
array('label' => 'Approved', 'state' => 'success'),
array('label' => 'Pending', 'state' => 'warning'),
array('label' => 'Rejected', 'state' => 'danger'),
array('label' => 'In progress', 'state' => 'info'),
array('label' => 'Completed', 'state' => 'primary'),
);
$total = count($statuses);
if ($index === -1 || isset($statuses[$index]) === false) {
$index = rand(0, $total - 2);
}
return $statuses[$index];
}
public static function getSampleDate()
{
$dates = array('Feb 21', 'Mar 10', 'Apr 15', 'May 05', 'Jun 20', 'Jun 24', 'Jul 25', 'Aug 19', 'Sep 22', 'Oct 25', 'Nov 10', 'Dec 20');
$date = $dates[rand(0, count($dates) - 1)] . ", " . date("Y");
return $date;
}
public static function getSampleDatetime()
{
$dates = array('21 Feb', '10 Mar', '15 Apr', '05 May', '20 Jun', '24 Jun', '25 Jul', '19 Aug', '22 Sep', '25 Oct', '10 Nov', '20 Dec');
$times = array('8:43 pm', '10:30 am', '5:20 pm', '2:40 pm', '11:05 am', '10:10 pm', '6:05 pm', '11:30 am', '5:30 pm', '9:23 pm', '6:43 am');
$date = $dates[rand(0, count($dates) - 1)] . " " . date("Y") . ", " . $times[rand(0, count($times) - 1)];
return $date;
}
}

521
app/Core/Menu.php Normal file
View file

@ -0,0 +1,521 @@
<?php
namespace App\Core;
use App\Core\Adapters\Theme;
class Menu
{
// Menu config
public $items;
// Current page path
private $path;
// Default menu tag
private $parentTag = 'div';
// Default menu item tag
private $itemTag = 'div';
// Default icon visibility
private $displayIcons = true;
// Hide root level icons
private $hideRootLevelIcons = false;
// Menu registered callbacks
private $callbacks = array();
// Default item link class
private $itemLinkClass = '';
// Default icon type in menu config
private $iconType = 'svg';
// Default root icon
private $iconRoot = '';
// Hide root arrow
private $hideRootArrow = false;
// Iteration level
private $linkLevel = 0;
/**
* Private Methods.
*
*/
private function _generateItem($item, $level = 0)
{
$classes = array('menu-item');
$attributes = array();
// Set iteration level
$this->linkLevel = $level;
// Overcome recursive infinite loop
if ($level > 10000) {
return;
}
// Process callable item
if (is_callable($item)) {
$item = call_user_func($item);
}
// Exit if item is null
if ($item === null) {
return;
}
// Handle menu item visiblity with callback function
if (isset($item['hide'])) {
if (is_callable($item['hide'])) {
$hide = call_user_func($item['hide'], $this, $item);
} else {
$hide = $item['hide'];
}
if ($hide === true) {
return;
}
}
if (isset($item['sub']) && ($this->_matchParentItemByPath($item) === true)) {
$classes[] = 'here show';
}
if (isset($item['attributes']) && isset($item['attributes']['item'])) {
$attributes = $item['attributes']['item'];
} elseif (isset($item['attributes']) && isset($item['attributes']['link']) === false) {
$attributes = $item['attributes'];
}
if (isset($item['classes']) && isset($item['classes']['item'])) {
$classes[] = $item['classes']['item'];
}
echo '<' . $this->itemTag . ' ' . Util::getHtmlAttributes($attributes) . Util::getHtmlClass($classes) . '>';
if (isset($item['custom'])) {
$this->_generateItemCustom($item);
}
if (isset($item['content'])) {
$this->_generateItemContent($item);
}
if (isset($item['title']) || isset($item['breadcrumb-title'])) {
$this->_generateItemLink($item);
}
if (isset($item['heading'])) {
$this->_generateItemHeading($item);
}
if (isset($item['sub'])) {
$this->_generateItemSub($item['sub'], $level++);
}
echo '</' . $this->itemTag . '>';
}
private function _generateItemLink($item)
{
$classes = array('menu-link');
$attributes = array();
$tag = 'a';
// Construct li ks attributes
if (isset($item['path'])) {
// Assign the page URL
$attributes['href'] = Theme::getPageUrl($item['path']);
// Handle open in new tab mode
if (isset($item['new-tab']) && $item['new-tab'] === true) {
$attributes['target'] = 'blank';
}
// Add special attribute for links to pro pages
if (Theme::isFreeVersion() === true && Theme::isProPage($item['path']) === true) {
$attributes['data-kt-page'] = 'pro';
}
} else {
$tag = 'span';
}
if (isset($item['attributes']) && isset($item['attributes']['link'])) {
$attributes = array_merge($attributes, $item['attributes']['link']);
}
if ($this->_matchItemByPath($item) === true) {
$classes[] = 'active';
}
if (!empty($this->itemLinkClass)) {
$classes[] = $this->itemLinkClass;
}
if (isset($item['classes']) && isset($item['classes']['link'])) {
$classes[] = $item['classes']['link'];
}
echo '<' . $tag . Util::getHtmlClass($classes) . Util::getHtmlAttributes($attributes) . '>';
if ($this->displayIcons !== false) {
$this->_generateItemLinkIcon($item);
}
$this->_generateItemLinkBullet($item);
if (isset($item['title'])) {
$this->_generateItemLinkTitle($item);
}
$this->_generateItemLinkBadge($item);
if (isset($item['sub']) && @$item['arrow'] !== false) {
if (!($this->hideRootArrow === true && $this->linkLevel === 0)) {
$this->_generateItemLinkArrow($item);
}
}
echo '</' . $tag . '>';
}
private function _generateItemLinkTitle($item)
{
$classes = array('menu-title');
if (isset($item['classes']) && isset($item['classes']['title'])) {
$classes[] = $item['classes']['title'];
}
if (!is_string($item['title']) && is_callable($item['title'])) {
$item['title'] = call_user_func($item['title'], $item);
}
echo '<span ' . Util::getHtmlClass($classes) . '>';
if (isset($this->callbacks['title']) && is_callable($this->callbacks['title'])) {
echo call_user_func($this->callbacks['title'], $item, $item['title']);
} else {
echo __($item['title']);
// Append exclusive badge
if (isset($item['path']) && Theme::isExclusivePage($item['path']) === true) {
echo '<span class="badge badge-exclusive badge-light-success fw-bold fs-9 px-2 py-1 ms-1">Exclusive</span>';
}
// Append pro badge
if (Theme::isFreeVersion()) {
if ((isset($item['path']) && Theme::isProPage($item['path']) === true) || (isset($item['pro']) && $item['pro'] === true)) {
echo '<span class="badge badge-pro badge-light-danger fw-bold fs-9 px-2 py-1 ms-1">Pro</span>';
}
}
}
echo '</span>';
}
private function _generateItemLinkIcon($item)
{
$classes = array('menu-icon');
if (isset($item['classes']) && isset($item['classes']['icon'])) {
$classes[] = $item['classes']['icon'];
}
if (isset($item['icon'])) {
echo '<span ' . Util::getHtmlClass($classes) . '>';
if ($this->linkLevel === 0 && !empty($this->iconRoot)) {
echo $this->iconRoot;
} else {
if (is_array($item['icon'])) {
echo $item['icon'][$this->iconType];
} else {
echo $item['icon'];
}
}
echo '</span>';
return;
}
}
private function _generateItemLinkBullet($item)
{
if (isset($item['icon']) === true && $this->displayIcons !== false) {
return;
}
$classes = array('menu-bullet');
if (isset($item['classes']) && isset($item['classes']['bullet'])) {
$classes[] = $item['classes']['bullet'];
}
if (isset($item['bullet'])) {
echo '<span ' . Util::getHtmlClass($classes) . '>';
if (isset($item['bullet'])) {
echo $item['bullet'];
}
echo '</span>';
}
}
private function _generateItemLinkBadge($item)
{
$classes = array('menu-badge');
if (isset($item['classes']) && isset($item['classes']['badge'])) {
$classes[] = $item['classes']['badge'];
}
if (isset($item['badge'])) {
echo '<span ' . Util::getHtmlClass($classes) . '>';
echo $item['badge'];
echo '</span>';
}
}
private function _generateItemLinkArrow($item)
{
$classes = array('menu-arrow');
if (isset($item['classes']['arrow'])) {
$classes[] = $item['classes']['arrow'];
}
echo '<span ' . Util::getHtmlClass($classes) . '>';
echo '</span>';
}
private function _generateItemSub($sub, $level)
{
$classes = array('menu-sub');
if (isset($sub['class'])) {
$classes[] = $sub['class'];
}
echo '<' . $this->parentTag . ' ' . Util::getHtmlClass($classes) . '>';
if (isset($sub['view'])) {
Theme::getView($sub['view']);
} else {
foreach ($sub['items'] as $item) {
$this->_generateItem($item, $level++);
}
}
echo '</' . $this->parentTag . '>';
}
private function _generateItemHeading($item)
{
$classes = array('menu-content');
if (isset($item['heading'])) {
if (isset($this->callbacks['heading']) && is_callable($this->callbacks['heading'])) {
echo call_user_func($this->callbacks['heading'], $item['heading']);
} else {
echo '<h3 ' . Util::getHtmlClass($classes) . '>';
echo $item['heading'];
echo '</h3>';
}
}
}
private function _generateItemContent($item)
{
$classes = array('menu-content');
if (isset($item['classes']) && isset($item['classes']['content'])) {
$classes[] = $item['classes']['content'];
}
if (isset($item['content'])) {
echo '<div ' . Util::getHtmlClass($classes) . '>';
echo $item['content'];
echo '</div>';
}
}
private function _generateItemCustom($item)
{
if (isset($item['custom'])) {
echo $item['custom'];
}
}
private function _matchParentItemByPath($item, $level = 0)
{
if ($level > 1000) {
return false;
}
if ($this->_matchItemByPath($item) === true) {
return true;
} else {
if (isset($item['sub']) && isset($item['sub']['items'])) {
foreach ($item['sub']['items'] as $currentItem) {
if ($this->_matchParentItemByPath($currentItem, $level++) === true) {
return true;
}
}
}
return false;
}
}
private function _matchItemByPath($item)
{
if (isset($item['path']) && ($this->path === $item['path'] || $this->path === $item['path'] . '/index')) {
return true;
} else {
return false;
}
}
private function _buildBreadcrumb($items, &$breadcrumb, $options, $level = 0)
{
if ($level > 10000) {
return false;
}
foreach ($items as $item) {
$title = '';
if (isset($item['breadcrumb-title'])) {
$title = $item['breadcrumb-title'];
} elseif (isset($item['title'])) {
if (!is_string($item['title']) && is_callable($item['title'])) {
$title = call_user_func($item['title'], $item);
} else {
$title = $item['title'];
}
} elseif (isset($item['heading'])) {
$title = $item['heading'];
}
if (isset($item['path']) && ($item['path'] === $this->path || $item['path'] . '/index' === $this->path)) {
if (@$options['skip-active'] !== true) {
$breadcrumb[] = array(
'title' => $title,
'path' => isset($item['path']) ? $item['path'] : '',
'active' => true
);
}
return true;
} elseif (isset($item['sub']) && isset($item['sub']['items'])) {
if ($this->_buildBreadcrumb($item['sub']['items'], $breadcrumb, $options, $level++) === true) {
$breadcrumb[] = array(
'title' => $title,
'path' => isset($item['path']) ? $item['path'] : ( isset($item['alt-path']) ? $item['alt-path'] : ''),
'active' => false
);
return true;
}
}
}
return false;
}
/**
* Public Methods.
*
*/
public function __construct($items, $path = '')
{
$this->items = $items;
$this->path = $path;
return $this;
}
/**
* options: array('includeHomeLink' => boolean, 'homeLink' => array(), 'skipCurrentPage' => boolean)
*
*/
public function getBreadcrumb($options = array())
{
$breadcrumb = array();
//$includeHomeLink = true, $homeLink = null
$this->_buildBreadcrumb($this->items, $breadcrumb, $options);
$breadcrumb = array_reverse($breadcrumb, true);
if (!empty($breadcrumb)) {
if (isset($options['home'])) {
array_unshift($breadcrumb, $options['home']);
} else {
array_unshift($breadcrumb, array(
'title' => 'Home',
'path' => 'index',
'active' => false
));
}
}
return $breadcrumb;
}
public function setPath($path)
{
$this->path = $path;
}
public function displayIcons($flag)
{
$this->displayIcons = $flag;
}
public function hideRootArrow($flag)
{
$this->hideRootArrow = $flag;
}
public function setItemTag($tagName)
{
$this->itemTag = $tagName;
}
public function setIconType($type)
{
$this->iconType = $type;
}
public function setDefaultRootIcon($icon)
{
$this->iconRoot = $icon;
}
public function setItemLinkClass($class)
{
$this->itemLinkClass = $class;
}
public function addCallback($target, $callback)
{
if (!is_string($callback) && is_callable($callback)) {
$this->callbacks[$target] = $callback;
}
}
public function build()
{
foreach ($this->items as $item) {
$this->_generateItem($item);
}
}
}

1352
app/Core/Theme.php Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,20 @@
<?php
namespace App\Core\Traits;
use Spatie\Activitylog\LogOptions;
use Spatie\Activitylog\Traits\LogsActivity;
trait SpatieLogsActivity
{
use LogsActivity;
public function getActivitylogOptions(): LogOptions
{
$logOptions = new LogOptions();
$logOptions->logAll();
$logOptions->logOnlyDirty();
return $logOptions;
}
}

523
app/Core/Util.php Normal file
View file

@ -0,0 +1,523 @@
<?php
namespace App\Core;
use tidy;
use App\Core\Adapters\Theme;
class Util
{
/**
* Class init state.
*
* @var boolean
*/
private static $initialized = false;
/**
* Class constructor.
*
*/
public static function init()
{
if (self::$initialized) {
return;
}
self::$initialized = true;
}
public static function startCode()
{
ob_start();
}
public static function endCode()
{
$str = ob_get_clean();
$str = trim($str);
$str = htmlspecialchars($str);
echo $str;
}
public static function outputCode($str)
{
$str = trim($str);
$str = htmlspecialchars($str);
echo $str;
}
public static function code($str)
{
echo self::getCode($str);
}
public static function getCode($str)
{
$str = trim($str);
$str = htmlspecialchars($str);
return $str;
}
public static function parseCode($code, $lang = 'html', $height = 0)
{
$height = $height > 0 ? 'style="height:' . $height . 'px"' : '';
$code = '<pre class="language-' . $lang . '" ' . $height . '><code class="language-' . $lang . '">' . htmlspecialchars(trim($code), ENT_QUOTES) . '</code></pre>';
return $code;
}
public static function highlight()
{
$tabItemActive = 'active';
$tabPaneActive = 'show active';
$args = func_get_args();
echo '<!--begin::Highlight-->';
echo '<div class="highlight">';
echo ' <button class="highlight-copy btn" data-bs-toggle="tooltip" title="Copy code">copy</button>';
if (!empty($args)) {
if (isset($args[0]) && is_array($args[0]) === false) {
echo ' <div class="highlight-code">';
echo Util::parseCode($args[0], @$args[1], @$args[2]);
echo ' </div>';
} elseif (is_array($args[0]) && isset($args[1]) === false) {
$options = $args[0];
echo '<ul class="nav nav-pills" role="tablist">';
foreach ($options as $key => $each) {
if (isset($each['lang']) === true) {
$uid = 'kt_highlight_' . uniqid();
$options[$key]['id'] = $uid;
echo '<li class="nav-item">';
echo ' <a class="nav-link ' . $tabItemActive . '" href="#" data-bs-toggle="tab" href="#' . $uid . '" role="tab">' . strtoupper($each['lang']) . '</a>';
echo '</li>';
$tabItemActive = '';
}
}
echo '</ul>';
echo '<div class="tab-content">';
foreach ($options as $each) {
if (isset($each['lang']) === true) {
echo '<div class="tab-pane fade ' . $tabPaneActive . '" id="' . $each['id'] . '" role="tabpanel">';
echo ' <div class="highlight-code">';
echo Util::parseCode($each['code'], $each['lang'], @$each['height']);
echo ' </div>';
echo '</div>';
$tabPaneActive = '';
}
}
echo '</div>';
}
}
echo '</div>';
echo '<!--end::Highlight-->';
}
public static function tidyHtml($buffer)
{
if (! extension_loaded('Tidy')) {
return $buffer;
}
// Specify configuration
$config = array(
// 'clean' => true,
'drop-empty-elements' => false,
'doctype' => 'omit',
'indent' => 2,
// 'output-html' => true,
// 'output-xhtml' => true,
// 'force-output' => true,
'show-body-only' => true,
'indent-with-tabs' => true,
'tab-size' => 1,
'indent-spaces' => 1,
'tidy-mark' => false,
'wrap' => 0,
'indent-attributes' => false,
'input-xml' => true,
// HTML5 tags
'new-blocklevel-tags' => 'article aside audio bdi canvas details dialog figcaption figure footer header hgroup main menu menuitem nav section source summary template track video',
'new-empty-tags' => 'command embed keygen source track wbr',
'new-inline-tags' => 'code audio command datalist embed keygen mark menuitem meter output progress source time video wbr',
);
// Tidy
$tidy = new Tidy();
$tidy->parseString($buffer, $config, 'utf8');
$tidy->cleanRepair();
// Output
return $tidy;
}
public static function setArrayValue(&$array, $path, $value)
{
$loc = &$array;
foreach (explode('/', $path) as $step) {
$loc = &$loc[ $step ];
}
return $loc = $value;
}
public static function getArrayValue($array, $path)
{
if (is_string($path)) {
// dot delimiter
$path = explode('/', $path);
}
$ref = &$array;
foreach ($path as $key) {
if (! is_array($ref)) {
$ref = [];
}
$ref = &$ref[$key];
}
$prev = $ref;
return $prev;
}
public static function hasArrayValue($array, $path)
{
return self::getArrayValue($array, $path) !== null;
}
public static function getArrayPath($array, $searchKey = '')
{
//create a recursive iterator to loop over the array recursively
$iter = new RecursiveIteratorIterator(
new RecursiveArrayIterator($array),
RecursiveIteratorIterator::SELF_FIRST
);
//loop over the iterator
foreach ($iter as $key => $value) {
//if the value matches our search
if ($value === $searchKey) {
//add the current key
$keys = array( $key );
//loop up the recursive chain
for ($i = $iter->getDepth() - 1; $i >= 0; $i--) {
//add each parent key
array_unshift($keys, $iter->getSubIterator($i)->key());
}
//return our output array
return $keys;
}
}
//return false if not found
return false;
}
public static function matchArrayByKeyValue($array, $searchKey, $searchValue)
{
//create a recursive iterator to loop over the array recursively
$iter = new RecursiveIteratorIterator(
new RecursiveArrayIterator($array),
RecursiveIteratorIterator::SELF_FIRST
);
//loop over the iterator
foreach ($iter as $key => $value) {
//if the value matches our search
if ($key === $searchKey && $value === $searchValue) {
return true;
}
}
//return false if not found
return false;
}
public static function searchArrayByKeyValue($array, $searchKey, $searchValue)
{
$result = array();
//create a recursive iterator to loop over the array recursively
$iter = new RecursiveIteratorIterator(
new RecursiveArrayIterator($array),
RecursiveIteratorIterator::SELF_FIRST
);
//loop over the iterator
foreach ($iter as $key => $value) {
//if the value matches our search
if ($key === $searchKey && $value === $searchValue) {
return true;
}
}
//return false if not found
return false;
}
public static function separateCamelCase($str)
{
$re = '/
(?<=[a-z])
(?=[A-Z])
| (?<=[A-Z])
(?=[A-Z][a-z])
/x';
$a = preg_split($re, $str);
$formattedStr = implode(' ', $a);
return $formattedStr;
}
public static function isExternalURL($url)
{
$url = trim(strtolower($url));
if (substr($url, 0, 2) == '//') {
return true;
}
if (substr($url, 0, 7) == 'http://') {
return true;
}
if (substr($url, 0, 8) == 'https://') {
return true;
}
if (substr($url, 0, 5) == 'www.') {
return true;
}
return false;
}
public static function getIf($cond, $value, $alt = '')
{
return $cond ? $value : $alt;
}
public static function putIf($cond, $value, $alt = '')
{
echo self::getIf($cond, $value, $alt);
}
public static function notice($text, $state = 'danger', $icon = 'icons/duotune/art/art006.svg')
{
$html = '';
$html .= '<!--begin::Notice-->';
$html .= '<div class="d-flex align-items-center rounded py-5 px-4 bg-light-' . $state . ' ">';
$html .= ' <!--begin::Icon-->';
$html .= ' <div class="d-flex h-80px w-80px flex-shrink-0 flex-center position-relative ms-3 me-6">';
$html .= ' ' . Theme::getSvgIcon("icons/duotune/abstract/abs051.svg", "svg-icon-" . $state . " position-absolute opacity-10", "w-80px h-80px");
$html .= ' ' . Theme::getSvgIcon($icon, "svg-icon-3x svg-icon-" . $state . " position-absolute");
$html .= ' </div>';
$html .= ' <!--end::Icon-->';
$html .= ' <!--begin::Description-->';
$html .= ' <div class="text-gray-700 fw-bold fs-6 lh-lg">';
$html .= $text;
$html .= ' </div>';
$html .= ' <!--end::Description-->';
$html .= '</div>';
$html .= '<!--end::Notice-->';
echo $html;
}
public static function info($text, $state = 'danger', $icon = 'icons/duotune/general/gen044.svg')
{
$html = '';
$html .= '<!--begin::Information-->';
$html .= '<div class="d-flex align-items-center rounded py-5 px-5 bg-light-' . $state . ' ">';
$html .= ' <!--begin::Icon-->';
$html .= ' ' . Theme::getSvgIcon($icon, 'svg-icon-3x svg-icon-' . $state . ' me-5');
$html .= ' <!--end::Icon-->';
$html .= ' <!--begin::Description-->';
$html .= ' <div class="text-gray-700 fw-bold fs-6">';
$html .= $text;
$html .= ' </div>';
$html .= ' <!--end::Description-->';
$html .= '</div>';
$html .= '<!--end::Information-->';
echo $html;
}
public static function getHtmlAttributes($attributes = array())
{
$result = array();
if (empty($attributes)) {
return false;
}
foreach ($attributes as $name => $value) {
if (!empty($value)) {
$result[] = $name . '="' . $value . '"';
}
}
return ' ' . implode(' ', $result) . ' ';
}
public static function putHtmlAttributes($attributes)
{
$result = self::getHtmlAttributes($attributes);
if ($result) {
echo $result;
}
}
public static function getHtmlClass($classes, $full = true)
{
$result = array();
$classes = implode(' ', $classes);
if ($full === true) {
return ' class="' . $classes . '" ';
} else {
return ' ' . $classes . ' ';
}
}
public static function getCssVariables($variables, $full = true)
{
$result = array();
foreach ($variables as $name => $value) {
if (!empty($value)) {
$result[] = $name . ':' . $value;
}
}
$result = implode(';', $result);
if ($full === true) {
return ' style="' . $result . '" ';
} else {
return ' ' . $result . ' ';
}
}
/**
* Create a cache file
*
* @param $key
* @param $value
*/
public static function putCache($key, $value)
{
global $_COMMON_PATH;
// check if cache file exist
$cache = $_COMMON_PATH . '/dist/libs/cache/' . $key . '.cache.json';
// create cache folder if folder does not exist
if (!file_exists(dirname($cache))) {
mkdir(dirname($cache), 0777, true);
}
// create cache file
file_put_contents($cache, json_encode($value));
}
/**
* Retrieve a cache file by key
*
* @param $key
*
* @return mixed|null
*/
public static function getCache($key)
{
global $_COMMON_PATH;
// check if cache file exist
$cache = $_COMMON_PATH . '/dist/libs/cache/' . $key . '.cache.json';
// check if the requested cache file exists
if (file_exists($cache)) {
return json_decode(file_get_contents($cache), true);
}
return null;
}
/**
* Sample demo for docs for multidemo site
*
* @return string
*/
public static function sampleDemoText()
{
$demo = '';
if (Theme::isMultiDemo()) {
$demo = '--demo1';
}
return $demo;
}
public static function camelize($input, $separator = '_')
{
return str_replace($separator, ' ', ucwords($input, $separator));
}
public static function arrayMergeRecursive()
{
$arrays = func_get_args();
$merged = array();
while ($arrays) {
$array = array_shift($arrays);
if (!is_array($array)) {
trigger_error(__FUNCTION__ . ' encountered a non array argument', E_USER_WARNING);
return;
}
if (!$array) {
continue;
}
foreach ($array as $key => $value) {
if (is_string($key)) {
if (is_array($value) && array_key_exists($key, $merged) && is_array($merged[$key])) {
$merged[$key] = self::arrayMergeRecursive($merged[$key], $value);
} else {
$merged[$key] = $value;
}
} else {
$merged[] = $value;
}
}
}
return $merged;
}
public static function isHexColor($color)
{
return preg_match('/^#[a-f0-9]{6}$/i', $color);
}
}

View file

@ -0,0 +1,120 @@
<?php
namespace App\DataTables\Logs;
use Spatie\Activitylog\Models\Activity;
use Yajra\DataTables\Html\Column;
use Yajra\DataTables\Services\DataTable;
class AuditLogsDataTable extends DataTable
{
/**
* Build DataTable class.
*
* @param mixed $query Results from query() method.
*
* @return \Yajra\DataTables\DataTableAbstract
*/
public function dataTable($query)
{
return datatables()
->eloquent($query)
->rawColumns(['description', 'properties', 'action'])
->editColumn('id', function (Activity $model) {
return $model->id;
})
->editColumn('subject_id', function (Activity $model) {
if (!isset($model->subject)) {
return '';
}
if (isset($model->subject->name)) {
return $model->subject->name;
}
return $model->subject->user()->first()->name;
})
->editColumn('causer_id', function (Activity $model) {
return $model->causer ? $model->causer->first_name : __('System');
})
->editColumn('properties', function (Activity $model) {
$content = $model->properties;
return view('pages.log.audit._details', compact('content'));
})
->editColumn('created_at', function (Activity $model) {
return $model->created_at->format('d M, Y H:i:s');
})
->addColumn('action', function (Activity $model) {
return view('pages.log.audit._action-menu', compact('model'));
});
}
/**
* Get query source of dataTable.
*
* @param Activity $model
*
* @return \Illuminate\Database\Eloquent\Builder
*/
public function query(Activity $model)
{
return $model->newQuery();
}
/**
* Optional method if you want to use html builder.
*
* @return \Yajra\DataTables\Html\Builder
*/
public function html()
{
return $this->builder()
->setTableId('audit-log-table')
->columns($this->getColumns())
->minifiedAjax()
->stateSave(true)
->orderBy(6)
->responsive()
->autoWidth(false)
->parameters([
'scrollX' => true,
'drawCallback' => 'function() { KTMenu.createInstances(); }',
])
->addTableClass('align-middle table-row-dashed fs-6 gy-5');
}
/**
* Get columns.
*
* @return array
*/
protected function getColumns()
{
return [
Column::make('id')->title('Log ID')->addClass('ps-0'),
Column::make('log_name')->title(__('Location')),
Column::make('description'),
Column::make('subject_type'),
Column::make('subject_id')->title(__('Subject')),
Column::make('causer_id')->title(__('Causer')),
Column::make('created_at'),
Column::computed('action')
->exportable(false)
->printable(false)
->addClass('text-center')
->responsivePriority(-1),
Column::make('properties')->addClass('none'),
];
}
/**
* Get filename for export.
*
* @return string
*/
protected function filename()
{
return 'DataLogs_' . date('YmdHis');
}
}

View file

@ -0,0 +1,143 @@
<?php
namespace App\DataTables\Logs;
use Illuminate\Support\Collection;
use Illuminate\Support\Str;
use Jackiedo\LogReader\Exceptions\UnableToRetrieveLogFilesException;
use Jackiedo\LogReader\LogReader;
use Yajra\DataTables\Html\Column;
use Yajra\DataTables\Services\DataTable;
class SystemLogsDataTable extends DataTable
{
/**
* Build DataTable class.
*
* @param mixed $query Results from query() method.
*
* @return \Yajra\DataTables\DataTableAbstract
*/
public function dataTable($query)
{
return datatables()
->collection($query)
->rawColumns(['action', 'level'])
->editColumn('id', function (Collection $model) {
return Str::limit($model->get('id'), 5, '');
})
->editColumn('file_path', function (Collection $model) {
return Str::limit($model->get('file_path'));
})
->editColumn('message', function (Collection $model) {
return Str::limit($model->get('context')->message, 95);
})
->editColumn('date', function (Collection $model) {
return $model->get('date')->format('d M, Y H:i:s');
})
->editColumn('level', function (Collection $model) {
$styles = [
'emergency' => 'danger',
'alert' => 'warning',
'critical' => 'danger',
'error' => 'danger',
'warning' => 'warning',
'notice' => 'success',
'info' => 'info',
'debug' => 'primary',
];
$style = 'info';
if (isset($styles[$model->get('level')])) {
$style = $styles[$model->get('level')];
}
$value = $model->get('level');
return '<div class="badge badge-light-' . $style . ' fw-bolder">' . $value . '</div>';
})
->editColumn('context', function (Collection $model) {
$content = $model->get('context');
return view('pages.log.system._details', compact('content'));
})
->addColumn('action', function (Collection $model) {
return view('pages.log.system._action-menu', compact('model'));
});
}
/**
* Get query source of dataTable.
*
* @param LogReader $model
*
* @return Collection
*/
public function query(LogReader $model)
{
$data = collect();
$model->setLogPath(storage_path('logs'));
try {
$data = $model->get()->merge($data);
} catch (UnableToRetrieveLogFilesException $exception) {
}
$data = $data->map(function ($a) {
return (collect($a))->only(['id', 'date', 'environment', 'level', 'file_path', 'context']);
});
return $data;
}
/**
* Optional method if you want to use html builder.
*
* @return \Yajra\DataTables\Html\Builder
*/
public function html()
{
return $this->builder()
->setTableId('system-log-table')
->columns($this->getColumns())
->minifiedAjax()
->stateSave(true)
->orderBy(3)
->responsive()
->autoWidth(false)
->parameters(['scrollX' => true])
->addTableClass('align-middle table-row-dashed fs-6 gy-5');
}
/**
* Get columns.
*
* @return array
*/
protected function getColumns()
{
return [
Column::make('id')->title('Log ID')->width(100)->addClass('ps-0'),
Column::make('message'),
Column::make('level'),
Column::make('date')->width(200),
Column::computed('action')
->exportable(false)
->printable(false)
->addClass('text-center')
->responsivePriority(-1),
Column::make('environment')->addClass('none'),
Column::make('file_path')->title(__('Log Path'))->addClass('none'),
Column::make('context')->addClass('none'),
];
}
/**
* Get filename for export.
*
* @return string
*/
protected function filename()
{
return 'SystemLogs_' . date('YmdHis');
}
}

View file

@ -0,0 +1,42 @@
<?php
namespace App\Exceptions;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Throwable;
class Handler extends ExceptionHandler
{
/**
* A list of the exception types that are not reported.
*
* @var array
*/
protected $dontReport = [
//
];
/**
* A list of the inputs that are never flashed for validation exceptions.
*
* @var array
*/
protected $dontFlash = [
'password',
'password_confirmation',
];
/**
* Register the exception handling callbacks for the application.
*
* @return void
*/
public function register()
{
$this->reportable(function (Throwable $e) {
if (app()->bound('sentry')) {
app('sentry')->captureException($e);
}
});
}
}

16
app/Helpers/Game.php Normal file
View file

@ -0,0 +1,16 @@
<?php
use App\Models\Game;
use Illuminate\Support\Facades\DB;
if (!function_exists('fetchGamesCount')) {
/**
* Fetch and return a count of games.
*
* @return int
*/
function fetchGamesCount()
{
return Game::count();
}
}

3
app/Helpers/GameList.php Normal file
View file

@ -0,0 +1,3 @@
<?php
use App\Models\GameList;

4
app/Helpers/Platform.php Normal file
View file

@ -0,0 +1,4 @@
<?php
use App\Models\Platform;
use Illuminate\Support\Facades\DB;

15
app/Helpers/User.php Normal file
View file

@ -0,0 +1,15 @@
<?php
use App\Models\User;
if (!function_exists('fetchActiveUsersCount')) {
/**
* Fetch and return a count of active users.
*
* @return int
*/
function fetchActiveUsersCount()
{
return User::count();
}
}

View file

@ -0,0 +1,141 @@
<?php
namespace App\Http\Controllers\Account;
use App\Http\Controllers\Controller;
use App\Http\Requests\Account\SettingsEmailRequest;
use App\Http\Requests\Account\SettingsInfoRequest;
use App\Http\Requests\Account\SettingsPasswordRequest;
use App\Models\UserInfo;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Storage;
class SettingsController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View
*/
public function index()
{
$info = auth()->user()->info;
// get the default inner page
return view('pages.account.settings.settings', compact('info'));
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $user
*
* @return \Illuminate\Http\RedirectResponse
*/
public function update(SettingsInfoRequest $request)
{
// save user name
$validated = $request->validate([
'first_name' => 'required|string|max:255',
'last_name' => 'required|string|max:255',
]);
auth()->user()->update($validated);
// save on user info
$info = UserInfo::where('user_id', auth()->user()->id)->first();
if ($info === null) {
// create new model
$info = new UserInfo();
}
// attach this info to the current user
$info->user()->associate(auth()->user());
foreach ($request->only(array_keys($request->rules())) as $key => $value) {
if (is_array($value)) {
$value = serialize($value);
}
$info->$key = $value;
}
// include to save avatar
if ($avatar = $this->upload()) {
$info->avatar = $avatar;
}
if ($request->boolean('avatar_remove')) {
Storage::delete($info->avatar);
$info->avatar = null;
}
$info->save();
return redirect()->intended('account/settings');
}
/**
* Function for upload avatar image
*
* @param string $folder
* @param string $key
* @param string $validation
*
* @return false|string|null
*/
public function upload($folder = 'images', $key = 'avatar', $validation = 'image|mimes:jpeg,png,jpg,gif,svg|max:2048|sometimes')
{
request()->validate([$key => $validation]);
$file = null;
if (request()->hasFile($key)) {
$file = Storage::disk('public')->putFile($folder, request()->file($key), 'public');
}
return $file;
}
/**
* Function to accept request for change email
*
* @param SettingsEmailRequest $request
*/
public function changeEmail(SettingsEmailRequest $request)
{
// prevent change email for demo account
if ($request->input('current_email') === 'demo@demo.com') {
return redirect()->intended('account/settings');
}
auth()->user()->update(['email' => $request->input('email')]);
if ($request->expectsJson()) {
return response()->json($request->all());
}
return redirect()->intended('account/settings');
}
/**
* Function to accept request for change password
*
* @param SettingsPasswordRequest $request
*/
public function changePassword(SettingsPasswordRequest $request)
{
// prevent change password for demo account
if ($request->input('current_email') === 'demo@demo.com') {
return redirect()->intended('account/settings');
}
auth()->user()->update(['password' => Hash::make($request->input('password'))]);
if ($request->expectsJson()) {
return response()->json($request->all());
}
return redirect()->intended('account/settings');
}
}

View file

@ -0,0 +1,102 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\Http\Requests\Auth\LoginRequest;
use App\Providers\RouteServiceProvider;
use App\Models\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;
use Illuminate\Validation\ValidationException;
use Illuminate\Support\Str;
class AuthenticatedSessionController extends Controller
{
/**
* Display the login view.
*
* @return \Illuminate\View\View
*/
public function create()
{
return view('auth.login');
}
/**
* Handle an incoming authentication request.
*
* @param \App\Http\Requests\Auth\LoginRequest $request
*
* @return \Illuminate\Http\RedirectResponse
*/
public function store(LoginRequest $request)
{
$request->authenticate();
$request->session()->regenerate();
return redirect()->intended(RouteServiceProvider::HOME);
}
/**
* Handle an incoming api authentication request.
*
* @param \App\Http\Requests\Auth\LoginRequest $request
*
* @return \Illuminate\Http\Response
*/
public function apiStore(LoginRequest $request)
{
if (!Auth::attempt($request->only('email', 'password'))) {
throw ValidationException::withMessages([
'email' => ['The provided credentials are incorrect']
]);
}
$user = User::where('email', $request->email)->first();
return response($user);
}
/**
* Verifies user token.
*
* @param \Illuminate\Http\Request $request
*
* @return \Illuminate\Http\Response
*/
public function apiVerifyToken(Request $request)
{
$request->validate([
'api_token' => 'required'
]);
$user = User::where('api_token', $request->api_token)->first();
if (!$user) {
throw ValidationException::withMessages([
'token' => ['Invalid token']
]);
}
return response($user);
}
/**
* Destroy an authenticated session.
*
* @param \Illuminate\Http\Request $request
*
* @return \Illuminate\Http\RedirectResponse
*/
public function destroy(Request $request)
{
Auth::guard('web')->logout();
$request->session()->invalidate();
$request->session()->regenerateToken();
return redirect('/');
}
}

View file

@ -0,0 +1,47 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\Providers\RouteServiceProvider;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Validation\ValidationException;
class ConfirmablePasswordController extends Controller
{
/**
* Show the confirm password view.
*
* @return \Illuminate\View\View
*/
public function show()
{
return view('auth.confirm-password');
}
/**
* Confirm the user's password.
*
* @param \Illuminate\Http\Request $request
*
* @return mixed
*/
public function store(Request $request)
{
if (
!Auth::guard('web')->validate([
'email' => $request->user()->email,
'password' => $request->password,
])
) {
throw ValidationException::withMessages([
'password' => __('auth.password'),
]);
}
$request->session()->put('auth.password_confirmed_at', time());
return redirect()->intended(RouteServiceProvider::HOME);
}
}

View file

@ -0,0 +1,28 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\Providers\RouteServiceProvider;
use Illuminate\Http\Request;
class EmailVerificationNotificationController extends Controller
{
/**
* Send a new email verification notification.
*
* @param \Illuminate\Http\Request $request
*
* @return \Illuminate\Http\RedirectResponse
*/
public function store(Request $request)
{
if ($request->user()->hasVerifiedEmail()) {
return redirect()->intended(RouteServiceProvider::HOME);
}
$request->user()->sendEmailVerificationNotification();
return back()->with('status', 'verification-link-sent');
}
}

View file

@ -0,0 +1,24 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\Providers\RouteServiceProvider;
use Illuminate\Http\Request;
class EmailVerificationPromptController extends Controller
{
/**
* Display the email verification prompt.
*
* @param \Illuminate\Http\Request $request
*
* @return mixed
*/
public function __invoke(Request $request)
{
return $request->user()->hasVerifiedEmail()
? redirect()->intended(RouteServiceProvider::HOME)
: view('auth.verify-email');
}
}

View file

@ -0,0 +1,67 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Auth\Events\PasswordReset;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Password;
use Illuminate\Support\Str;
use Illuminate\Validation\Rules;
class NewPasswordController extends Controller
{
/**
* Display the password reset view.
*
* @param \Illuminate\Http\Request $request
*
* @return \Illuminate\View\View
*/
public function create(Request $request, $token)
{
return view('auth.reset-password', compact('request', 'token'));
}
/**
* Handle an incoming new password request.
*
* @param \Illuminate\Http\Request $request
*
* @return \Illuminate\Http\RedirectResponse
*
* @throws \Illuminate\Validation\ValidationException
*/
public function store(Request $request)
{
$request->validate([
'token' => 'required',
'email' => 'required|email',
'password' => ['required', 'confirmed', Rules\Password::defaults()],
]);
// Here we will attempt to reset the user's password. If it is successful we
// will update the password on an actual user model and persist it to the
// database. Otherwise we will parse the error and return the response.
$status = Password::reset(
$request->only('email', 'password', 'password_confirmation', 'token'),
function ($user) use ($request) {
$user->forceFill([
'password' => Hash::make($request->password),
'remember_token' => Str::random(60),
])->save();
event(new PasswordReset($user));
}
);
// If the password was successfully reset, we will redirect the user back to
// the application's home authenticated view. If there is an error we can
// redirect them back to where they came from with their error message.
return $status == Password::PASSWORD_RESET
? redirect()->route('login')->with('status', __($status))
: back()->withInput($request->only('email'))
->withErrors(['email' => __($status)]);
}
}

View file

@ -0,0 +1,76 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\Models\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Password;
use Illuminate\Validation\ValidationException;
class PasswordResetLinkController extends Controller
{
/**
* Display the password reset link request view.
*
* @return \Illuminate\View\View
*/
public function create()
{
return view('auth.forgot-password');
}
/**
* Handle an incoming password reset link request.
*
* @param \Illuminate\Http\Request $request
*
* @return \Illuminate\Http\RedirectResponse
*
* @throws \Illuminate\Validation\ValidationException
*/
public function store(Request $request)
{
$request->validate([
'email' => 'required|email',
]);
// We will send the password reset link to this user. Once we have attempted
// to send the link, we will examine the response then see the message we
// need to show to the user. Finally, we'll send out a proper response.
$status = Password::sendResetLink(
$request->only('email')
);
return $status == Password::RESET_LINK_SENT
? back()->with('status', __($status))
: back()->withInput($request->only('email'))
->withErrors(['email' => __($status)]);
}
/**
* Handle an incoming api password reset link request.
*
* @param \Illuminate\Http\Request $request
*
* @return \Illuminate\Http\Response
*
* @throws \Illuminate\Validation\ValidationException
*/
public function apiStore(Request $request)
{
$request->validate([
'email' => 'required|email',
]);
$user = User::where('email', $request->email)->first();
if (!$user) {
throw ValidationException::withMessages([
'email' => ['User with such email doesn\'t exist']
]);
}
return response('Password reset email successfully sent.');
}
}

View file

@ -0,0 +1,137 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\Models\User;
use App\Providers\RouteServiceProvider;
use Illuminate\Auth\Events\Registered;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;
use Illuminate\Validation\Rules;
use Illuminate\Support\Str;
class RegisteredUserController extends Controller
{
/**
* Display the registration view.
*
* @return \Illuminate\View\View
*/
public function create()
{
return view('auth.register');
}
/**
* Handle an incoming registration request.
*
* @param \Illuminate\Http\Request $request
*
* @return \Illuminate\Http\RedirectResponse
*
* @throws \Illuminate\Validation\ValidationException
*/
public function store(Request $request)
{
$request->validate([
'username' => 'required|string|max:16|unique:users',
'email' => 'required|string|email|max:255|unique:users',
'password' => ['required', 'confirmed', Rules\Password::defaults()]
]);
$user = User::create([
'username' => $request->username,
'email' => $request->email,
'password' => Hash::make($request->password),
'ip_address' => $request->ip()
]);
/* Add account into Fider (https://myvideogamelist.com). */
$json = '{"name": "' . $request->username . '", "email": "' . $request->email . '"}';
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://features.myvideogamelist.com/api/v1/users",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => $json,
CURLOPT_HTTPHEADER => array(
"Content-Type: application/json",
"Authorization: Bearer $TOKEN"
),
));
curl_exec($curl);
curl_close($curl);
event(new Registered($user));
Auth::login($user);
return redirect(RouteServiceProvider::HOME);
}
/**
* Handle an incoming api registration request.
*
* @param \Illuminate\Http\Request $request
*
* @return \Illuminate\Http\Response
*
* @throws \Illuminate\Validation\ValidationException
*/
public function apiStore(Request $request)
{
$request->validate([
'username' => 'required|string|max:16|unique:users',
'email' => 'required|string|email|max:255|unique:users',
'password' => ['required', 'confirmed', Rules\Password::defaults()],
]);
$token = Str::random(60);
$user = User::create([
'username' => $request->username,
'email' => $request->email,
'password' => Hash::make($request->password),
'api_token' => hash('sha256', $token),
'ip_address' => $request->ip()
]);
/* Add account into Fider (https://myvideogamelist.com). */
$json = '{"name": "' . $request->username . '", "email": "' . $request->email . '"}';
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://features.myvideogamelist.com/api/v1/users",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => $json,
CURLOPT_HTTPHEADER => array(
"Content-Type: application/json",
"Authorization: Bearer $TOKEN"
),
));
curl_exec($curl);
curl_close($curl);
return response($user);
}
}

View file

@ -0,0 +1,31 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\Providers\RouteServiceProvider;
use Illuminate\Auth\Events\Verified;
use Illuminate\Foundation\Auth\EmailVerificationRequest;
class VerifyEmailController extends Controller
{
/**
* Mark the authenticated user's email address as verified.
*
* @param \Illuminate\Foundation\Auth\EmailVerificationRequest $request
*
* @return \Illuminate\Http\RedirectResponse
*/
public function __invoke(EmailVerificationRequest $request)
{
if ($request->user()->hasVerifiedEmail()) {
return redirect()->intended(RouteServiceProvider::HOME . '?verified=1');
}
if ($request->user()->markEmailAsVerified()) {
event(new Verified($request->user()));
}
return redirect()->intended(RouteServiceProvider::HOME . '?verified=1');
}
}

View file

@ -0,0 +1,85 @@
<?php
namespace App\Http\Controllers;
use App\Models\ConsoleList;
use Illuminate\Http\Request;
class ConsoleListController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
//
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
//
}
/**
* Display the specified resource.
*
* @param \App\Models\ConsoleList $consoleList
* @return \Illuminate\Http\Response
*/
public function show(ConsoleList $consoleList)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param \App\Models\ConsoleList $consoleList
* @return \Illuminate\Http\Response
*/
public function edit(ConsoleList $consoleList)
{
//
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \App\Models\ConsoleList $consoleList
* @return \Illuminate\Http\Response
*/
public function update(Request $request, ConsoleList $consoleList)
{
//
}
/**
* Remove the specified resource from storage.
*
* @param \App\Models\ConsoleList $consoleList
* @return \Illuminate\Http\Response
*/
public function destroy(ConsoleList $consoleList)
{
//
}
}

View file

@ -0,0 +1,15 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController;
class Controller extends BaseController
{
use AuthorizesRequests;
use DispatchesJobs;
use ValidatesRequests;
}

View file

@ -0,0 +1,85 @@
<?php
namespace App\Http\Controllers;
use App\Models\GameComment;
use Illuminate\Http\Request;
class GameCommentController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
//
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
//
}
/**
* Display the specified resource.
*
* @param \App\Models\GameComment $gameComment
* @return \Illuminate\Http\Response
*/
public function show(GameComment $gameComment)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param \App\Models\GameComment $gameComment
* @return \Illuminate\Http\Response
*/
public function edit(GameComment $gameComment)
{
//
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \App\Models\GameComment $gameComment
* @return \Illuminate\Http\Response
*/
public function update(Request $request, GameComment $gameComment)
{
//
}
/**
* Remove the specified resource from storage.
*
* @param \App\Models\GameComment $gameComment
* @return \Illuminate\Http\Response
*/
public function destroy(GameComment $gameComment)
{
//
}
}

View file

@ -0,0 +1,288 @@
<?php
namespace App\Http\Controllers;
use App\Models\Game;
use App\Rules\GameReleaseDate;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Storage;
use Illuminate\Validation\Rule;
class GameController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
// Direct the user to the list of games.
return view('pages.admin.games.index');
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
// Direct the user to the add game to database page.
return view('pages.admin.games.create');
}
/**
* Show the form for cloning a resource.
*
* @param int $gameId
* @return \Illuminate\Http\Response
*/
public function clone($gameId)
{
// Direct the user to the clone game page.
$game = Game::findOrFail($gameId);
return view('pages.admin.games.clone', compact('game'));
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
// Ensure the user has permission to add games into the database.
$this->authorize('create', Game::class);
// Validate the data from the request.
$inputs = $this->validate($request, [
'name' => 'string|required|max:255',
'alt_titles' => 'string|nullable|max:255',
'platform_id' => 'integer|required',
'description' => 'string|nullable',
'source' => 'url|nullable|max:255',
'boxart' => 'image|nullable|max:512',
'genre_ids' => 'array|nullable',
'developers' => 'string|nullable|max:255',
'publishers' => 'string|nullable|max:255',
'composers' => 'string|nullable|max:255',
'website' => 'url|nullable|max:255',
'na_release_date' => [
new GameReleaseDate(),
'nullable'
],
'jp_release_date' => [
new GameReleaseDate(),
'nullable'
],
'eu_release_date' => [
new GameReleaseDate(),
'nullable'
],
'aus_release_date' => [
new GameReleaseDate(),
'nullable'
],
'esrb_rating' => [
'string',
'nullable',
Rule::in(['Everyone', 'Everyone 10+', 'Teen', 'Mature 17+', 'Adults Only 18+', 'Rating Pending - Likely Mature 17+']) // phpcs:ignore
],
'pegi_rating' => [
'string',
'nullable',
Rule::in(['PEGI 3', 'PEGI 7', 'PEGI 12', 'PEGI 16', 'PEGI 18'])
],
'cero_rating' => [
'string',
'nullable',
Rule::in(['CERO A', 'CERO B', 'CERO C', 'CERO D', 'CERO Z'])
],
'acb_rating' => [
'string',
'nullable',
Rule::in(['E', 'G', 'PG', 'M', 'MA 15+', 'R 18+', 'X 18+'])
]
]);
// Convert the genre_ids array into a comma separated string.
if (isset($inputs['genre_ids'])) {
$inputs['genre_ids'] = implode(',', $inputs['genre_ids']);
}
// Upload the boxart image as necessary.
if ($request->hasFile('boxart')) {
$path = $request->boxart->store('assets/boxart', 's3');
$inputs['boxart'] = basename($path);
}
// Set the requested_by and added_by fields to the current user.
$inputs['requested_by'] = auth()->user()->id;
$inputs['added_by'] = auth()->user()->id;
// Save the data to the database.
$result = Game::create($inputs);
// If the creation was successful go to the list of games.
if ($result->exists) {
return redirect('/admin/games')->with('create_success', str_replace('"', '', json_encode($inputs['name'])));
} else { // If the creation failed, go back.
return back();
}
}
/**
* Display the specified resource.
*
* @param int $gameId
*
* @return \Illuminate\Http\Response
*/
public function show($gameId)
{
// Direct the user to the games profile page.
$game = Game::findOrFail($gameId);
return view('pages.game.index', compact('game'));
}
/**
* Show the form for editing the specified resource.
*
* @param \App\Models\Game $game
* @return \Illuminate\Http\Response
*/
public function edit(Game $game)
{
// Direct the user to the edit game page.
$game = Game::findOrFail($game->id);
return view('pages.admin.games.edit', compact('game'));
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \App\Models\Game $game
* @return \Illuminate\Http\Response
*/
public function update(Request $request, Game $game)
{
// Ensure the user has permission to add games into the database.
$this->authorize('update', Game::class);
// Validate the data from the request.
$inputs = $this->validate($request, [
'name' => 'string|required|max:255',
'alt_titles' => 'string|nullable|max:255',
'platform_id' => 'integer|required',
'description' => 'string|nullable',
'source' => 'url|nullable|max:255',
'boxart' => 'image|nullable|max:512',
'genre_ids' => 'array|nullable',
'developers' => 'string|nullable|max:255',
'publishers' => 'string|nullable|max:255',
'composers' => 'string|nullable|max:255',
'website' => 'url|nullable|max:255',
'na_release_date' => [
new GameReleaseDate(),
'nullable'
],
'jp_release_date' => [
new GameReleaseDate(),
'nullable'
],
'eu_release_date' => [
new GameReleaseDate(),
'nullable'
],
'aus_release_date' => [
new GameReleaseDate(),
'nullable'
],
'esrb_rating' => [
'string',
'nullable',
Rule::in(['Everyone', 'Everyone 10+', 'Teen', 'Mature 17+', 'Adults Only 18+', 'Rating Pending - Likely Mature 17+']) // phpcs:ignore
],
'pegi_rating' => [
'string',
'nullable',
Rule::in(['PEGI 3', 'PEGI 7', 'PEGI 12', 'PEGI 16', 'PEGI 18'])
],
'cero_rating' => [
'string',
'nullable',
Rule::in(['CERO A', 'CERO B', 'CERO C', 'CERO D', 'CERO Z'])
],
'acb_rating' => [
'string',
'nullable',
Rule::in(['E', 'G', 'PG', 'M', 'MA 15+', 'R 18+', 'X 18+'])
]
]);
// Convert the genre_ids array into a comma separated string.
if (isset($inputs['genre_ids'])) {
$inputs['genre_ids'] = implode(',', $inputs['genre_ids']);
$game->genre_ids = $inputs['genre_ids'];
}
// Upload the new boxart image as necessary.
if ($request->hasFile('boxart')) {
// Get the current boxart image.
$original_boxart = $game->boxart;
// Delete the boxart image if a previous boxart image existed.
if ($original_boxart) {
$result = Storage::disk('s3')->delete('assets/boxart/' . $original_boxart);
}
// Upload the new boxart image.
$path = $request->boxart->store('assets/boxart', 's3');
$inputs['boxart'] = basename($path);
$game->boxart = $inputs['boxart'];
}
// Set the values of the $game object to the new values.
$game->name = $inputs['name'];
$game->alt_titles = $inputs['alt_titles'];
$game->platform_id = $inputs['platform_id'];
$game->description = $inputs['description'];
$game->source = $inputs['source'];
$game->developers = $inputs['developers'];
$game->publishers = $inputs['publishers'];
$game->composers = $inputs['composers'];
$game->website = $inputs['website'];
$game->na_release_date = $inputs['na_release_date'];
$game->jp_release_date = $inputs['jp_release_date'];
$game->eu_release_date = $inputs['eu_release_date'];
$game->aus_release_date = $inputs['aus_release_date'];
$game->esrb_rating = $inputs['esrb_rating'];
$game->pegi_rating = $inputs['pegi_rating'];
$game->cero_rating = $inputs['cero_rating'];
$game->acb_rating = $inputs['acb_rating'];
// Save the data to the database.
$result = $game->save();
// If the update was successful show the user the updated game.
if ($result === true) {
return redirect('/admin/game/' . $game->id . '/edit')->with('edit_success', '1');
} else { // If the update failed, go back.
return back();
}
}
/**
* Remove the specified resource from storage.
*
* @param \App\Models\Game $game
* @return \Illuminate\Http\Response
*/
public function destroy(Game $game)
{
//
}
}

View file

@ -0,0 +1,283 @@
<?php
namespace App\Http\Controllers;
use App\Models\Game;
use App\Models\GameList;
use App\Models\User;
use Illuminate\Http\Request;
use Illuminate\Validation\Rule;
class GameListController extends Controller
{
/**
* Display a listing of the resource.
*
* @param string $username
* @return \Illuminate\Http\Response
*/
public function index($username = null)
{
// If username is null, $user is the currently logged in user.
if ($username === null) {
$user = auth()->user();
} else { // Otherwise, $user is the user with the specified username.
$user = User::where('username', $username)->firstOrFail();
}
// Direct the user to the games list page.
return view('pages.game-lists.index', compact('user'));
}
/**
* Show the form for creating a new resource.
*
* @param int $gameId
* @return \Illuminate\Http\Response
*/
public function create($gameId)
{
// Make sure $gameId is numeric.
if (is_numeric($gameId)) {
return view('pages.game-lists.create', ['gameId' => $gameId]);
} else { // Else go to the home page.
return redirect()->route('index');
}
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
// Validate the data from the request.
$inputs = $this->validate($request, [
'name' => [
'string',
'max:128',
'nullable'
],
'ownership' => [
'numeric',
'nullable',
Rule::in([1, 2, 3, 4])
],
'status' => [
'numeric',
Rule::in([1, 2, 3, 4, 5, 6])
],
'rating' => [
'numeric',
'nullable',
Rule::in([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
],
'priority' => [
Rule::in(['Low', 'Medium', 'High']),
'string',
'max:6',
'nullable',
],
'difficulty' => [
'string',
'nullable',
Rule::in(['Easy', 'Medium', 'Hard', 'Extremely Hard'])
],
'hoursPlayed' => [
'numeric',
'nullable',
Rule::in([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13])
],
'start_date' => 'date_format:Y-m-d|after:1970-01-01 00:00:00|nullable',
'finish_date' => 'date_format:Y-m-d|after:1970-01-01 00:00:00|nullable',
'replayValue' => [
'numeric',
'nullable',
Rule::in([1, 2, 3, 4, 5])
],
'notes' => 'string|nullable'
]);
// Fetch a Game Model.
$game = Game::whereId($request->input('gameId'))->first();
// Fetch the name if none was selected.
if (!$request->input('name')) {
$inputs['name'] = $game->name;
}
// Set $input['game_id'].
$inputs['game_id'] = $game->id;
// Set $inputs['platform_id'].
$inputs['platform_id'] = Game::whereId($game->id)->value('platform_id');
// Set the value of replayValue.
if (!$request->input('replayValue')) {
$inputs['replayValue'] = null;
}
// Set the value of isReplaying.
if ($request->input('isReplaying') == 1) {
$inputs['isReplaying'] = 'Y';
} else {
$inputs['isReplaying'] = 'N';
}
// Save the data to the database.
$result = auth()->user()->gameList()->create($inputs);
// If adding the game was successful go to the users list.
if ($result->exists) {
return redirect('/list')->with('create_success', str_replace('"', '', json_encode($inputs['name'])));
} else { // If the addition failed, go back.
return back();
}
}
/**
* Display the specified resource.
*
* @param \App\Models\GameList $gameList
* @return \Illuminate\Http\Response
*/
public function show(GameList $gameList)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param \App\Models\GameList $gameList
* @return \Illuminate\Http\Response
*/
public function edit(GameList $gameList)
{
// Direct the user to the edit page.
return view('pages.game-lists.edit', compact('gameList'));
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \App\Models\GameList $gameList
* @return \Illuminate\Http\Response
*/
public function update(Request $request, GameList $gameList)
{
// Validate the data from the request.
$inputs = $this->validate($request, [
'name' => 'string|max:128|nullable',
'ownership' => [
'numeric',
'nullable',
Rule::in([1, 2, 3, 4])
],
'status' => [
'numeric',
Rule::in([1, 2, 3, 4, 5, 6])
],
'rating' => [
'numeric',
'nullable',
Rule::in([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
],
'priority' => [
Rule::in(['Low', 'Medium', 'High']),
'string',
'max:6',
'nullable',
],
'difficulty' => [
'string',
'nullable',
Rule::in(['Easy', 'Medium', 'Hard', 'Extremely Hard'])
],
'hoursPlayed' => [
'numeric',
'nullable',
Rule::in([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13])
],
'start_date' => 'date_format:Y-m-d|after:1970-01-01 00:00:00|nullable',
'finish_date' => 'date_format:Y-m-d|after:1970-01-01 00:00:00|nullable',
'replayValue' => [
'numeric',
'nullable',
Rule::in([1, 2, 3, 4, 5])
],
'notes' => 'string|nullable'
]);
// Fetch a Game Model.
$game = Game::whereId($gameList->game_id)->first();
// Fetch the name if none was selected.
if (!$request->input('name')) {
$inputs['name'] = $game->name;
}
// Set $inputs['platform_id'].
$inputs['platform_id'] = $game->platform_id;
// Set the value of replayValue.
if (!$request->input('replayValue')) {
$inputs['replayValue'] = null;
}
// Set the value of isReplaying.
if ($request->input('isReplaying') == 1) {
$inputs['isReplaying'] = 'Y';
} else {
$inputs['isReplaying'] = 'N';
}
// Set the values of the gameList object to the updates values.
$gameList['name'] = $inputs['name'];
$gameList['ownership'] = $inputs['ownership'];
$gameList['status'] = $inputs['status'];
$gameList['rating'] = $inputs['rating'];
$gameList['priority'] = $inputs['priority'];
$gameList['difficulty'] = $inputs['difficulty'];
$gameList['hours_played'] = $inputs['hoursPlayed'];
$gameList['start_date'] = $inputs['start_date'];
$gameList['finish_date'] = $inputs['finish_date'];
$gameList['replay_value'] = $inputs['replayValue'];
$gameList['notes'] = $inputs['notes'];
$gameList['is_replaying'] = $inputs['isReplaying'];
// Ensure the user has permission to update this game list entry.
$this->authorize('update', $gameList);
// Save the data to the database.
$result = $gameList->save();
// If the update was successful go back to the edit page with a success message.
if ($result === true) {
return redirect('/list/edit/' . $gameList->id)->with('edit_success', '1');
} else { // If the update failed, go back.
return back();
}
}
/**
* Remove the specified resource from storage.
*
* @param \App\Models\GameList $gameList
* @return \Illuminate\Http\Response
*/
public function destroy(GameList $gameList)
{
// Check to ensure this user has permission to delete this game list entry.
$this->authorize('delete', $gameList);
// Soft delete the entry within the database.
$gameList->delete();
// Go back to the users game list.
return redirect('/list')->with('delete_success', str_replace('"', '', json_encode($gameList->name)));
}
}

View file

@ -0,0 +1,110 @@
<?php
namespace App\Http\Controllers;
use App\Models\Game;
use Illuminate\Http\Request;
class GameSearchController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
//
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
//
}
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
{
//
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
//
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
//
}
/**
* Search for games and return results sorted by created_at, decending.
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function search(Request $request)
{
// Validate the data from the request.
$input = $this->validate($request, [
'search' => 'required|string|max:64'
]);
// Set the search term variable.
$term = $input['search'];
// Fetch all matching posts and send them to the search view.
$games = Game::where('name', 'like', "%$term%")
->orWhere('alt_titles', 'like', "%$term%")
->orderBy('created_at', 'DESC')
->paginate(25);
// Send the results to the view.
return view('pages.search.games.show', compact('games'));
}
}

View file

@ -0,0 +1,85 @@
<?php
namespace App\Http\Controllers;
use App\Models\Genre;
use Illuminate\Http\Request;
class GenreController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
//
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
//
}
/**
* Display the specified resource.
*
* @param \App\Models\Genre $genre
* @return \Illuminate\Http\Response
*/
public function show(Genre $genre)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param \App\Models\Genre $genre
* @return \Illuminate\Http\Response
*/
public function edit(Genre $genre)
{
//
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \App\Models\Genre $genre
* @return \Illuminate\Http\Response
*/
public function update(Request $request, Genre $genre)
{
//
}
/**
* Remove the specified resource from storage.
*
* @param \App\Models\Genre $genre
* @return \Illuminate\Http\Response
*/
public function destroy(Genre $genre)
{
//
}
}

View file

@ -0,0 +1,35 @@
<?php
namespace App\Http\Controllers\Logs;
use App\DataTables\Logs\AuditLogsDataTable;
use App\Http\Controllers\Controller;
use Spatie\Activitylog\Models\Activity;
class AuditLogsController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index(AuditLogsDataTable $dataTable)
{
return $dataTable->render('pages.log.audit.index');
}
/**
* Remove the specified resource from storage.
*
* @param int $id
*
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
$activity = Activity::find($id);
// Delete from db
$activity->delete();
}
}

View file

@ -0,0 +1,32 @@
<?php
namespace App\Http\Controllers\Logs;
use App\DataTables\Logs\SystemLogsDataTable;
use App\Http\Controllers\Controller;
use Jackiedo\LogReader\LogReader;
class SystemLogsController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index(SystemLogsDataTable $dataTable)
{
return $dataTable->render('pages.log.system.index');
}
/**
* Remove the specified resource from storage.
*
* @param int $id
*
* @return \Illuminate\Http\Response
*/
public function destroy($id, LogReader $logReader)
{
return $logReader->find($id)->delete();
}
}

View file

@ -0,0 +1,100 @@
<?php
namespace App\Http\Controllers;
use App\Models\Platform;
use Illuminate\Http\Request;
class PlatformController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
// Direct the user to the page listing all platforms.
return view('pages.platforms.index');
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
//
}
/**
* Display the specified resource.
*
* @param string $platform
* @return \Illuminate\Http\Response
*/
public function show($platform)
{
// Fetch the platform.
if ($platform == 'Xbox_Series_X_S') {
$platform = Platform::where('name', 'Xbox Series X/S')->firstOrFail();
} elseif ($platform == 'Sega_Genesis_MegaDrive') {
$platform = Platform::where('name', 'Sega Genesis/MegaDrive')->firstOrFail();
} elseif ($platform == 'Meta_Oculus_Quest') {
$platform = Platform::where('name', 'Meta/Oculus Quest')->firstOrFail();
} elseif ($platform == 'Meta_Oculus_Quest_2') {
$platform = Platform::where('name', 'Meta/Oculus Quest 2')->firstOrFail();
} else {
$platform = Platform::where('name', str_replace('_', ' ', $platform))->firstOrFail();
}
// Direct the users to a page showing all the games for the specified platform.
return view('pages.platforms.show', compact('platform'));
}
/**
* Show the form for editing the specified resource.
*
* @param \App\Models\Platform $platform
* @return \Illuminate\Http\Response
*/
public function edit(Platform $platform)
{
//
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \App\Models\Platform $platform
* @return \Illuminate\Http\Response
*/
public function update(Request $request, Platform $platform)
{
//
}
/**
* Remove the specified resource from storage.
*
* @param \App\Models\Platform $platform
* @return \Illuminate\Http\Response
*/
public function destroy(Platform $platform)
{
//
}
}

View file

@ -0,0 +1,85 @@
<?php
namespace App\Http\Controllers;
use App\Models\ProfileComment;
use Illuminate\Http\Request;
class ProfileCommentController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
//
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
//
}
/**
* Display the specified resource.
*
* @param \App\Models\ProfileComment $profileComment
* @return \Illuminate\Http\Response
*/
public function show(ProfileComment $profileComment)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param \App\Models\ProfileComment $profileComment
* @return \Illuminate\Http\Response
*/
public function edit(ProfileComment $profileComment)
{
//
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \App\Models\ProfileComment $profileComment
* @return \Illuminate\Http\Response
*/
public function update(Request $request, ProfileComment $profileComment)
{
//
}
/**
* Remove the specified resource from storage.
*
* @param \App\Models\ProfileComment $profileComment
* @return \Illuminate\Http\Response
*/
public function destroy(ProfileComment $profileComment)
{
//
}
}

View file

@ -0,0 +1,85 @@
<?php
namespace App\Http\Controllers;
use App\Models\Role;
use Illuminate\Http\Request;
class RoleController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
//
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
//
}
/**
* Display the specified resource.
*
* @param \App\Models\Role $role
* @return \Illuminate\Http\Response
*/
public function show(Role $role)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param \App\Models\Role $role
* @return \Illuminate\Http\Response
*/
public function edit(Role $role)
{
//
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \App\Models\Role $role
* @return \Illuminate\Http\Response
*/
public function update(Request $request, Role $role)
{
//
}
/**
* Remove the specified resource from storage.
*
* @param \App\Models\Role $role
* @return \Illuminate\Http\Response
*/
public function destroy(Role $role)
{
//
}
}

View file

@ -0,0 +1,98 @@
<?php
namespace App\Http\Controllers;
use App\Models\User;
use Illuminate\Http\Request;
class UserController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
//
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
*
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
//
}
/**
* Display the specified resource.
*
* @param string $username
*
* @return \Illuminate\Http\Response
*/
public function show($username = null)
{
// If username is null, $user is the currently logged in user.
if ($username === null) {
$user = auth()->user();
} else { // Otherwise, $user is the user with the specified username.
$user = User::where('username', $username)->firstOrFail();
}
// Direct the user to the profile page.
return view('pages.profile.index', compact('user'));
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
*
* @return \Illuminate\Http\Response
*/
public function edit($id)
{
//
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
*
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
//
}
/**
* Remove the specified resource from storage.
*
* @param int $id
*
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
//
}
}

View file

@ -0,0 +1,85 @@
<?php
namespace App\Http\Controllers;
use App\Models\UserGamerTag;
use Illuminate\Http\Request;
class UserGamerTagController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
//
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
//
}
/**
* Display the specified resource.
*
* @param \App\Models\UserGamerTag $userGamerTag
* @return \Illuminate\Http\Response
*/
public function show(UserGamerTag $userGamerTag)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param \App\Models\UserGamerTag $userGamerTag
* @return \Illuminate\Http\Response
*/
public function edit(UserGamerTag $userGamerTag)
{
//
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \App\Models\UserGamerTag $userGamerTag
* @return \Illuminate\Http\Response
*/
public function update(Request $request, UserGamerTag $userGamerTag)
{
//
}
/**
* Remove the specified resource from storage.
*
* @param \App\Models\UserGamerTag $userGamerTag
* @return \Illuminate\Http\Response
*/
public function destroy(UserGamerTag $userGamerTag)
{
//
}
}

View file

@ -0,0 +1,85 @@
<?php
namespace App\Http\Controllers;
use App\Models\UserInfo;
use Illuminate\Http\Request;
class UserInfoController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
//
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
//
}
/**
* Display the specified resource.
*
* @param \App\Models\UserInfo $userInfo
* @return \Illuminate\Http\Response
*/
public function show(UserInfo $userInfo)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param \App\Models\UserInfo $userInfo
* @return \Illuminate\Http\Response
*/
public function edit(UserInfo $userInfo)
{
//
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \App\Models\UserInfo $userInfo
* @return \Illuminate\Http\Response
*/
public function update(Request $request, UserInfo $userInfo)
{
//
}
/**
* Remove the specified resource from storage.
*
* @param \App\Models\UserInfo $userInfo
* @return \Illuminate\Http\Response
*/
public function destroy(UserInfo $userInfo)
{
//
}
}

View file

@ -0,0 +1,85 @@
<?php
namespace App\Http\Controllers;
use App\Models\UserNotificationSetting;
use Illuminate\Http\Request;
class UserNotificationSettingController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
//
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
//
}
/**
* Display the specified resource.
*
* @param \App\Models\UserNotificationSetting $userNotificationSetting
* @return \Illuminate\Http\Response
*/
public function show(UserNotificationSetting $userNotificationSetting)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param \App\Models\UserNotificationSetting $userNotificationSetting
* @return \Illuminate\Http\Response
*/
public function edit(UserNotificationSetting $userNotificationSetting)
{
//
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \App\Models\UserNotificationSetting $userNotificationSetting
* @return \Illuminate\Http\Response
*/
public function update(Request $request, UserNotificationSetting $userNotificationSetting)
{
//
}
/**
* Remove the specified resource from storage.
*
* @param \App\Models\UserNotificationSetting $userNotificationSetting
* @return \Illuminate\Http\Response
*/
public function destroy(UserNotificationSetting $userNotificationSetting)
{
//
}
}

View file

@ -0,0 +1,27 @@
<?php
namespace App\Http\Controllers;
use App\Models\UserSiteSetting;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
class UserSiteSettingController extends Controller
{
/**
* Set the users dark mode setting.
*
* @param string $mode Dark mode setting, either 'yes' or 'no'.
* @return \Illuminate\Http\Response
*/
public static function setDarkMode($mode)
{
// Get the user as an object.
$user = auth()->user();
$result = DB::table('user_site_settings')->updateOrInsert(
['user_id' => $user->id, 'setting_name' => 'dark_mode'],
['setting_value' => $mode]
);
}
}

View file

@ -0,0 +1,97 @@
<?php
namespace App\Http\Controllers;
use App\Models\Wishlist;
use App\Models\User;
use Illuminate\Http\Request;
class WishlistController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
//
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
//
}
/**
* Display the specified resource.
*
* @param string $username
*
* @return \Illuminate\Http\Response
*/
public function show($username = null)
{
// If username is null, fetch the user_id and their wishlist items.
if ($username === null) {
$userId = auth()->user()->id;
$wishlist = Wishlist::where('user_id', $userId)->whereNull('deleted_at')->get();
} else { // Otherwise, fetch the user_id from $username and their wishlist items.
$userId = User::whereUsername($username)->firstOrFail()->id;
$wishlist = Wishlist::where('user_id', $userId)->get();
}
// Direct the user to the wishlist page.
return view('pages.wishlist.index', compact('wishlist'));
}
/**
* Show the form for editing the specified resource.
*
* @param \App\Models\Wishlist $wishlist
* @return \Illuminate\Http\Response
*/
public function edit(Wishlist $wishlist)
{
//
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \App\Models\Wishlist $wishlist
* @return \Illuminate\Http\Response
*/
public function update(Request $request, Wishlist $wishlist)
{
//
}
/**
* Remove the specified resource from storage.
*
* @param \App\Models\Wishlist $wishlist
* @return \Illuminate\Http\Response
*/
public function destroy(Wishlist $wishlist)
{
//
}
}

67
app/Http/Kernel.php Normal file
View file

@ -0,0 +1,67 @@
<?php
namespace App\Http;
use Illuminate\Foundation\Http\Kernel as HttpKernel;
class Kernel extends HttpKernel
{
/**
* The application's global HTTP middleware stack.
*
* These middleware are run during every request to your application.
*
* @var array
*/
protected $middleware = [
// \App\Http\Middleware\TrustHosts::class,
\App\Http\Middleware\TrustProxies::class,
\Fruitcake\Cors\HandleCors::class,
\App\Http\Middleware\PreventRequestsDuringMaintenance::class,
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
\App\Http\Middleware\TrimStrings::class,
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
\App\Http\Middleware\DevMiddleware::class,
];
/**
* The application's route middleware groups.
*
* @var array
*/
protected $middlewareGroups = [
'web' => [
\App\Http\Middleware\EncryptCookies::class,
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
\Illuminate\Session\Middleware\StartSession::class,
// \Illuminate\Session\Middleware\AuthenticateSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
\App\Http\Middleware\VerifyCsrfToken::class,
\Illuminate\Routing\Middleware\SubstituteBindings::class,
],
'api' => [
'throttle:api',
\Illuminate\Routing\Middleware\SubstituteBindings::class,
],
];
/**
* The application's route middleware.
*
* These middleware may be assigned to groups or used individually.
*
* @var array
*/
protected $routeMiddleware = [
'auth' => \App\Http\Middleware\Authenticate::class,
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
'can' => \Illuminate\Auth\Middleware\Authorize::class,
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class,
'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
];
}

View file

@ -0,0 +1,21 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Auth\Middleware\Authenticate as Middleware;
class Authenticate extends Middleware
{
/**
* Get the path the user should be redirected to when they are not authenticated.
*
* @param \Illuminate\Http\Request $request
* @return string|null
*/
protected function redirectTo($request)
{
if (! $request->expectsJson()) {
return route('login');
}
}
}

View file

@ -0,0 +1,32 @@
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
class DevMiddleware
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next
* @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
*/
public function handle(Request $request, Closure $next)
{
if (
(
$_SERVER['SERVER_NAME'] == 'dev.myvideogamelist.com' &&
$_SERVER['REMOTE_ADDR'] == '76.241.26.223'
) ||
$_SERVER['REMOTE_ADDR'] == '76.241.26.223'
) {
\Debugbar::enable();
}
return $next($request);
}
}

View file

@ -0,0 +1,17 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Cookie\Middleware\EncryptCookies as Middleware;
class EncryptCookies extends Middleware
{
/**
* The names of the cookies that should not be encrypted.
*
* @var array
*/
protected $except = [
//
];
}

View file

@ -0,0 +1,17 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance as Middleware;
class PreventRequestsDuringMaintenance extends Middleware
{
/**
* The URIs that should be reachable while maintenance mode is enabled.
*
* @var array
*/
protected $except = [
//
];
}

View file

@ -0,0 +1,33 @@
<?php
namespace App\Http\Middleware;
use App\Providers\RouteServiceProvider;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
class RedirectIfAuthenticated
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @param string|null ...$guards
*
* @return mixed
*/
public function handle(Request $request, Closure $next, ...$guards)
{
$guards = empty($guards) ? [null] : $guards;
foreach ($guards as $guard) {
if (Auth::guard($guard)->check()) {
return redirect(theme()->getPageUrl(RouteServiceProvider::HOME));
}
}
return $next($request);
}
}

View file

@ -0,0 +1,18 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\TrimStrings as Middleware;
class TrimStrings extends Middleware
{
/**
* The names of the attributes that should not be trimmed.
*
* @var array
*/
protected $except = [
'password',
'password_confirmation',
];
}

View file

@ -0,0 +1,20 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Http\Middleware\TrustHosts as Middleware;
class TrustHosts extends Middleware
{
/**
* Get the host patterns that should be trusted.
*
* @return array
*/
public function hosts()
{
return [
$this->allSubdomainsOfApplicationUrl(),
];
}
}

View file

@ -0,0 +1,28 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Http\Middleware\TrustProxies as Middleware;
use Illuminate\Http\Request;
class TrustProxies extends Middleware
{
/**
* The trusted proxies for this application.
*
* @var array|string|null
*/
protected $proxies;
/**
* The headers that should be used to detect proxies.
*
* @var int
*/
protected $headers =
Request::HEADER_X_FORWARDED_FOR |
Request::HEADER_X_FORWARDED_HOST |
Request::HEADER_X_FORWARDED_PORT |
Request::HEADER_X_FORWARDED_PROTO |
Request::HEADER_X_FORWARDED_AWS_ELB;
}

View file

@ -0,0 +1,17 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;
class VerifyCsrfToken extends Middleware
{
/**
* The URIs that should be excluded from CSRF verification.
*
* @var array
*/
protected $except = [
//
];
}

View file

@ -0,0 +1,32 @@
<?php
namespace App\Http\Requests\Account;
use App\Rules\MatchOldPassword;
use Illuminate\Foundation\Http\FormRequest;
class SettingsEmailRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'email' => 'required|string|email|max:255|unique:users',
'current_password' => ['required', new MatchOldPassword()],
];
}
}

View file

@ -0,0 +1,38 @@
<?php
namespace App\Http\Requests\Account;
use Illuminate\Foundation\Http\FormRequest;
class SettingsInfoRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'company' => 'nullable|string|max:255',
'phone' => 'nullable|string|max:255',
'website' => 'nullable|string|max:255',
'country' => 'nullable|string|max:255',
'language' => 'nullable|string|max:255',
'timezone' => 'nullable|string|max:255',
'currency' => 'nullable|string|max:255',
'communication' => 'nullable|array',
'marketing' => 'nullable|integer',
];
}
}

View file

@ -0,0 +1,33 @@
<?php
namespace App\Http\Requests\Account;
use App\Rules\MatchOldPassword;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rules;
class SettingsPasswordRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'current_password' => ['required', new MatchOldPassword()],
'password' => ['required', 'confirmed', Rules\Password::defaults()],
];
}
}

View file

@ -0,0 +1,93 @@
<?php
namespace App\Http\Requests\Auth;
use Illuminate\Auth\Events\Lockout;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\RateLimiter;
use Illuminate\Support\Str;
use Illuminate\Validation\ValidationException;
class LoginRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'username' => 'required|string',
'password' => 'required|string',
];
}
/**
* Attempt to authenticate the request's credentials.
*
* @return void
*
* @throws \Illuminate\Validation\ValidationException
*/
public function authenticate()
{
$this->ensureIsNotRateLimited();
if (! Auth::attempt($this->only('username', 'password'), $this->boolean('remember'))) {
RateLimiter::hit($this->throttleKey());
throw ValidationException::withMessages([
'username' => __('auth.failed'),
]);
}
RateLimiter::clear($this->throttleKey());
}
/**
* Ensure the login request is not rate limited.
*
* @return void
*
* @throws \Illuminate\Validation\ValidationException
*/
public function ensureIsNotRateLimited()
{
if (! RateLimiter::tooManyAttempts($this->throttleKey(), 5)) {
return;
}
event(new Lockout($this));
$seconds = RateLimiter::availableIn($this->throttleKey());
throw ValidationException::withMessages([
'username' => trans('auth.throttle', [
'seconds' => $seconds,
'minutes' => ceil($seconds / 60),
]),
]);
}
/**
* Get the rate limiting throttle key for the request.
*
* @return string
*/
public function throttleKey()
{
return Str::lower($this->input('username')) . '|' . $this->ip();
}
}

View file

@ -0,0 +1,23 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class ConsoleList extends Model
{
use HasFactory;
use SoftDeletes;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'user_id',
'consoles'
];
}

52
app/Models/Game.php Normal file
View file

@ -0,0 +1,52 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class Game extends Model
{
use HasFactory;
use SoftDeletes;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'name',
'alt_titles',
'platform_id',
'description',
'source',
'boxart',
'genre_ids',
'developers',
'publishers',
'composers',
'website',
'na_release_date',
'eu_release_date',
'jp_release_date',
'aus_release_date',
'esrb_rating',
'pegi_rating',
'cero_rating',
'acb_rating',
'requested_by',
'added_by'
];
/**
* Game relation to platform model
*
* @return \Illuminate\Database\Eloquent\Relations\HasOne
*/
public function platform()
{
return $this->hasOne(Platform::class, 'id', 'platform_id');
}
}

View file

@ -0,0 +1,25 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class GameComment extends Model
{
use HasFactory;
use SoftDeletes;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'game_id',
'user_id',
'comment',
'ip_address'
];
}

57
app/Models/GameList.php Normal file
View file

@ -0,0 +1,57 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class GameList extends Model
{
use HasFactory;
use SoftDeletes;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'user_id',
'game_id',
'name',
'platform_id',
'ownership',
'status',
'rating',
'priority',
'difficulty',
'hours_played',
'replay_value',
'start_date',
'finish_date',
'is_replaying',
'notes',
'ip_address'
];
/**
* Game list relation to user model
*
* @return \Illuminate\Database\Eloquent\Relations\HasOne
*/
public function user()
{
return $this->hasOne(User::class);
}
/**
* Game list relation to game model
*
* @return \Illuminate\Database\Eloquent\Relations\HasOne
*/
public function game()
{
return $this->hasOne(Game::class, 'id', 'game_id');
}
}

23
app/Models/Genre.php Normal file
View file

@ -0,0 +1,23 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class Genre extends Model
{
use HasFactory;
use SoftDeletes;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'name',
'ip_address'
];
}

22
app/Models/Platform.php Normal file
View file

@ -0,0 +1,22 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class Platform extends Model
{
use HasFactory;
use SoftDeletes;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'name'
];
}

View file

@ -0,0 +1,25 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class ProfileComment extends Model
{
use HasFactory;
use SoftDeletes;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'sender_id',
'receiver_id',
'comment',
'ip_address'
];
}

11
app/Models/Role.php Normal file
View file

@ -0,0 +1,11 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Role extends Model
{
use HasFactory;
}

131
app/Models/User.php Normal file
View file

@ -0,0 +1,131 @@
<?php
namespace App\Models;
use App\Core\Traits\SpatieLogsActivity;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
class User extends Authenticatable implements MustVerifyEmail
{
use HasFactory;
use Notifiable;
use SpatieLogsActivity;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'username',
'password',
'email',
'role_id',
'avatar',
'coverpic',
'bio',
'status',
'api_token',
'stripe_id',
'profile_views',
'list_views',
'blog_views',
'banned',
'user_deleted',
'ip_address'
];
/**
* The attributes that should be hidden for arrays.
*
* @var array
*/
protected $hidden = [
'password',
'api_token',
'stripe_id',
'remember_token'
];
/**
* The attributes that should be cast to native types.
*
* @var array
*/
protected $casts = [
'email_verified_at' => 'datetime',
];
public function getRememberToken()
{
return $this->remember_token;
}
public function setRememberToken($value)
{
$this->remember_token = $value;
}
/**
* User relation to user gamertags model
*
* @return \Illuminate\Database\Eloquent\Relations\HasOne
*/
public function gamertags()
{
return $this->hasOne(UserGamerTag::class);
}
/**
* User relation to user info model
*
* @return \Illuminate\Database\Eloquent\Relations\HasOne
*/
public function info()
{
return $this->hasOne(UserInfo::class);
}
/**
* User relation to user notification settings model
*
* @return \Illuminate\Database\Eloquent\Relations\HasOne
*/
public function notifications()
{
return $this->hasOne(UserNotificationSetting::class);
}
/**
* User relation to role model
*
* @return \Illuminate\Database\Eloquent\Relations\HasOne
*/
public function role()
{
return $this->hasOne(Role::class, 'id', 'role_id');
}
/**
* User relation to game list model
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function gameList()
{
return $this->hasMany(GameList::class);
}
/**
* User relation to user site settings model
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function siteSettings()
{
return $this->hasMany(UserSiteSetting::class);
}
}

View file

@ -0,0 +1,40 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class UserGamerTag extends Model
{
use HasFactory;
use SoftDeletes;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'xbox_live',
'wii',
'wii_u',
'3ds',
'nintendo_id',
'nintendo_switch_id',
'psn',
'steam',
'battle_net'
];
/**
* User Gamer Tag relation to user model
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function user()
{
return $this->belongsTo(User::class);
}
}

40
app/Models/UserInfo.php Normal file
View file

@ -0,0 +1,40 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class UserInfo extends Model
{
use HasFactory;
use SoftDeletes;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'website',
'facebook',
'twitter',
'instagram',
'myanimelist',
'location',
'true_achievements',
'true_trophies',
'twitch'
];
/**
* User Info relation to user model
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function user()
{
return $this->belongsTo(User::class);
}
}

View file

@ -0,0 +1,37 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class UserNotificationSetting extends Model
{
use HasFactory;
use SoftDeletes;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'comment_on_your_profile',
'previously_left_comment_on_game',
'comment_for_game_on_list',
'comment_on_your_review',
'previously_left_comment_on_review',
'friend_added_you'
];
/**
* User notification setting relation to user model
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function user()
{
return $this->belongsTo(User::class);
}
}

View file

@ -0,0 +1,34 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class UserSiteSetting extends Model
{
use HasFactory;
use SoftDeletes;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'user_id',
'setting_name',
'setting_value',
];
/**
* User Site Settings relation to user model
*
* @return \Illuminate\Database\Eloquent\Relations\HasOne
*/
public function user()
{
return $this->hasOne(User::class);
}
}

25
app/Models/Wishlist.php Normal file
View file

@ -0,0 +1,25 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class Wishlist extends Model
{
use HasFactory;
use SoftDeletes;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'user_id',
'game_id',
'sort_order',
'ip_address'
];
}

View file

@ -0,0 +1,94 @@
<?php
namespace App\Policies;
use App\Models\GameList;
use App\Models\User;
use Illuminate\Auth\Access\HandlesAuthorization;
class GameListPolicy
{
use HandlesAuthorization;
/**
* Determine whether the user can view any models.
*
* @param \App\Models\User $user
* @return \Illuminate\Auth\Access\Response|bool
*/
public function viewAny(User $user)
{
//
}
/**
* Determine whether the user can view the model.
*
* @param \App\Models\User $user
* @param \App\Models\GameList $gameList
* @return \Illuminate\Auth\Access\Response|bool
*/
public function view(User $user, GameList $gameList)
{
//
}
/**
* Determine whether the user can create models.
*
* @param \App\Models\User $user
* @return \Illuminate\Auth\Access\Response|bool
*/
public function create(User $user)
{
//
}
/**
* Determine whether the user can update the model.
*
* @param \App\Models\User $user
* @param \App\Models\GameList $gameList
* @return \Illuminate\Auth\Access\Response|bool
*/
public function update(User $user, GameList $gameList)
{
return $user->id === $gameList->user_id;
}
/**
* Determine whether the user can delete the model.
*
* @param \App\Models\User $user
* @param \App\Models\GameList $gameList
* @return \Illuminate\Auth\Access\Response|bool
*/
public function delete(User $user, GameList $gameList)
{
return $user->id === $gameList->user_id;
}
/**
* Determine whether the user can restore the model.
*
* @param \App\Models\User $user
* @param \App\Models\GameList $gameList
* @return \Illuminate\Auth\Access\Response|bool
*/
public function restore(User $user, GameList $gameList)
{
//
}
/**
* Determine whether the user can permanently delete the model.
*
* @param \App\Models\User $user
* @param \App\Models\GameList $gameList
* @return \Illuminate\Auth\Access\Response|bool
*/
public function forceDelete(User $user, GameList $gameList)
{
//
}
}

129
app/Policies/GamePolicy.php Normal file
View file

@ -0,0 +1,129 @@
<?php
namespace App\Policies;
use App\Models\Game;
use App\Models\User;
use Illuminate\Auth\Access\HandlesAuthorization;
class GamePolicy
{
use HandlesAuthorization;
/**
* Determine whether the user can view any models.
*
* @param \App\Models\User $user
* @return \Illuminate\Auth\Access\Response|bool
*/
public function viewAny(User $user)
{
//
}
/**
* Determine whether the user can view the model.
*
* @param \App\Models\User $user
* @param \App\Models\Game $game
* @return \Illuminate\Auth\Access\Response|bool
*/
public function view(User $user, Game $game)
{
//
}
/**
* Determine whether the user can create models.
*
* @param \App\Models\User $user
* @return \Illuminate\Auth\Access\Response|bool
*/
public function create(User $user)
{
// Ensure the user has permission to add games into the database.
if (
$user->role_id === 1 ||
$user->role_id === 2 ||
$user->role_id === 3
) {
return true;
}
}
/**
* Determine whether the user can clone the model.
*/
public function clone(User $user)
{
// Ensure the user has permission to clone games into the database.
if (
$user->role_id === 1 ||
$user->role_id === 2 ||
$user->role_id === 3
) {
return true;
}
}
/**
* Determine whether the user can update the model.
*
* @param \App\Models\User $user
* @return \Illuminate\Auth\Access\Response|bool
*/
public function update(User $user)
{
// Ensure the user has permission to updates games in the database.
if (
$user->role_id === 1 ||
$user->role_id === 2 ||
$user->role_id === 3
) {
return true;
}
}
/**
* Determine whether the user can delete the model.
*
* @param \App\Models\User $user
* @param \App\Models\Game $game
* @return \Illuminate\Auth\Access\Response|bool
*/
public function delete(User $user, Game $game)
{
// Ensure the user has permission to delete games from the database.
if (
$user->role_id === 1 ||
$user->role_id === 2 ||
$user->role_id === 3
) {
return true;
}
}
/**
* Determine whether the user can restore the model.
*
* @param \App\Models\User $user
* @param \App\Models\Game $game
* @return \Illuminate\Auth\Access\Response|bool
*/
public function restore(User $user, Game $game)
{
//
}
/**
* Determine whether the user can permanently delete the model.
*
* @param \App\Models\User $user
* @param \App\Models\Game $game
* @return \Illuminate\Auth\Access\Response|bool
*/
public function forceDelete(User $user, Game $game)
{
//
}
}

View file

@ -0,0 +1,93 @@
<?php
namespace App\Policies;
use App\Models\User;
use Illuminate\Auth\Access\HandlesAuthorization;
class UserPolicy
{
use HandlesAuthorization;
/**
* Determine whether the user can view any models.
*
* @param \App\Models\User $user
* @return mixed
*/
public function viewAny(User $user)
{
//
}
/**
* Determine whether the user can view the model.
*
* @param \App\Models\User $user
* @param \App\Models\User $model
* @return mixed
*/
public function view(User $user, User $model)
{
//
}
/**
* Determine whether the user can create models.
*
* @param \App\Models\User $user
* @return mixed
*/
public function create(User $user)
{
//
}
/**
* Determine whether the user can update the model.
*
* @param \App\Models\User $user
* @param \App\Models\User $model
* @return mixed
*/
public function update(User $user, User $model)
{
//
}
/**
* Determine whether the user can delete the model.
*
* @param \App\Models\User $user
* @param \App\Models\User $model
* @return mixed
*/
public function delete(User $user, User $model)
{
return $user->is($model);
}
/**
* Determine whether the user can restore the model.
*
* @param \App\Models\User $user
* @param \App\Models\User $model
* @return mixed
*/
public function restore(User $user, User $model)
{
//
}
/**
* Determine whether the user can permanently delete the model.
*
* @param \App\Models\User $user
* @param \App\Models\User $model
* @return mixed
*/
public function forceDelete(User $user, User $model)
{
//
}
}

View file

@ -0,0 +1,94 @@
<?php
namespace App\Policies;
use App\Models\User;
use App\Models\UserSiteSetting;
use Illuminate\Auth\Access\HandlesAuthorization;
class UserSiteSettingPolicy
{
use HandlesAuthorization;
/**
* Determine whether the user can view any models.
*
* @param \App\Models\User $user
* @return \Illuminate\Auth\Access\Response|bool
*/
public function viewAny(User $user)
{
//
}
/**
* Determine whether the user can view the model.
*
* @param \App\Models\User $user
* @param \App\Models\UserSiteSetting $userSiteSetting
* @return \Illuminate\Auth\Access\Response|bool
*/
public function view(User $user, UserSiteSetting $userSiteSetting)
{
//
}
/**
* Determine whether the user can create models.
*
* @param \App\Models\User $user
* @return \Illuminate\Auth\Access\Response|bool
*/
public function create(User $user)
{
//
}
/**
* Determine whether the user can update the model.
*
* @param \App\Models\User $user
* @param \App\Models\UserSiteSetting $userSiteSetting
* @return \Illuminate\Auth\Access\Response|bool
*/
public function update(User $user, UserSiteSetting $userSiteSetting)
{
//
}
/**
* Determine whether the user can delete the model.
*
* @param \App\Models\User $user
* @param \App\Models\UserSiteSetting $userSiteSetting
* @return \Illuminate\Auth\Access\Response|bool
*/
public function delete(User $user, UserSiteSetting $userSiteSetting)
{
//
}
/**
* Determine whether the user can restore the model.
*
* @param \App\Models\User $user
* @param \App\Models\UserSiteSetting $userSiteSetting
* @return \Illuminate\Auth\Access\Response|bool
*/
public function restore(User $user, UserSiteSetting $userSiteSetting)
{
//
}
/**
* Determine whether the user can permanently delete the model.
*
* @param \App\Models\User $user
* @param \App\Models\UserSiteSetting $userSiteSetting
* @return \Illuminate\Auth\Access\Response|bool
*/
public function forceDelete(User $user, UserSiteSetting $userSiteSetting)
{
//
}
}

View file

@ -0,0 +1,52 @@
<?php
namespace App\Providers;
use App\Core\Adapters\Theme;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\View;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*
* @return void
*/
public function register()
{
// if ($this->app->isLocal()) {
// $this->app->register(\Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class);
// }
}
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
$theme = theme();
// Share theme adapter class
View::share('theme', $theme);
// Set demo globally
$theme->setDemo('demo1');
$theme->initConfig();
bootstrap()->run();
if (isRTL()) {
// RTL html attributes
Theme::addHtmlAttribute('html', 'dir', 'rtl');
Theme::addHtmlAttribute('html', 'direction', 'rtl');
Theme::addHtmlAttribute('html', 'style', 'direction:rtl;');
Theme::addHtmlAttribute('body', 'direction', 'rtl');
}
}
}

View file

@ -0,0 +1,33 @@
<?php
namespace App\Providers;
use App\Models\User;
use App\Policies\UserPolicy;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Gate;
class AuthServiceProvider extends ServiceProvider
{
/**
* The policy mappings for the application.
*
* @var array
*/
protected $policies = [
// 'App\Models\Model' => 'App\Policies\ModelPolicy',
User::class => UserPolicy::class,
];
/**
* Register any authentication / authorization services.
*
* @return void
*/
public function boot()
{
$this->registerPolicies();
//
}
}

View file

@ -0,0 +1,21 @@
<?php
namespace App\Providers;
use Illuminate\Support\Facades\Broadcast;
use Illuminate\Support\ServiceProvider;
class BroadcastServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
Broadcast::routes();
require base_path('routes/channels.php');
}
}

View file

@ -0,0 +1,32 @@
<?php
namespace App\Providers;
use Illuminate\Auth\Events\Registered;
use Illuminate\Auth\Listeners\SendEmailVerificationNotification;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Event;
class EventServiceProvider extends ServiceProvider
{
/**
* The event listener mappings for the application.
*
* @var array
*/
protected $listen = [
Registered::class => [
SendEmailVerificationNotification::class,
],
];
/**
* Register any events for your application.
*
* @return void
*/
public function boot()
{
//
}
}

View file

@ -0,0 +1,30 @@
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
class HelperServiceProvider extends ServiceProvider
{
/**
* Register services.
*
* @return void
*/
public function register()
{
foreach (glob(app_path() . '/Helpers/*.php') as $file) {
require_once($file);
}
}
/**
* Bootstrap services.
*
* @return void
*/
public function boot()
{
//
}
}

View file

@ -0,0 +1,68 @@
<?php
namespace App\Providers;
use Illuminate\Cache\RateLimiting\Limit;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\RateLimiter;
use Illuminate\Support\Facades\Route;
use PaginateRoute;
class RouteServiceProvider extends ServiceProvider
{
/**
* The path to the "home" route for your application.
*
* This is used by Laravel authentication to redirect users after login.
*
* @var string
*/
public const HOME = '/';
/**
* The controller namespace for the application.
*
* When present, controller route declarations will automatically be prefixed with this namespace.
*
* @var string|null
*/
// protected $namespace = 'App\\Http\\Controllers';
/**
* Define your route model bindings, pattern filters, etc.
*
* @return void
*/
public function boot()
{
$this->configureRateLimiting();
$this->routes(function () {
Route::prefix('api')
->middleware('api')
->namespace($this->namespace)
->group(base_path('routes/api.php'));
Route::middleware('web')
->namespace($this->namespace)
->group(base_path('routes/web.php'));
});
PaginateRoute::registerMacros();
parent::boot();
}
/**
* Configure the rate limiters for the application.
*
* @return void
*/
protected function configureRateLimiting()
{
RateLimiter::for('api', function (Request $request) {
return Limit::perMinute(60)->by(optional($request->user())->id ?: $request->ip());
});
}
}

View file

@ -0,0 +1,32 @@
<?php
namespace App\Rules;
use Illuminate\Contracts\Validation\InvokableRule;
use Illuminate\Support\Carbon;
class GameReleaseDate implements InvokableRule
{
/**
* Run the validation rule.
*
* @param string $attribute
* @param mixed $value
* @param \Closure(string): \Illuminate\Translation\PotentiallyTranslatedString $fail
* @return void
*/
public function __invoke($attribute, $value, $fail)
{
if ($value === 'TBD' || $value === 'EA') {
return true;
}
try {
Carbon::createFromFormat('F j, Y', $value);
} catch (\Exception $e) {
$fail('The release date must be in the format of Month Day, Year (ex. March 10, 2000), TBD or EA.');
}
return true;
}
}

View file

@ -0,0 +1,32 @@
<?php
namespace App\Rules;
use Illuminate\Contracts\Validation\InvokableRule;
use Illuminate\Support\Carbon;
class GameReleaseDate implements InvokableRule
{
/**
* Run the validation rule.
*
* @param string $attribute
* @param mixed $value
* @param \Closure(string): \Illuminate\Translation\PotentiallyTranslatedString $fail
* @return void
*/
public function __invoke($attribute, $value, $fail)
{
if ($value === 'TBD' || $value === 'EA') {
return true;
}
try {
Carbon::createFromFormat('F j, Y', $value);
} catch (Exception $e) {
$fail('The release date must be in the format of Month Day, Year (ex. March 10, 2000), TBD or EA.');
}
return true;
}
}

View file

@ -0,0 +1,45 @@
<?php
namespace App\Rules;
use App\Models\User;
use Illuminate\Contracts\Validation\Rule;
use Illuminate\Support\Facades\Hash;
class MatchOldPassword implements Rule
{
/**
* Create a new rule instance.
*
* @return void
*/
public function __construct()
{
//
}
/**
* Determine if the validation rule passes.
*
* @param string $attribute
* @param mixed $value
*
* @return bool
*/
public function passes($attribute, $value)
{
$user = User::where('email', request()->input('current_email'))->first();
return Hash::check($value, $user->password);
}
/**
* Get the validation error message.
*
* @return string
*/
public function message()
{
return 'The :attribute is not match with old password.';
}
}

Some files were not shown because too many files have changed in this diff Show more