diff --git a/app/Http/Controllers/AdminHomeController.php b/app/Http/Controllers/AdminHomeController.php new file mode 100644 index 0000000..adddcdb --- /dev/null +++ b/app/Http/Controllers/AdminHomeController.php @@ -0,0 +1,60 @@ +validate([ + 'site_name' => 'required|string|max:255', + 'site_email' => 'required|string|email|max:255', + 'site_address1' => 'required|string|max:255', + 'site_address2' => 'nullable|string|max:255', + 'site_city' => 'required|string|max:64', + 'site_state' => 'required|string|max:32', + 'site_postcode' => 'required|string|max:8', + 'site_phone' => 'nullable|regex:/[0-9 ]+/|min:6|max:12', + 'site_fax' => 'nullable|regex:/[0-9 ]+/|min:6|max:12', + ]); + + // If we are more input that sample data, reject the update. + if (config('SITE_SETUP')->allowed_keys(array_keys($request->except('_token')))) + return redirect()->back() + ->withInput() + ->withErrors('Invalid configuration - values not expected.'); + + foreach ($request->except('_token') as $key => $value) + { + if (! $value) { + SiteDetails::where('site_id',config('SITE_SETUP')->id)->where('key',$key)->delete(); + + } else { + try { + + // Update or create our config record. + SiteDetails::updateOrCreate([ + 'site_id'=>config('SITE_SETUP')->id, + 'key'=>$key, + ],[ + 'value'=>$value, + ]); + } catch (\Exception $e) { + dd($e); + } + } + } + + return redirect()->back() + ->with('success','Setup Updated!');; + } +} \ No newline at end of file diff --git a/app/Http/Controllers/UserHomeController.php b/app/Http/Controllers/UserHomeController.php index 30c4f2d..833a41e 100644 --- a/app/Http/Controllers/UserHomeController.php +++ b/app/Http/Controllers/UserHomeController.php @@ -14,17 +14,17 @@ class UserHomeController extends Controller public function home() { switch (Auth::user()->role()) { - case 'Customer': + case 'customer': return View('userhome',['o'=>Auth::user()]); - case 'Reseller': + case 'reseller': return View('resellerhome',['o'=>Auth::user()]); - case 'Wholesaler': + case 'wholesaler': return View('resellerhome',['o'=>Auth::user()]); default: - abort(500,'Unknown role: ',Auth::user()->role()); + abort(500,'Unknown role: '.Auth::user()->role()); } } diff --git a/app/Http/Controllers/UserServicesController.php b/app/Http/Controllers/UserServicesController.php index 18551a6..52cc3d7 100644 --- a/app/Http/Controllers/UserServicesController.php +++ b/app/Http/Controllers/UserServicesController.php @@ -6,10 +6,6 @@ use Auth; class UserServicesController extends Controller { - public function __construct() - { - } - public function invoices() { return ['data'=>Auth::user()->invoices_due->values()]; diff --git a/app/Http/Kernel.php b/app/Http/Kernel.php index ea8d0c9..c508784 100644 --- a/app/Http/Kernel.php +++ b/app/Http/Kernel.php @@ -61,7 +61,7 @@ class Kernel extends HttpKernel 'can' => \Illuminate\Auth\Middleware\Authorize::class, 'demoMode' => \Spatie\DemoMode\DemoMode::class, 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class, - 'reseller' => \App\Http\Middleware\Reseller::class, + 'role' => \App\Http\Middleware\Role::class, 'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class, 'theme' => \Igaster\LaravelTheme\Middleware\setTheme::class, 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, diff --git a/app/Http/Middleware/Reseller.php b/app/Http/Middleware/Reseller.php deleted file mode 100644 index f7bd289..0000000 --- a/app/Http/Middleware/Reseller.php +++ /dev/null @@ -1,19 +0,0 @@ -role(),['Wholesaler','Reseller'])) - { - abort(303,'Not Reseller'); - - } else - return $next($request); - } -} \ No newline at end of file diff --git a/app/Http/Middleware/Role.php b/app/Http/Middleware/Role.php new file mode 100644 index 0000000..709ea32 --- /dev/null +++ b/app/Http/Middleware/Role.php @@ -0,0 +1,31 @@ +role() == $role) + return $next($request); + + break; + + case 'reseller': + if (in_array(Auth::user()->role(),['wholesaler','reseller'])) + return $next($request); + + break; + } + + abort(404,'User doesnt have role?'); + } +} \ No newline at end of file diff --git a/app/Http/Middleware/SetSite.php b/app/Http/Middleware/SetSite.php index b145e2c..95514e7 100644 --- a/app/Http/Middleware/SetSite.php +++ b/app/Http/Middleware/SetSite.php @@ -29,11 +29,9 @@ class SetSite // @todo Figure out how to know if this is an API call - and deny it if it's not in the database. $so = new Site; - if (Schema::hasTable('site')) + if ($so->getTable() AND Schema::hasTable($so->getTable())) { $so = Site::where('url',$request->root()) - ->orwhere('devurl',$request->root()) - // @todo With an API call, we would use ->firstorfail(); ->first(); } diff --git a/app/Models/Site.php b/app/Models/Site.php index 55d3657..ae925ef 100644 --- a/app/Models/Site.php +++ b/app/Models/Site.php @@ -3,16 +3,64 @@ namespace App\Models; use Illuminate\Database\Eloquent\Model; +use Illuminate\Support\Facades\Log; class Site extends Model { protected $table = 'ab_setup'; public $timestamps = FALSE; + protected $with = ['details']; + protected $casts = [ 'address'=>'array', ]; + public function details() + { + return $this->hasMany(SiteDetails::class); + } + + public function __get($key) + { + // @todo Not sure if this is functioning correctly? + if ($parent = parent::__get($key)) + return $parent; + + // Deprecated Items + if (! in_array($key,array_keys($this->_sampledata()))) + { + Log::alert('No sample data for Key:',['key'=>$key]); + return NULL; + } + + $detail = $this->details->where('key',$key)->first(); + + if ($detail) { + return $detail->value; + } + + // Suppress some default values + $optional = [ + 'block_quotes', + 'clients', + 'page_tabs', + 'services', + 'site_description', + 'site_fax', + 'site_address2', + 'site_slider', + 'steps', + 'testimonials', + ]; + + if (in_array($key,$optional)) + return ''; + + Log::alert('Calling unknown Site Key:',['key'=>$key]); + return array_get($this->_sampledata(),$key); + } + /** * Pre-load this model with Sample Data, if there is no database record */ @@ -72,7 +120,26 @@ class Site extends Model ], ], 'clients_intro'=>'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore', - 'main_slider'=>[ + 'page_tabs'=>[ + [ + 'title'=>'Title 1', + 'image'=>'/image/generic/200/100/999', + 'text'=>'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua', + + ], + [ + 'title'=>'Title 2', + 'image'=>'/image/generic/200/100/799', + 'text'=>'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua', + + ], + [ + 'title'=>'Title 3', + 'image'=>'/image/generic/200/100/979', + 'text'=>'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua', + ], + ], + 'site_slider'=>[ [ 'title'=>'Header
and Title', 'text'=>'This is what you were looking for', @@ -97,40 +164,21 @@ class Site extends Model //'button'=>['text'=>'Purchase Now','url'=>'#'], ], ], - 'page_tabs'=>[ - [ - 'title'=>'Title 1', - 'image'=>'/image/generic/200/100/999', - 'text'=>'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua', - - ], - [ - 'title'=>'Title 2', - 'image'=>'/image/generic/200/100/799', - 'text'=>'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua', - - ], - [ - 'title'=>'Title 3', - 'image'=>'/image/generic/200/100/979', - 'text'=>'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua', - ], - ], 'site'=>[ 'id'=>NULL, - 'address'=>json_decode('{"address1":"PO Box 149","address2":"7 Woodlands Court","city":"Bendigo","state":"VIC","postcode":"3550"}'), - 'address1'=>'Building Name', - 'address2'=>'123 Road Street', - 'city'=>'City', - 'description'=>'Example Site', - 'email'=>'nobody@example.com', - 'fax'=>'+0 1 2345 6789', 'logo'=>route('image',['width'=>128,'height'=>32,'color'=>'eee']), - 'name'=>'Example', - 'postalcode'=>'123 456', - 'phone'=>'+0 1 2345 6789', - 'state'=>'State', ], + 'site_address1'=>'Building Name', + 'site_address2'=>NULL, + 'site_city'=>'City', + 'site_description'=>'Example Site', + 'site_email'=>'nobody@example.com', + 'site_fax'=>'+0 1 2345 6789', + 'site_name'=>'Example', + 'site_phone'=>'+0 1 2345 6789', + 'site_postcode'=>'123 456', + 'site_state'=>'State', + 'site_tax'=>'12 123 123 123', 'services'=>[ ['title'=>'Title 1','text'=>'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.','icon'=>'fa fa-location-arrow blue','image'=>NULL], ['title'=>'Title 2','text'=>'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.','icon'=>'fa fa-compress green','image'=>NULL], @@ -182,66 +230,6 @@ class Site extends Model ]; } - public function getActivitiesAttribute() - { - return array_get($this->_sampledata(),'activity'); - } - - public function getActivityIntroAttribute() - { - return array_get($this->_sampledata(),'activity_intro'); - } - - public function getClientsAttribute() - { - return array_get($this->_sampledata(),'clients'); - } - - public function getCLientsIntoAttribute() - { - return array_get($this->_sampledata(),'clients_info'); - } - - public function getServicesAttribute() - { - return array_get($this->_sampledata(),'services'); - } - - public function getBlockQuotesAttribute() - { - return array_get($this->_sampledata(),'block_quotes'); - } - - public function getPageTabsAttribute() - { - return array_get($this->_sampledata(),'page_tabs'); - } - - public function getSiteSliderAttribute() - { - return array_get($this->_sampledata(),'main_slider'); - } - - public function getSocialAttribute() - { - return array_get($this->_sampledata(),'social'); - } - - public function getStepsAttribute() - { - return array_get($this->_sampledata(),'steps'); - } - - public function getTestimonialsAttribute() - { - return array_get($this->_sampledata(),'testimonials'); - } - - public function getTopMenuAttribute() - { - return array_get($this->_sampledata(),'top_menu'); - } - public function sample() { return $this->forceFill(array_get($this->_sampledata(),'site')); @@ -257,12 +245,12 @@ class Site extends Model { $return = []; - if ($this->address1) - array_push($return,$this->address1); - if ($this->address2) - array_push($return,$this->address2); - if ($this->city) - array_push($return,sprintf('%s %s %s',$this->city.(($this->state OR $this->postalcode) ? ',' : ''),$this->state,$this->postalcode)); + if ($this->site_address1) + array_push($return,$this->site_address1); + if ($this->site_address2) + array_push($return,$this->site_address2); + if ($this->site_city) + array_push($return,sprintf('%s %s %s',$this->site_city.(($this->site_state OR $this->site_postcode) ? ',' : ''),$this->site_state,$this->site_postcode)); if (! $return) $return = ['No Address']; @@ -270,6 +258,11 @@ class Site extends Model return $return; } + public function allowed_keys(array $keys=[]) + { + return $keys ? array_diff($keys,array_keys($this->_sampledata())) : array_keys($this->_sampledata()); + } + public function address($type='plain') { switch ($type) @@ -282,10 +275,6 @@ class Site extends Model } } - public function fax() - { - return '@todo'; - } public function logo_url() { return url($this->logo ? $this->logo : '/image/generic/150/20/fff'); diff --git a/app/Models/SiteDetails.php b/app/Models/SiteDetails.php new file mode 100644 index 0000000..9437f96 --- /dev/null +++ b/app/Models/SiteDetails.php @@ -0,0 +1,22 @@ +belongsTo(Site::class); + } +} \ No newline at end of file diff --git a/app/User.php b/app/User.php index 442f2d5..f538ba9 100644 --- a/app/User.php +++ b/app/User.php @@ -213,14 +213,14 @@ class User extends Authenticatable { // If I have agents and no parent, I am the wholesaler if (is_null($this->parent_id) AND $this->all_agents()->count()) - return 'Wholesaler'; + return 'wholesaler'; // If I have agents and a parent, I am a reseller elseif ($this->parent_id AND $this->all_agents()->count()) - return 'Reseller'; + return 'reseller'; // If I have no agents and a parent, I am a customer elseif (! $this->all_agents()->count()) - return 'Customer'; + return 'customer'; } } \ No newline at end of file diff --git a/composer.lock b/composer.lock index 9f8b031..1dda2a6 100644 --- a/composer.lock +++ b/composer.lock @@ -2369,11 +2369,11 @@ }, { "name": "leenooks/laravel", - "version": "0.1.7", + "version": "0.1.9", "source": { "type": "git", "url": "https://dev.leenooks.net/leenooks/laravel", - "reference": "ac867a25265d07476967eef7d01516a92b9f2b73" + "reference": "444c159ab911819e818a7f8a1f0aaf59dfdd58d1" }, "require": { "igaster/laravel-theme": "2.0.6", @@ -2409,7 +2409,7 @@ "laravel", "leenooks" ], - "time": "2018-07-13T04:39:10+00:00" + "time": "2018-07-31T02:56:29+00:00" }, { "name": "maximebf/debugbar", diff --git a/database/migrations/2018_07_28_234942_create_site_details.php b/database/migrations/2018_07_28_234942_create_site_details.php new file mode 100644 index 0000000..a71db7e --- /dev/null +++ b/database/migrations/2018_07_28_234942_create_site_details.php @@ -0,0 +1,35 @@ +integer('site_id'); + $table->string('key'); + $table->json('value'); + + $table->foreign('site_id')->references('id')->on('ab_setup'); + $table->unique(['site_id','key']); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('site_details'); + } +} diff --git a/public/js/jqBootstrapValidation.js b/public/js/jqBootstrapValidation.js new file mode 100644 index 0000000..29cbb08 --- /dev/null +++ b/public/js/jqBootstrapValidation.js @@ -0,0 +1,912 @@ +/* jqBootstrapValidation + * A plugin for automating validation on Twitter Bootstrap formatted forms. + * + * v1.3.6 + * + * License: MIT - see LICENSE file + * + * http://ReactiveRaven.github.com/jqBootstrapValidation/ + */ + +(function( $ ){ + + var createdElements = []; + + var defaults = { + options: { + prependExistingHelpBlock: false, + sniffHtml: true, // sniff for 'required', 'maxlength', etc + preventSubmit: true, // stop the form submit event from firing if validation fails + submitError: false, // function called if there is an error when trying to submit + submitSuccess: false, // function called just before a successful submit event is sent to the server + semanticallyStrict: false, // set to true to tidy up generated HTML output + autoAdd: { + helpBlocks: true + }, + filter: function () { + // return $(this).is(":visible"); // only validate elements you can see + return true; // validate everything + } + }, + methods: { + init : function( options ) { + + var settings = $.extend(true, {}, defaults); + + settings.options = $.extend(true, settings.options, options); + + var $siblingElements = this; + + var uniqueForms = $.unique( + $siblingElements.map( function () { + return $(this).parents("form")[0]; + }).toArray() + ); + + $(uniqueForms).bind("submit", function (e) { + var $form = $(this); + var warningsFound = 0; + var $inputs = $form.find("input,textarea,select").not("[type=submit],[type=image]").filter(settings.options.filter); + $inputs.trigger("submit.validation").trigger("validationLostFocus.validation"); + + $inputs.each(function (i, el) { + var $this = $(el), + $controlGroup = $this.parents(".control-group").first(); + if ( + $controlGroup.hasClass("warning") + ) { + $controlGroup.removeClass("warning").addClass("error"); + warningsFound++; + } + }); + + $inputs.trigger("validationLostFocus.validation"); + + if (warningsFound) { + if (settings.options.preventSubmit) { + e.preventDefault(); + } + $form.addClass("error"); + if ($.isFunction(settings.options.submitError)) { + settings.options.submitError($form, e, $inputs.jqBootstrapValidation("collectErrors", true)); + } + } else { + $form.removeClass("error"); + if ($.isFunction(settings.options.submitSuccess)) { + settings.options.submitSuccess($form, e); + } + } + }); + + return this.each(function(){ + + // Get references to everything we're interested in + var $this = $(this), + $controlGroup = $this.parents(".control-group").first(), + $helpBlock = $controlGroup.find(".help-block").first(), + $form = $this.parents("form").first(), + validatorNames = []; + + // create message container if not exists + if (!$helpBlock.length && settings.options.autoAdd && settings.options.autoAdd.helpBlocks) { + $helpBlock = $('
'); + $controlGroup.find('.controls').append($helpBlock); + createdElements.push($helpBlock[0]); + } + + // ============================================================= + // SNIFF HTML FOR VALIDATORS + // ============================================================= + + // *snort sniff snuffle* + + if (settings.options.sniffHtml) { + var message = ""; + // --------------------------------------------------------- + // PATTERN + // --------------------------------------------------------- + if ($this.attr("pattern") !== undefined) { + message = "Not in the expected format"; + if ($this.data("validationPatternMessage")) { + message = $this.data("validationPatternMessage"); + } + $this.data("validationPatternMessage", message); + $this.data("validationPatternRegex", $this.attr("pattern")); + } + // --------------------------------------------------------- + // MAX + // --------------------------------------------------------- + if ($this.attr("max") !== undefined || $this.attr("aria-valuemax") !== undefined) { + var max = ($this.attr("max") !== undefined ? $this.attr("max") : $this.attr("aria-valuemax")); + message = "Too high: Maximum of '" + max + "'"; + if ($this.data("validationMaxMessage")) { + message = $this.data("validationMaxMessage"); + } + $this.data("validationMaxMessage", message); + $this.data("validationMaxMax", max); + } + // --------------------------------------------------------- + // MIN + // --------------------------------------------------------- + if ($this.attr("min") !== undefined || $this.attr("aria-valuemin") !== undefined) { + var min = ($this.attr("min") !== undefined ? $this.attr("min") : $this.attr("aria-valuemin")); + message = "Too low: Minimum of '" + min + "'"; + if ($this.data("validationMinMessage")) { + message = $this.data("validationMinMessage"); + } + $this.data("validationMinMessage", message); + $this.data("validationMinMin", min); + } + // --------------------------------------------------------- + // MAXLENGTH + // --------------------------------------------------------- + if ($this.attr("maxlength") !== undefined) { + message = "Too long: Maximum of '" + $this.attr("maxlength") + "' characters"; + if ($this.data("validationMaxlengthMessage")) { + message = $this.data("validationMaxlengthMessage"); + } + $this.data("validationMaxlengthMessage", message); + $this.data("validationMaxlengthMaxlength", $this.attr("maxlength")); + } + // --------------------------------------------------------- + // MINLENGTH + // --------------------------------------------------------- + if ($this.attr("minlength") !== undefined) { + message = "Too short: Minimum of '" + $this.attr("minlength") + "' characters"; + if ($this.data("validationMinlengthMessage")) { + message = $this.data("validationMinlengthMessage"); + } + $this.data("validationMinlengthMessage", message); + $this.data("validationMinlengthMinlength", $this.attr("minlength")); + } + // --------------------------------------------------------- + // REQUIRED + // --------------------------------------------------------- + if ($this.attr("required") !== undefined || $this.attr("aria-required") !== undefined) { + message = settings.builtInValidators.required.message; + if ($this.data("validationRequiredMessage")) { + message = $this.data("validationRequiredMessage"); + } + $this.data("validationRequiredMessage", message); + } + // --------------------------------------------------------- + // NUMBER + // --------------------------------------------------------- + if ($this.attr("type") !== undefined && $this.attr("type").toLowerCase() === "number") { + message = settings.builtInValidators.number.message; + if ($this.data("validationNumberMessage")) { + message = $this.data("validationNumberMessage"); + } + $this.data("validationNumberMessage", message); + } + // --------------------------------------------------------- + // EMAIL + // --------------------------------------------------------- + if ($this.attr("type") !== undefined && $this.attr("type").toLowerCase() === "email") { + message = "Not a valid email address"; + if ($this.data("validationValidemailMessage")) { + message = $this.data("validationValidemailMessage"); + } else if ($this.data("validationEmailMessage")) { + message = $this.data("validationEmailMessage"); + } + $this.data("validationValidemailMessage", message); + } + // --------------------------------------------------------- + // MINCHECKED + // --------------------------------------------------------- + if ($this.attr("minchecked") !== undefined) { + message = "Not enough options checked; Minimum of '" + $this.attr("minchecked") + "' required"; + if ($this.data("validationMincheckedMessage")) { + message = $this.data("validationMincheckedMessage"); + } + $this.data("validationMincheckedMessage", message); + $this.data("validationMincheckedMinchecked", $this.attr("minchecked")); + } + // --------------------------------------------------------- + // MAXCHECKED + // --------------------------------------------------------- + if ($this.attr("maxchecked") !== undefined) { + message = "Too many options checked; Maximum of '" + $this.attr("maxchecked") + "' required"; + if ($this.data("validationMaxcheckedMessage")) { + message = $this.data("validationMaxcheckedMessage"); + } + $this.data("validationMaxcheckedMessage", message); + $this.data("validationMaxcheckedMaxchecked", $this.attr("maxchecked")); + } + } + + // ============================================================= + // COLLECT VALIDATOR NAMES + // ============================================================= + + // Get named validators + if ($this.data("validation") !== undefined) { + validatorNames = $this.data("validation").split(","); + } + + // Get extra ones defined on the element's data attributes + $.each($this.data(), function (i, el) { + var parts = i.replace(/([A-Z])/g, ",$1").split(","); + if (parts[0] === "validation" && parts[1]) { + validatorNames.push(parts[1]); + } + }); + + // ============================================================= + // NORMALISE VALIDATOR NAMES + // ============================================================= + + var validatorNamesToInspect = validatorNames; + var newValidatorNamesToInspect = []; + + do // repeatedly expand 'shortcut' validators into their real validators + { + // Uppercase only the first letter of each name + $.each(validatorNames, function (i, el) { + validatorNames[i] = formatValidatorName(el); + }); + + // Remove duplicate validator names + validatorNames = $.unique(validatorNames); + + // Pull out the new validator names from each shortcut + newValidatorNamesToInspect = []; + $.each(validatorNamesToInspect, function(i, el) { + if ($this.data("validation" + el + "Shortcut") !== undefined) { + // Are these custom validators? + // Pull them out! + $.each($this.data("validation" + el + "Shortcut").split(","), function(i2, el2) { + newValidatorNamesToInspect.push(el2); + }); + } else if (settings.builtInValidators[el.toLowerCase()]) { + // Is this a recognised built-in? + // Pull it out! + var validator = settings.builtInValidators[el.toLowerCase()]; + if (validator.type.toLowerCase() === "shortcut") { + $.each(validator.shortcut.split(","), function (i, el) { + el = formatValidatorName(el); + newValidatorNamesToInspect.push(el); + validatorNames.push(el); + }); + } + } + }); + + validatorNamesToInspect = newValidatorNamesToInspect; + + } while (validatorNamesToInspect.length > 0) + + // ============================================================= + // SET UP VALIDATOR ARRAYS + // ============================================================= + + var validators = {}; + + $.each(validatorNames, function (i, el) { + // Set up the 'override' message + var message = $this.data("validation" + el + "Message"); + var hasOverrideMessage = (message !== undefined); + var foundValidator = false; + message = + ( + message + ? message + : "'" + el + "' validation failed " + ) + ; + + $.each( + settings.validatorTypes, + function (validatorType, validatorTemplate) { + if (validators[validatorType] === undefined) { + validators[validatorType] = []; + } + if (!foundValidator && $this.data("validation" + el + formatValidatorName(validatorTemplate.name)) !== undefined) { + validators[validatorType].push( + $.extend( + true, + { + name: formatValidatorName(validatorTemplate.name), + message: message + }, + validatorTemplate.init($this, el) + ) + ); + foundValidator = true; + } + } + ); + + if (!foundValidator && settings.builtInValidators[el.toLowerCase()]) { + + var validator = $.extend(true, {}, settings.builtInValidators[el.toLowerCase()]); + if (hasOverrideMessage) { + validator.message = message; + } + var validatorType = validator.type.toLowerCase(); + + if (validatorType === "shortcut") { + foundValidator = true; + } else { + $.each( + settings.validatorTypes, + function (validatorTemplateType, validatorTemplate) { + if (validators[validatorTemplateType] === undefined) { + validators[validatorTemplateType] = []; + } + if (!foundValidator && validatorType === validatorTemplateType.toLowerCase()) { + $this.data("validation" + el + formatValidatorName(validatorTemplate.name), validator[validatorTemplate.name.toLowerCase()]); + validators[validatorType].push( + $.extend( + validator, + validatorTemplate.init($this, el) + ) + ); + foundValidator = true; + } + } + ); + } + } + + if (! foundValidator) { + $.error("Cannot find validation info for '" + el + "'"); + } + }); + + // ============================================================= + // STORE FALLBACK VALUES + // ============================================================= + + $helpBlock.data( + "original-contents", + ( + $helpBlock.data("original-contents") + ? $helpBlock.data("original-contents") + : $helpBlock.html() + ) + ); + + $helpBlock.data( + "original-role", + ( + $helpBlock.data("original-role") + ? $helpBlock.data("original-role") + : $helpBlock.attr("role") + ) + ); + + $controlGroup.data( + "original-classes", + ( + $controlGroup.data("original-clases") + ? $controlGroup.data("original-classes") + : $controlGroup.attr("class") + ) + ); + + $this.data( + "original-aria-invalid", + ( + $this.data("original-aria-invalid") + ? $this.data("original-aria-invalid") + : $this.attr("aria-invalid") + ) + ); + + // ============================================================= + // VALIDATION + // ============================================================= + + $this.bind( + "validation.validation", + function (event, params) { + + var value = getValue($this); + + // Get a list of the errors to apply + var errorsFound = []; + + $.each(validators, function (validatorType, validatorTypeArray) { + if (value || value.length || (params && params.includeEmpty) || (!!settings.validatorTypes[validatorType].blockSubmit && params && !!params.submitting)) { + $.each(validatorTypeArray, function (i, validator) { + if (settings.validatorTypes[validatorType].validate($this, value, validator)) { + errorsFound.push(validator.message); + } + }); + } + }); + + return errorsFound; + } + ); + + $this.bind( + "getValidators.validation", + function () { + return validators; + } + ); + + // ============================================================= + // WATCH FOR CHANGES + // ============================================================= + $this.bind( + "submit.validation", + function () { + return $this.triggerHandler("change.validation", {submitting: true}); + } + ); + $this.bind( + [ + "keyup", + "focus", + "blur", + "click", + "keydown", + "keypress", + "change" + ].join(".validation ") + ".validation", + function (e, params) { + + var value = getValue($this); + + var errorsFound = []; + + $controlGroup.find("input,textarea,select").each(function (i, el) { + var oldCount = errorsFound.length; + $.each($(el).triggerHandler("validation.validation", params), function (j, message) { + errorsFound.push(message); + }); + if (errorsFound.length > oldCount) { + $(el).attr("aria-invalid", "true"); + } else { + var original = $this.data("original-aria-invalid"); + $(el).attr("aria-invalid", (original !== undefined ? original : false)); + } + }); + + $form.find("input,select,textarea").not($this).not("[name=\"" + $this.attr("name") + "\"]").trigger("validationLostFocus.validation"); + + errorsFound = $.unique(errorsFound.sort()); + + // Were there any errors? + if (errorsFound.length) { + // Better flag it up as a warning. + $controlGroup.removeClass("success error").addClass("warning"); + + // How many errors did we find? + if (settings.options.semanticallyStrict && errorsFound.length === 1) { + // Only one? Being strict? Just output it. + $helpBlock.html(errorsFound[0] + + ( settings.options.prependExistingHelpBlock ? $helpBlock.data("original-contents") : "" )); + } else { + // Multiple? Being sloppy? Glue them together into an UL. + $helpBlock.html("" + + ( settings.options.prependExistingHelpBlock ? $helpBlock.data("original-contents") : "" )); + } + } else { + $controlGroup.removeClass("warning error success"); + if (value.length > 0) { + $controlGroup.addClass("success"); + } + $helpBlock.html($helpBlock.data("original-contents")); + } + + if (e.type === "blur") { + $controlGroup.removeClass("success"); + } + } + ); + $this.bind("validationLostFocus.validation", function () { + $controlGroup.removeClass("success"); + }); + }); + }, + destroy : function( ) { + + return this.each( + function() { + + var + $this = $(this), + $controlGroup = $this.parents(".control-group").first(), + $helpBlock = $controlGroup.find(".help-block").first(); + + // remove our events + $this.unbind('.validation'); // events are namespaced. + // reset help text + $helpBlock.html($helpBlock.data("original-contents")); + // reset classes + $controlGroup.attr("class", $controlGroup.data("original-classes")); + // reset aria + $this.attr("aria-invalid", $this.data("original-aria-invalid")); + // reset role + $helpBlock.attr("role", $this.data("original-role")); + // remove all elements we created + if (createdElements.indexOf($helpBlock[0]) > -1) { + $helpBlock.remove(); + } + + } + ); + + }, + collectErrors : function(includeEmpty) { + + var errorMessages = {}; + this.each(function (i, el) { + var $el = $(el); + var name = $el.attr("name"); + var errors = $el.triggerHandler("validation.validation", {includeEmpty: true}); + errorMessages[name] = $.extend(true, errors, errorMessages[name]); + }); + + $.each(errorMessages, function (i, el) { + if (el.length === 0) { + delete errorMessages[i]; + } + }); + + return errorMessages; + + }, + hasErrors: function() { + + var errorMessages = []; + + this.each(function (i, el) { + errorMessages = errorMessages.concat( + $(el).triggerHandler("getValidators.validation") ? $(el).triggerHandler("validation.validation", {submitting: true}) : [] + ); + }); + + return (errorMessages.length > 0); + }, + override : function (newDefaults) { + defaults = $.extend(true, defaults, newDefaults); + } + }, + validatorTypes: { + callback: { + name: "callback", + init: function ($this, name) { + return { + validatorName: name, + callback: $this.data("validation" + name + "Callback"), + lastValue: $this.val(), + lastValid: true, + lastFinished: true + }; + }, + validate: function ($this, value, validator) { + if (validator.lastValue === value && validator.lastFinished) { + return !validator.lastValid; + } + + if (validator.lastFinished === true) + { + validator.lastValue = value; + validator.lastValid = true; + validator.lastFinished = false; + + var rrjqbvValidator = validator; + var rrjqbvThis = $this; + executeFunctionByName( + validator.callback, + window, + $this, + value, + function (data) { + if (rrjqbvValidator.lastValue === data.value) { + rrjqbvValidator.lastValid = data.valid; + if (data.message) { + rrjqbvValidator.message = data.message; + } + rrjqbvValidator.lastFinished = true; + rrjqbvThis.data("validation" + rrjqbvValidator.validatorName + "Message", rrjqbvValidator.message); + // Timeout is set to avoid problems with the events being considered 'already fired' + setTimeout(function () { + rrjqbvThis.trigger("change.validation"); + }, 1); // doesn't need a long timeout, just long enough for the event bubble to burst + } + } + ); + } + + return false; + + } + }, + ajax: { + name: "ajax", + init: function ($this, name) { + return { + validatorName: name, + url: $this.data("validation" + name + "Ajax"), + lastValue: $this.val(), + lastValid: true, + lastFinished: true + }; + }, + validate: function ($this, value, validator) { + if (""+validator.lastValue === ""+value && validator.lastFinished === true) { + return validator.lastValid === false; + } + + if (validator.lastFinished === true) + { + validator.lastValue = value; + validator.lastValid = true; + validator.lastFinished = false; + $.ajax({ + url: validator.url, + data: "value=" + value + "&field=" + $this.attr("name"), + dataType: "json", + success: function (data) { + if (""+validator.lastValue === ""+data.value) { + validator.lastValid = !!(data.valid); + if (data.message) { + validator.message = data.message; + } + validator.lastFinished = true; + $this.data("validation" + validator.validatorName + "Message", validator.message); + // Timeout is set to avoid problems with the events being considered 'already fired' + setTimeout(function () { + $this.trigger("change.validation"); + }, 1); // doesn't need a long timeout, just long enough for the event bubble to burst + } + }, + failure: function () { + validator.lastValid = true; + validator.message = "ajax call failed"; + validator.lastFinished = true; + $this.data("validation" + validator.validatorName + "Message", validator.message); + // Timeout is set to avoid problems with the events being considered 'already fired' + setTimeout(function () { + $this.trigger("change.validation"); + }, 1); // doesn't need a long timeout, just long enough for the event bubble to burst + } + }); + } + + return false; + + } + }, + regex: { + name: "regex", + init: function ($this, name) { + return {regex: regexFromString($this.data("validation" + name + "Regex"))}; + }, + validate: function ($this, value, validator) { + return (!validator.regex.test(value) && ! validator.negative) + || (validator.regex.test(value) && validator.negative); + } + }, + required: { + name: "required", + init: function ($this, name) { + return {}; + }, + validate: function ($this, value, validator) { + return !!(value.length === 0 && ! validator.negative) + || !!(value.length > 0 && validator.negative); + }, + blockSubmit: true + }, + match: { + name: "match", + init: function ($this, name) { + var element = $this.parents("form").first().find("[name=\"" + $this.data("validation" + name + "Match") + "\"]").first(); + element.bind("validation.validation", function () { + $this.trigger("change.validation", {submitting: true}); + }); + return {"element": element}; + }, + validate: function ($this, value, validator) { + return (value !== validator.element.val() && ! validator.negative) + || (value === validator.element.val() && validator.negative); + }, + blockSubmit: true + }, + max: { + name: "max", + init: function ($this, name) { + return {max: $this.data("validation" + name + "Max")}; + }, + validate: function ($this, value, validator) { + return (parseFloat(value, 10) > parseFloat(validator.max, 10) && ! validator.negative) + || (parseFloat(value, 10) <= parseFloat(validator.max, 10) && validator.negative); + } + }, + min: { + name: "min", + init: function ($this, name) { + return {min: $this.data("validation" + name + "Min")}; + }, + validate: function ($this, value, validator) { + return (parseFloat(value) < parseFloat(validator.min) && ! validator.negative) + || (parseFloat(value) >= parseFloat(validator.min) && validator.negative); + } + }, + maxlength: { + name: "maxlength", + init: function ($this, name) { + return {maxlength: $this.data("validation" + name + "Maxlength")}; + }, + validate: function ($this, value, validator) { + return ((value.length > validator.maxlength) && ! validator.negative) + || ((value.length <= validator.maxlength) && validator.negative); + } + }, + minlength: { + name: "minlength", + init: function ($this, name) { + return {minlength: $this.data("validation" + name + "Minlength")}; + }, + validate: function ($this, value, validator) { + return ((value.length < validator.minlength) && ! validator.negative) + || ((value.length >= validator.minlength) && validator.negative); + } + }, + maxchecked: { + name: "maxchecked", + init: function ($this, name) { + var elements = $this.parents("form").first().find("[name=\"" + $this.attr("name") + "\"]"); + elements.bind("click.validation", function () { + $this.trigger("change.validation", {includeEmpty: true}); + }); + return {maxchecked: $this.data("validation" + name + "Maxchecked"), elements: elements}; + }, + validate: function ($this, value, validator) { + return (validator.elements.filter(":checked").length > validator.maxchecked && ! validator.negative) + || (validator.elements.filter(":checked").length <= validator.maxchecked && validator.negative); + }, + blockSubmit: true + }, + minchecked: { + name: "minchecked", + init: function ($this, name) { + var elements = $this.parents("form").first().find("[name=\"" + $this.attr("name") + "\"]"); + elements.bind("click.validation", function () { + $this.trigger("change.validation", {includeEmpty: true}); + }); + return {minchecked: $this.data("validation" + name + "Minchecked"), elements: elements}; + }, + validate: function ($this, value, validator) { + return (validator.elements.filter(":checked").length < validator.minchecked && ! validator.negative) + || (validator.elements.filter(":checked").length >= validator.minchecked && validator.negative); + }, + blockSubmit: true + } + }, + builtInValidators: { + email: { + name: "Email", + type: "shortcut", + shortcut: "validemail" + }, + validemail: { + name: "Validemail", + type: "regex", + regex: "[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\\.[A-Za-z]{2,4}", + message: "Not a valid email address" + }, + passwordagain: { + name: "Passwordagain", + type: "match", + match: "password", + message: "Does not match the given password" + }, + positive: { + name: "Positive", + type: "shortcut", + shortcut: "number,positivenumber" + }, + negative: { + name: "Negative", + type: "shortcut", + shortcut: "number,negativenumber" + }, + number: { + name: "Number", + type: "regex", + regex: "([+-]?\\\d+(\\\.\\\d*)?([eE][+-]?[0-9]+)?)?", + message: "Must be a number" + }, + integer: { + name: "Integer", + type: "regex", + regex: "[+-]?\\\d+", + message: "No decimal places allowed" + }, + positivenumber: { + name: "Positivenumber", + type: "min", + min: 0, + message: "Must be a positive number" + }, + negativenumber: { + name: "Negativenumber", + type: "max", + max: 0, + message: "Must be a negative number" + }, + required: { + name: "Required", + type: "required", + message: "This is required" + }, + checkone: { + name: "Checkone", + type: "minchecked", + minchecked: 1, + message: "Check at least one option" + } + } + }; + + var formatValidatorName = function (name) { + return name + .toLowerCase() + .replace( + /(^|\s)([a-z])/g , + function(m,p1,p2) { + return p1+p2.toUpperCase(); + } + ) + ; + }; + + var getValue = function ($this) { + // Extract the value we're talking about + var value = $this.val(); + var type = $this.attr("type"); + if (type === "checkbox") { + value = ($this.is(":checked") ? value : ""); + } + if (type === "radio") { + value = ($('input[name="' + $this.attr("name") + '"]:checked').length > 0 ? value : ""); + } + return value; + }; + + function regexFromString(inputstring) { + return new RegExp("^" + inputstring + "$"); + } + + /** + * Thanks to Jason Bunting via StackOverflow.com + * + * http://stackoverflow.com/questions/359788/how-to-execute-a-javascript-function-when-i-have-its-name-as-a-string#answer-359910 + * Short link: http://tinyurl.com/executeFunctionByName + **/ + function executeFunctionByName(functionName, context /*, args*/) { + var args = Array.prototype.slice.call(arguments).splice(2); + var namespaces = functionName.split("."); + var func = namespaces.pop(); + for(var i = 0; i < namespaces.length; i++) { + context = context[namespaces[i]]; + } + return context[func].apply(this, args); + } + + $.fn.jqBootstrapValidation = function( method ) { + + if ( defaults.methods[method] ) { + return defaults.methods[method].apply( this, Array.prototype.slice.call( arguments, 1 )); + } else if ( typeof method === 'object' || ! method ) { + return defaults.methods.init.apply( this, arguments ); + } else { + $.error( 'Method ' + method + ' does not exist on jQuery.jqBootstrapValidation' ); + return null; + } + + }; + + $.jqBootstrapValidation = function (options) { + $(":input").not("[type=image],[type=submit]").jqBootstrapValidation.apply(this,arguments); + }; + +})( jQuery ); diff --git a/resources/theme/backend/adminlte/a/setup.blade.php b/resources/theme/backend/adminlte/a/setup.blade.php new file mode 100644 index 0000000..d29257b --- /dev/null +++ b/resources/theme/backend/adminlte/a/setup.blade.php @@ -0,0 +1,87 @@ +@extends('adminlte::layouts.app') + +@section('htmlheader_title') + Setup +@endsection + +@section('contentheader_title') + {{ $so->site_name }} +@endsection +@section('contentheader_description') + Setup +@endsection + +@section('main-content') +
+
+
+

Setup Configuration

+
+ +
+ {{ csrf_field() }} + + @if(session()->has('success')) +
+
+
+

{{ session()->get('success') }}

+
+
+
+ @endif + + @if($errors->any()) +
+
+
+

Some validation errors to look at.

+
    + @foreach ($errors->all() as $error) +
  • {{ $error }}
  • + @endforeach +
+
+
+
+ @endif + + +
+
+
+@endsection + +@section('page-scripts') + @js('/js/jqBootstrapValidation.js','jq-validation','jquery') + + +@append \ No newline at end of file diff --git a/resources/theme/backend/adminlte/a/widgets/setup_site_details.blade.php b/resources/theme/backend/adminlte/a/widgets/setup_site_details.blade.php new file mode 100644 index 0000000..78d3945 --- /dev/null +++ b/resources/theme/backend/adminlte/a/widgets/setup_site_details.blade.php @@ -0,0 +1,61 @@ +
+ + + {{ $errors->first('site_name') }} +
+ +
+ + + {{ $errors->first('site_description') }} +
+ +
+ + +
+ + + + {{ $errors->first('site_address1') }} {{ $errors->first('site_address2') }} +
+
+ + + {{ $errors->first('site_city') }} +
+
+ + + {{ $errors->first('site_state') }} +
+
+ + + {{ $errors->first('site_postcode') }} +
+
+ +
+ + + {{ $errors->first('site_phone') }} +
+
+ + + {{ $errors->first('site_fax') }} +
+
+ + + {{ $errors->first('site_email') }} +
+
+ +
+ ABN + +
+ {{ $errors->first('site_tax') }} +
\ No newline at end of file diff --git a/resources/theme/backend/adminlte/resellerhome.blade.php b/resources/theme/backend/adminlte/resellerhome.blade.php index a435556..0481941 100644 --- a/resources/theme/backend/adminlte/resellerhome.blade.php +++ b/resources/theme/backend/adminlte/resellerhome.blade.php @@ -12,14 +12,10 @@ @endsection @section('main-content') -
-
-
- @include('r.agents') -
-
- @include('r.accounts') -
-
+
+ @include('r.agents') +
+
+ @include('r.accounts')
@endsection \ No newline at end of file diff --git a/resources/theme/frontend/metronic/layouts/app.blade.php b/resources/theme/frontend/metronic/layouts/app.blade.php index 78fdf54..16d80f0 100644 --- a/resources/theme/frontend/metronic/layouts/app.blade.php +++ b/resources/theme/frontend/metronic/layouts/app.blade.php @@ -49,4 +49,4 @@ - + \ No newline at end of file diff --git a/resources/theme/frontend/metronic/layouts/partials/footer.blade.php b/resources/theme/frontend/metronic/layouts/partials/footer.blade.php index d5196f6..d2fda4b 100644 --- a/resources/theme/frontend/metronic/layouts/partials/footer.blade.php +++ b/resources/theme/frontend/metronic/layouts/partials/footer.blade.php @@ -24,12 +24,11 @@

Our Contacts

- - - @if($so->fax) - + + @if($so->site_fax) + @endif - +
Address{!! join('
',[$so->address['address1'],$so->address['address2'],sprintf('%s, %s %s',$so->address['city'],$so->address['state'],$so->address['postcode'])]) !!}
Phone{!! $so->phone !!}
Fax{!! $so->fax !!}
Address{!! $so->address('html') !!}
Fax{{ $so->site_fax }}
Email {!! $so->email !!}
Email {{ $so->site_email }}
@@ -9,7 +9,7 @@ - + diff --git a/resources/theme/frontend/metronic/layouts/partials/mainheader.blade.php b/resources/theme/frontend/metronic/layouts/partials/mainheader.blade.php index 9927f5b..8adaf9d 100644 --- a/resources/theme/frontend/metronic/layouts/partials/mainheader.blade.php +++ b/resources/theme/frontend/metronic/layouts/partials/mainheader.blade.php @@ -5,8 +5,8 @@
    -
  • {!! $so->phone !!}
  • -
  • {!! $so->email !!}
  • +
  • {!! $so->site_phone !!}
  • +
  • {!! $so->site_email !!}
@@ -27,7 +27,7 @@
- + diff --git a/resources/theme/frontend/metronic/widgets/clients.blade.php b/resources/theme/frontend/metronic/widgets/clients.blade.php index f2289fd..5601a28 100644 --- a/resources/theme/frontend/metronic/widgets/clients.blade.php +++ b/resources/theme/frontend/metronic/widgets/clients.blade.php @@ -1,3 +1,5 @@ +{{-- This is not working unless site_slider is running. Might be a problem with the carousel --}} +
@@ -20,4 +22,17 @@
- \ No newline at end of file + + +@section('scripts') + + @css('/site/js/jquery/plugins/owl.carousel/2.0.0/css/owl.carousel.css') + @css('/site/css/animate.css') + @js('/site/js/jquery/plugins/owl.carousel/2.0.0/js/owl.carousel.min.js','jq-owl-carousel','jquery') + + +@append \ No newline at end of file diff --git a/resources/theme/frontend/metronic/widgets/slider.blade.php b/resources/theme/frontend/metronic/widgets/slider.blade.php index 06ce680..9f0d728 100644 --- a/resources/theme/frontend/metronic/widgets/slider.blade.php +++ b/resources/theme/frontend/metronic/widgets/slider.blade.php @@ -67,16 +67,16 @@
- -@css('/site/js/jquery/plugins/owl.carousel/2.0.0/css/owl.carousel.css') -@css('/site/css/animate.css') -@js('/site/js/jquery/plugins/owl.carousel/2.0.0/js/owl.carousel.min.js','jq-owl-carousel','jquery') -@js('/pages/js/bs-carousel.js','bs-carousel','jq-owl-carousel') - @section('scripts') + + @css('/site/js/jquery/plugins/owl.carousel/2.0.0/css/owl.carousel.css') + @css('/site/css/animate.css') + @js('/site/js/jquery/plugins/owl.carousel/2.0.0/js/owl.carousel.min.js','jq-owl-carousel','jquery') + @js('/pages/js/bs-carousel.js','bs-carousel','jq-owl-carousel') + -@append +@append \ No newline at end of file diff --git a/routes/api.php b/routes/api.php index d979855..381c83c 100644 --- a/routes/api.php +++ b/routes/api.php @@ -19,7 +19,7 @@ Route::middleware('auth:api')->get('/user', function (Request $request) { }); */ -Route::group(['middleware'=>['auth:api','reseller']], function() { +Route::group(['middleware'=>['auth:api','role:reseller']], function() { Route::get('/r/agents','ResellerServicesController@agents'); Route::get('/r/accounts','ResellerServicesController@accounts'); }); diff --git a/routes/web.php b/routes/web.php index 6396b9f..7c1f0b5 100644 --- a/routes/web.php +++ b/routes/web.php @@ -11,27 +11,41 @@ | */ -Route::get('/','WelcomeController@index'); +Auth::routes(); +Route::get('/logout','Auth\LoginController@logout'); // Generic Image Renderer - Render images that we dont have with a generic image Route::get('image/generic/{width}/{height}/{color}/{name?}','MediaController@image')->name('image'); -Route::get('admin/switch/start/{id}','\Leenooks\Controllers\AdminController@user_switch_start')->name('switch.user.stop'); -Route::get('admin/switch/stop','\Leenooks\Controllers\AdminController@user_switch_stop')->name('switch.user.start'); +// Our Admin Routes +Route::group(['middleware'=>['theme:adminlte-be','auth','role:wholesaler'],'prefix'=>'a'], function() { + Route::get('setup','AdminHomeController@setup'); + Route::post('setup','AdminHomeController@setup_update'); + Route::get('switch/start/{id}','\Leenooks\Controllers\AdminController@user_switch_start')->name('switch.user.stop'); + Route::get('switch/stop','\Leenooks\Controllers\AdminController@user_switch_stop')->name('switch.user.start'); -Route::group(['middleware'=>['theme:adminlte-be']], function() { - Auth::routes(); - Route::get('/logout','Auth\LoginController@logout'); - Route::get('/r/supplier/index', 'SuppliersController@index'); - Route::get('/r/supplier/create', 'SuppliersController@create'); - Route::post('/r/supplier/store', 'SuppliersController@store'); - Route::get('/home', 'UserHomeController@home'); + Route::get('accounting/connect', 'AccountingController@connect'); }); +// Our Reseller Routes +Route::group(['middleware'=>['theme:adminlte-be','auth','role:reseller'],'prefix'=>'r'], function() { + Route::get('supplier/index', 'SuppliersController@index'); + Route::get('supplier/create', 'SuppliersController@create'); + Route::post('supplier/store', 'SuppliersController@store'); + Route::get('home', 'UserHomeController@home'); +}); + +// Our User Routes +Route::group(['middleware'=>['theme:adminlte-be','auth'],'prefix'=>'u'], function() { + Route::get('home', 'UserHomeController@home'); +}); + +// Frontend Routes (Non-Authed Users) Route::group(['middleware'=>['theme:metronic-fe']], function() { Route::get('/', 'WelcomeController@index'); }); +Route::redirect('/home','/u/home'); Route::demoAccess('/uc-access'); Route::redirect('/under-construction','http://www.graytech.net.au'); Route::get('/u/{type}/{action}/{id}','UserHomeController@oldsite'); \ No newline at end of file