From 2987e622de1e573c789c68dd552afa34e395c19f Mon Sep 17 00:00:00 2001 From: Deon George Date: Mon, 23 Apr 2018 17:45:21 +1000 Subject: [PATCH] Initial Release --- composer.json | 29 ++++ resources/themes/adminlte/lang/en/message.php | 139 ++++++++++++++++++ .../adminlte/views/auth/login.blade.php | 53 +++++++ .../auth/partials/social_login.blade.php | 6 + .../adminlte/views/auth/register.blade.php | 44 ++++++ .../adminlte/views/layouts/app.blade.php | 41 ++++++ .../adminlte/views/layouts/auth.blade.php | 8 + .../adminlte/views/layouts/errors.blade.php | 17 +++ .../layouts/partials/htmlheader.blade.php | 41 ++++++ .../layouts/partials/mainheader.blade.php | 95 ++++++++++++ .../layouts/partials/scripts_auth.blade.php | 2 + .../views/layouts/partials/sidebar.blade.php | 108 ++++++++++++++ src/Carbon.php | 56 +++++++ src/Providers/LeenooksServiceProvider.php | 66 +++++++++ src/Traits/CollectionCollapse.php | 62 ++++++++ src/Traits/ModelCache.php | 19 +++ 16 files changed, 786 insertions(+) create mode 100644 composer.json create mode 100644 resources/themes/adminlte/lang/en/message.php create mode 100644 resources/themes/adminlte/views/auth/login.blade.php create mode 100644 resources/themes/adminlte/views/auth/partials/social_login.blade.php create mode 100644 resources/themes/adminlte/views/auth/register.blade.php create mode 100644 resources/themes/adminlte/views/layouts/app.blade.php create mode 100644 resources/themes/adminlte/views/layouts/auth.blade.php create mode 100644 resources/themes/adminlte/views/layouts/errors.blade.php create mode 100644 resources/themes/adminlte/views/layouts/partials/htmlheader.blade.php create mode 100644 resources/themes/adminlte/views/layouts/partials/mainheader.blade.php create mode 100644 resources/themes/adminlte/views/layouts/partials/scripts_auth.blade.php create mode 100644 resources/themes/adminlte/views/layouts/partials/sidebar.blade.php create mode 100644 src/Carbon.php create mode 100644 src/Providers/LeenooksServiceProvider.php create mode 100644 src/Traits/CollectionCollapse.php create mode 100644 src/Traits/ModelCache.php diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..6cf675f --- /dev/null +++ b/composer.json @@ -0,0 +1,29 @@ +{ + "name": "leenooks/laravel", + "description": "Leenooks standard templates and tools.", + "keywords": ["laravel", "leenooks"], + "license": "MIT", + "authors": [ + { + "name": "Deon George", + "email": "deon@leenooks.net" + } + ], + "require": { + }, + "require-dev": { + }, + "autoload": { + "psr-4": { + "Leenooks\\": "src" + } + }, + "extra": { + "laravel": { + "providers": [ + "Leenooks\\Providers\\LeenooksServiceProvider" + ] + } + }, + "minimum-stability": "dev" +} diff --git a/resources/themes/adminlte/lang/en/message.php b/resources/themes/adminlte/lang/en/message.php new file mode 100644 index 0000000..5defedf --- /dev/null +++ b/resources/themes/adminlte/lang/en/message.php @@ -0,0 +1,139 @@ + 'You are logged in!', + 'someproblems' => 'There were some problems with your input.', + 'siginsession' => 'Sign in to start your session', + 'remember' => 'Remember Me', + 'buttonsign' => 'Sign In', + 'forgotpassword' => 'I forgot my password', + 'registermember' => 'Register a new membership', + 'terms' => 'I agree to the terms', + 'conditions' => 'Terms and conditions', + 'register' => 'Register', + 'login' => 'Login', + 'membreship' => 'I already have a membership', + 'passwordclickreset' => 'Click here to reset your password:', + 'signGithub' => 'Sign in using Github', + 'signFacebook' => 'Sign in using Facebook', + 'signTwitter' => 'Sign in using Twitter', + 'signGoogle+' => 'Sign in using Google+', + 'signLinkedin' => 'Sign in using Linkedin', + 'signW3id' => 'Sign in using W3id', + 'signIBMid' => 'Sign in using IBMid', + 'sendpassword' => 'Send Password Reset Link', + 'passwordreset' => 'Reset password', + 'pagenotfound' => 'Page not found', + '404error' => '404 Error Page', + 'notfindpage' => 'We could not find the page you were looking for.', + 'mainwhile' => 'Meanwhile, you may', + 'returndashboard' => 'return to dashboard', + 'usingsearch' => 'or try using the search form.', + 'search' => 'Search', + 'servererror' => 'Server Error', + '500error' => '500 Error Page', + 'somethingwrong' => 'Something went wrong.', + 'wewillwork' => 'We will work on fixing that right away.', + 'serviceunavailable' => 'Service unavailable', + '503error' => '503 Error Page', + 'level' => 'Level', + 'here' => 'Here', + 'recentactivity' => 'Recent Activity', + 'descriptionpackage' => 'A Laravel 5 package that switchs default Laravel scaffolding/boilerplate to AdminLTE template', + 'createdby' => 'Created by', + 'seecode' => 'See code at', + 'online' => 'Online', + 'home' => 'Home', + 'header' => 'HEADER', + 'anotherlink' => 'Another Link', + 'multilevel' => 'Multilevel', + 'linklevel2' => 'Link in level2', + 'birthday' => 'Langdon\'s Birthday', + 'birthdaydate' => 'Will be 23 on April 24th', + 'progress' => 'Tasks Progress', + 'customtemplate' => 'Custom Template Design', + 'statstab' => 'Stats Tab Content', + 'generalset' => 'General Settings', + 'reportpanel' => 'Report panel usage', + 'checked' => 'checked', + 'informationsettings' => 'Some information about this general settings option', + 'togglenav' => 'Toggle navigation', + 'tabmessages' => 'You have 4 messages', + 'supteam' => 'Support Team', + 'awesometheme' => 'Why not buy a new awesome theme?', + 'allmessages' => 'See All Messages', + 'notifications' => 'You have 10 notifications', + 'newmembers' => '5 new members joined today', + 'viewall' => 'View all', + 'tasks' => 'You have 9 tasks', + 'alltasks' => 'View all tasks', + 'desbuttons' => 'Design some buttons', + 'complete' => 'Complete', + 'membersince' => 'Member since', + 'followers' => 'Followers', + 'sales' => 'Sales', + 'friends' => 'Friends', + 'profile' => 'Profile', + 'signout' => 'Sign out', + 'landingdescription' => 'Laravel 5 package that switchs default Laravel scaffolding/boilerplate to AdminLTE template with Bootstrap 3.0 and Pratt Landing page', + 'landingdescriptionpratt' => 'Acacha AdminLTE Laravel package template Landing page - Using Pratt', + 'description' => 'Description', + 'showcase' => 'Showcase', + 'contact' => 'Contact', + 'laravelpackage' => '5 package that switchs default Laravel', + 'to' => 'to', + 'templatewith' => 'template with', + 'and' => 'and', + 'gedstarted' => 'Get Started!', + 'amazing' => 'Amazing admin template', + 'basedadminlte' => 'Based on adminlte bootstrap theme', + 'awesomepackaged' => 'Awesome packaged...', + 'by' => 'by', + 'at' => 'at', + 'readytouse' => 'ready to use with Laravel!', + 'designed' => 'Designed To Excel', + 'community' => 'Community', + 'see' => 'See', + 'githubproject' => 'Github project', + 'post' => 'post', + 'issues' => 'issues', + 'pullrequests' => 'Pull requests', + 'schedule' => 'Schedule', + 'monitoring' => 'Monitoring', + 'whatnew' => 'What\'s New?', + 'features' => 'Some Features', + 'design' => 'First Class Design', + 'retina' => 'Retina Ready Theme', + 'support' => 'Awesome Support', + 'responsive' => 'Responsive Design', + 'screenshots' => 'Some Screenshots', + 'address' => 'Address', + 'dropus' => 'Drop Us A Line', + 'yourname' => 'Your Name', + 'emailaddress' => 'Email Address', + 'enteremail' => 'Enter Email', + 'yourtext' => 'Your Text', + 'submit' => 'SUBMIT', + 'email' => 'Email', + 'username' => 'Username', + 'password' => 'Password', + 'retypepassword' => 'Retype password', + 'fullname' => 'Full Name', + 'registererror' => 'Error registering!', + 'loginerror' => 'Error loging!', + 'loggedin' => 'Logged in!', + 'entering' => 'Entering...', + 'registered' => 'User Registered!', +]; diff --git a/resources/themes/adminlte/views/auth/login.blade.php b/resources/themes/adminlte/views/auth/login.blade.php new file mode 100644 index 0000000..686fd5b --- /dev/null +++ b/resources/themes/adminlte/views/auth/login.blade.php @@ -0,0 +1,53 @@ +@extends('adminlte::layouts.auth') + +@section('htmlheader_title') + Log in +@endsection + +@section('content') + +
+ +
+ + @include('adminlte::layouts.partials.scripts_auth') + + + +@endsection \ No newline at end of file diff --git a/resources/themes/adminlte/views/auth/partials/social_login.blade.php b/resources/themes/adminlte/views/auth/partials/social_login.blade.php new file mode 100644 index 0000000..556f219 --- /dev/null +++ b/resources/themes/adminlte/views/auth/partials/social_login.blade.php @@ -0,0 +1,6 @@ + diff --git a/resources/themes/adminlte/views/auth/register.blade.php b/resources/themes/adminlte/views/auth/register.blade.php new file mode 100644 index 0000000..088ddf0 --- /dev/null +++ b/resources/themes/adminlte/views/auth/register.blade.php @@ -0,0 +1,44 @@ +@extends('adminlte::layouts.auth') + +@section('htmlheader_title') + Register +@endsection + +@section('content') + + +
+
+ + + @if (count($errors) > 0) +
+ Whoops! {{ trans('adminlte_lang::message.someproblems') }}

+
    + @foreach ($errors->all() as $error) +
  • {{ $error }}
  • + @endforeach +
+
+ @endif + +
+ + + + + + I already have an account +
+
+
+ + @include('adminlte::layouts.partials.scripts_auth') + + @include('adminlte::auth.terms') + + + +@endsection diff --git a/resources/themes/adminlte/views/layouts/app.blade.php b/resources/themes/adminlte/views/layouts/app.blade.php new file mode 100644 index 0000000..e063deb --- /dev/null +++ b/resources/themes/adminlte/views/layouts/app.blade.php @@ -0,0 +1,41 @@ + + + +@section('htmlheader') + @include('adminlte::layouts.partials.htmlheader') +@show + + +
+
+ @include('adminlte::layouts.partials.mainheader') + + @include('adminlte::layouts.partials.sidebar') + + +
+ + @include('adminlte::layouts.partials.contentheader') + + +
+
+ + @yield('main-content') +
+
+ +
+ + + @include('adminlte::layouts.partials.footer') +
+
+ + @section('scripts') + @include('adminlte::layouts.partials.scripts') + {{-- Scripts --}} + {!! Asset::scripts() !!} + @show + + \ No newline at end of file diff --git a/resources/themes/adminlte/views/layouts/auth.blade.php b/resources/themes/adminlte/views/layouts/auth.blade.php new file mode 100644 index 0000000..b54d100 --- /dev/null +++ b/resources/themes/adminlte/views/layouts/auth.blade.php @@ -0,0 +1,8 @@ + + + +@include('adminlte::layouts.partials.htmlheader') + +@yield('content') + + \ No newline at end of file diff --git a/resources/themes/adminlte/views/layouts/errors.blade.php b/resources/themes/adminlte/views/layouts/errors.blade.php new file mode 100644 index 0000000..35a90d9 --- /dev/null +++ b/resources/themes/adminlte/views/layouts/errors.blade.php @@ -0,0 +1,17 @@ + + + +@include('adminlte::layouts.partials.htmlheader') + +
+ +
+ + @yield('main-content') +
+
+ @section('scripts') + @include('adminlte::layouts.partials.scripts') + @show + + \ No newline at end of file diff --git a/resources/themes/adminlte/views/layouts/partials/htmlheader.blade.php b/resources/themes/adminlte/views/layouts/partials/htmlheader.blade.php new file mode 100644 index 0000000..56693aa --- /dev/null +++ b/resources/themes/adminlte/views/layouts/partials/htmlheader.blade.php @@ -0,0 +1,41 @@ + + + {{ config('app.name') }} - @yield('htmlheader_title', 'Your title here') + + + + + + + + + + + + + + + + {!! Asset::styles() !!} + \ No newline at end of file diff --git a/resources/themes/adminlte/views/layouts/partials/mainheader.blade.php b/resources/themes/adminlte/views/layouts/partials/mainheader.blade.php new file mode 100644 index 0000000..363b183 --- /dev/null +++ b/resources/themes/adminlte/views/layouts/partials/mainheader.blade.php @@ -0,0 +1,95 @@ + +
+ + + + + + +
diff --git a/resources/themes/adminlte/views/layouts/partials/scripts_auth.blade.php b/resources/themes/adminlte/views/layouts/partials/scripts_auth.blade.php new file mode 100644 index 0000000..eba12a1 --- /dev/null +++ b/resources/themes/adminlte/views/layouts/partials/scripts_auth.blade.php @@ -0,0 +1,2 @@ + + diff --git a/resources/themes/adminlte/views/layouts/partials/sidebar.blade.php b/resources/themes/adminlte/views/layouts/partials/sidebar.blade.php new file mode 100644 index 0000000..e4b11c5 --- /dev/null +++ b/resources/themes/adminlte/views/layouts/partials/sidebar.blade.php @@ -0,0 +1,108 @@ + + + +@section('page-scripts') + + + +@append diff --git a/src/Carbon.php b/src/Carbon.php new file mode 100644 index 0000000..0505194 --- /dev/null +++ b/src/Carbon.php @@ -0,0 +1,56 @@ +month / static::MONTHS_PER_HALF); + + default: + return parent::__get($name); + } + } + + /** + * Modify to the first occurrence of a given day of the week + * in the current quarter. If no dayOfWeek is provided, modify to the + * first day of the current quarter. Use the supplied constants + * to indicate the desired dayOfWeek, ex. static::MONDAY. + * + * @param int|null $dayOfWeek + * + * @return static + */ + public function firstOfHalf($dayOfWeek = null) + { + return $this->setDate($this->year, $this->half * static::MONTHS_PER_HALF - 5, 1)->firstOfMonth($dayOfWeek); + } + + /** + * Modify to the last occurrence of a given day of the week + * in the current quarter. If no dayOfWeek is provided, modify to the + * last day of the current quarter. Use the supplied constants + * to indicate the desired dayOfWeek, ex. static::MONDAY. + * + * @param int|null $dayOfWeek + * + * @return static + */ + public function lastOfHalf($dayOfWeek = null) + { + return $this->setDate($this->year, $this->half * static::MONTHS_PER_HALF, 1)->lastOfMonth($dayOfWeek); + } +} diff --git a/src/Providers/LeenooksServiceProvider.php b/src/Providers/LeenooksServiceProvider.php new file mode 100644 index 0000000..b7c743a --- /dev/null +++ b/src/Providers/LeenooksServiceProvider.php @@ -0,0 +1,66 @@ +loadViewsFrom($this->_path.'/resources/themes/adminlte/views/', 'adminlte'); +# $this->loadViewsFrom($this->_path.'/resources/views/', 'adminlte'); + $this->loadTranslationsFrom($this->_path.'/resources/themes/adminlte/lang/', 'adminlte_lang'); +//dd($this->views()); + } + + /** + * Register the application services. + * + * @return void + */ + public function register() + { + if (! $this->_path) { + $this->_path = realpath(__DIR__.'/../../'); +define('LEENOOKS',realpath(__DIR__.'/../../')); + } +//$this->publishes($this->views()); + } + + /** + * Views copy path. + * + * @return array + */ + public function views() + { + return [ + LEENOOKS.'/resources/views/auth' => + resource_path('views/vendor/adminlte/auth'), + $this->_path.'/resources/views/errors' => + resource_path('views/vendor/adminlte/errors'), + $this->_path.'/resources/views/layouts' => + resource_path('views/vendor/adminlte/layouts'), + $this->_path.'/resources/views/home.blade.php' => + resource_path('views/vendor/adminlte/home.blade.php'), + $this->_path.'/resources/views/welcome.blade.php' => + resource_path('views/welcome.blade.php'), + ]; + } +} diff --git a/src/Traits/CollectionCollapse.php b/src/Traits/CollectionCollapse.php new file mode 100644 index 0000000..7920ce5 --- /dev/null +++ b/src/Traits/CollectionCollapse.php @@ -0,0 +1,62 @@ +groupBy(function ($item,$key) use ($id) { + $string = ''; + + foreach ($id as $key) { + if ($string AND array_get($item,$key)) + $string .= '.'; + + $string .= $item[$key]; + } + + return $string; + + })->transform(function ($items,$key) use ($consolidateKeys) { + $newitem = []; + + if ($items->count()) { + $c = 0; + + foreach ($items as $item) { + if (! $c++) { + $newitem = $item; + continue; + } + + foreach ($item as $k => $v) { + // Add these values to the existing ones + if (in_array($k, $consolidateKeys)) { + if (!isset($newitem[$k])) + $newitem[$k] = 0; + $newitem[$k] += $v; + } + } + } + + } else { + $newitem = $items; + } + + return $newitem; + }); + } +} \ No newline at end of file diff --git a/src/Traits/ModelCache.php b/src/Traits/ModelCache.php new file mode 100644 index 0000000..04ac552 --- /dev/null +++ b/src/Traits/ModelCache.php @@ -0,0 +1,19 @@ +id)); + } +}