From 51c04ab1e46974a267dc101902a35e43fcf6f209 Mon Sep 17 00:00:00 2001 From: Kevin MacMartin Date: Mon, 23 Apr 2018 23:39:40 -0400 Subject: [PATCH] Move app\Models\Dashboard to app\Dashboard --- app/Dashboard.php | 87 ++++++++++++++++++++ app/Http/Controllers/DashboardController.php | 2 +- readme.md | 2 +- resources/views/dashboard/credits.blade.php | 4 +- resources/views/dashboard/home.blade.php | 2 +- resources/views/dashboard/nav.blade.php | 2 +- 6 files changed, 93 insertions(+), 6 deletions(-) create mode 100644 app/Dashboard.php diff --git a/app/Dashboard.php b/app/Dashboard.php new file mode 100644 index 0000000..0308252 --- /dev/null +++ b/app/Dashboard.php @@ -0,0 +1,87 @@ + '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; + } + } +} diff --git a/app/Http/Controllers/DashboardController.php b/app/Http/Controllers/DashboardController.php index 492e654..ff633e5 100644 --- a/app/Http/Controllers/DashboardController.php +++ b/app/Http/Controllers/DashboardController.php @@ -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 { diff --git a/readme.md b/readme.md index d170641..df158e4 100644 --- a/readme.md +++ b/readme.md @@ -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. diff --git a/resources/views/dashboard/credits.blade.php b/resources/views/dashboard/credits.blade.php index ce1d92e..2e61446 100644 --- a/resources/views/dashboard/credits.blade.php +++ b/resources/views/dashboard/credits.blade.php @@ -7,7 +7,7 @@

Authors

@@ -15,7 +15,7 @@

Libraries

diff --git a/resources/views/dashboard/home.blade.php b/resources/views/dashboard/home.blade.php index d944884..8282141 100644 --- a/resources/views/dashboard/home.blade.php +++ b/resources/views/dashboard/home.blade.php @@ -4,7 +4,7 @@ @section('dashboard-body')