mirror of
https://github.com/prurigro/hypothetical.git
synced 2024-11-21 15:42:31 -05:00
Move app\Models\Dashboard to app\Dashboard
This commit is contained in:
parent
f67401a9a1
commit
51c04ab1e4
6 changed files with 93 additions and 6 deletions
87
app/Dashboard.php
Normal file
87
app/Dashboard.php
Normal file
|
@ -0,0 +1,87 @@
|
|||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
class Dashboard
|
||||
{
|
||||
/**
|
||||
* Dashboard Menu
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static $menu = [
|
||||
[
|
||||
'title' => 'Blog',
|
||||
'type' => 'edit',
|
||||
'model' => 'blog'
|
||||
],
|
||||
|
||||
[
|
||||
'title' => 'Form Submissions',
|
||||
|
||||
'submenu' => [
|
||||
[
|
||||
'title' => 'Contact',
|
||||
'type' => 'view',
|
||||
'model' => 'contact'
|
||||
],
|
||||
[
|
||||
'title' => 'Subscriptions',
|
||||
'type' => 'view',
|
||||
'model' => 'subscriptions'
|
||||
]
|
||||
]
|
||||
]
|
||||
];
|
||||
|
||||
/**
|
||||
* Authors (Credits Page)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static $author_credits = [
|
||||
[ 'name' => 'Kevin MacMartin', 'url' => 'https://github.com/prurigro' ]
|
||||
];
|
||||
|
||||
/**
|
||||
* Libraries (Credits Page)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static $library_credits = [
|
||||
[ 'name' => 'Bootstrap', 'url' => 'https://getbootstrap.com' ],
|
||||
[ 'name' => 'Font Awesome', 'url' => 'https://fontawesome.com' ],
|
||||
[ 'name' => 'GreenSock', 'url' => 'https://greensock.com/gsap' ],
|
||||
[ 'name' => 'jQuery', 'url' => 'https://jquery.org' ],
|
||||
[ 'name' => 'List.js', 'url' => 'http://listjs.com' ],
|
||||
[ 'name' => 'pickadate.js', 'url' => 'http://amsul.ca/pickadate.js/' ],
|
||||
[ 'name' => 'Popper.js', 'url' => 'https://popper.js.org' ],
|
||||
[ 'name' => 'SimpleMDE Markdown Editor', 'url' => 'https://simplemde.com' ],
|
||||
[ 'name' => 'Sortable', 'url' => 'https://github.com/RubaXa/Sortable' ],
|
||||
[ 'name' => 'SpinKit', 'url' => 'http://tobiasahlin.com/spinkit/' ],
|
||||
[ 'name' => 'Vue.js', 'url' => 'https://vuejs.org' ],
|
||||
[ 'name' => 'what-input', 'url' => 'https://github.com/ten1seven/what-input' ]
|
||||
];
|
||||
|
||||
/**
|
||||
* Retrieve a Dashboard Model
|
||||
*
|
||||
* @return model
|
||||
*/
|
||||
public static function getModel($model, $type = null)
|
||||
{
|
||||
$model_name = ucfirst($model);
|
||||
|
||||
if (file_exists(app_path() . '/Models/' . $model_name . '.php')) {
|
||||
$model_class = 'App\\Models\\' . ucfirst($model);
|
||||
|
||||
if ($type != null && $type != $model_class::$dashboard_type) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $model_class;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -6,7 +6,7 @@ use File;
|
|||
use Image;
|
||||
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
||||
use App\Models\Dashboard;
|
||||
use App\Dashboard;
|
||||
|
||||
class DashboardController extends Controller {
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ Other information about database interaction, routing, controllers, etc can be v
|
|||
|
||||
### Updating the dashboard menu
|
||||
|
||||
The dashboard menu can be edited by changing the `$menu` array in `app/Models/Dashboard.php`.
|
||||
The dashboard menu can be edited by changing the `$menu` array in `app/Dashboard.php`.
|
||||
|
||||
The each item in the array is itself an array, containing either a menu item or a dropdown of menu items.
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<h2>Authors</h2>
|
||||
|
||||
<ul>
|
||||
@foreach(App\Models\Dashboard::$author_credits as $credit)
|
||||
@foreach(App\Dashboard::$author_credits as $credit)
|
||||
<li><a href="{{ $credit['url'] }}" target="_blank" rel="noreferrer">{{ $credit['name'] }}</a></li>
|
||||
@endforeach
|
||||
</ul>
|
||||
|
@ -15,7 +15,7 @@
|
|||
<h2>Libraries</h2>
|
||||
|
||||
<ul>
|
||||
@foreach(App\Models\Dashboard::$library_credits as $credit)
|
||||
@foreach(App\Dashboard::$library_credits as $credit)
|
||||
<li><a href="{{ $credit['url'] }}" target="_blank" rel="noreferrer">{{ $credit['name'] }}</a></li>
|
||||
@endforeach
|
||||
</ul>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
@section('dashboard-body')
|
||||
<div class="list-group menu-list">
|
||||
@foreach(App\Models\Dashboard::$menu as $menu_item)
|
||||
@foreach(App\Dashboard::$menu as $menu_item)
|
||||
@if(array_key_exists('submenu', $menu_item))
|
||||
@foreach($menu_item['submenu'] as $submenu_item)
|
||||
<li class="list-group-item">
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
<li class="nav-item"><a class="nav-link {{ $current_page == 'register' ? 'active' : '' }}" href="/register">Register</a></li>
|
||||
@endif
|
||||
@else
|
||||
@foreach(App\Models\Dashboard::$menu as $menu_item)
|
||||
@foreach(App\Dashboard::$menu as $menu_item)
|
||||
@if(array_key_exists('submenu', $menu_item))
|
||||
@set('dropdown_id', preg_replace([ '/\ \ */', '/[^a-z\-]/' ], [ '-', '' ], strtolower($menu_item['title'])))
|
||||
|
||||
|
|
Loading…
Reference in a new issue