Compare commits

...

3 Commits
9.0.4 ... 9.0.7

Author SHA1 Message Date
Deon George
1f114667aa Changed ->, changed address() to ->address 2021-07-02 09:09:31 +10:00
Deon George
f801001571 Fix social icons in metronic 2021-07-02 08:22:28 +10:00
Deon George
45be8553a2 Added SingleOrFail Eloquent helper 2021-07-01 11:58:50 +10:00
4 changed files with 61 additions and 16 deletions

View File

@@ -6,9 +6,9 @@
<div class="row">
<!-- BEGIN BOTTOM ABOUT BLOCK -->
<div class="col-md-4 col-sm-6 pre-footer-col">
@isset($so->site_aboutus))
@isset($site->site_aboutus))
<h2>About us</h2>
<p>{!! $so->site_aboutus !!}</p>
<p>{!! $site->site_aboutus !!}</p>
<!--
<div class="photo-stream">
<h2>Photos Stream</h2>
@@ -26,11 +26,11 @@
<h2 style="text-align: right;">Our Contact Details</h2>
<address class="margin-bottom-40" style="float: right;">
<table>
<tr><th style="vertical-align:top; padding-right: 5px;">Address</th><td>{!! $so->address('html') !!}</td></tr>
@isset($so->site_fax)
<tr><th>Fax</th><td>{{ $so->site_fax }}</tr>
<tr><th style="vertical-align:top; padding-right: 5px;">Address</th><td>{!! join('<br>',$site->address) !!}</td></tr>
@isset($site->site_fax)
<tr><th>Fax</th><td>{{ $site->site_fax }}</tr>
@endif
<tr><th>Email</th><td> <a href="mailto:{{ $so->site_email }}">{{ $so->site_email }}</a></tr>
<tr><th>Email</th><td> <a href="mailto:{{ $site->site_email }}">{{ $site->site_email }}</a></tr>
</table>
</address>
<!--
@@ -81,8 +81,8 @@
<!-- BEGIN SOCIAL -->
<div class="col-md-4 col-sm-4">
<ul class="social-footer list-unstyled list-inline pull-right">
@foreach ($so->social as $social)
<li><a href="{{ $social['url'] }}"><i class="fa fa-{{ $social['name'] }}"></i></a></li>
@foreach ($site->social as $social)
<li><a href="{{ $social['url'] }}"><i class="fab fa-{{ $social['name'] }}"></i></a></li>
@endforeach
</ul>
</div>

View File

@@ -23,13 +23,13 @@
<link href="//fonts.googleapis.com/css?family=Open+Sans:300,400,600,700|PT+Sans+Narrow|Source+Sans+Pro:200,300,400,600,700,900&amp;subset=all" rel="stylesheet" type="text/css">
<meta property="og:site_name" content="{{ config('app.name') }}" />
<meta property="og:title" content="{{ $so->site_name }}" />
<meta property="og:description" content="{{ $so->site_description }}" />
<meta property="og:title" content="{{ $site->site_name }}" />
<meta property="og:description" content="{{ $site->site_description }}" />
<meta property="og:type" content="website" />
<meta property="og:image" content="{{ $so->site_logo }}" />
<meta property="og:image" content="{{ $site->site_logo }}" />
<meta property="og:url" content="{{ url('/') }}" />
<link rel="shortcut icon" href="{{ object_get($so,'favicon','favicon.ico') }}" />
<link rel="shortcut icon" href="{{ object_get($site,'favicon','favicon.ico') }}" />
<!-- Custom CSS -->
@css('css/custom.css')

View File

@@ -5,8 +5,8 @@
<!-- BEGIN TOP BAR LEFT PART -->
<div class="col-md-6 col-sm-6 additional-shop-info">
<ul class="list-unstyled list-inline">
<li><i class="fas fa-phone mr-4"></i><span>{!! $so->site_phone !!}</span></li>
<li><i class="fas fa-envelope mr-4"></i><span>{!! $so->site_email !!}</span></li>
<li><i class="fas fa-phone mr-4"></i><span>{!! $site->site_phone !!}</span></li>
<li><i class="fas fa-envelope mr-4"></i><span>{!! $site->site_email !!}</span></li>
</ul>
</div>
<!-- END TOP BAR LEFT PART -->
@@ -29,14 +29,14 @@
<!-- BEGIN HEADER -->
<div class="header">
<div class="container">
<a class="site-logo" href="{{ url('/') }}"><img src="{{ $so->site_logo }}" alt="{{ $so->site_description }}" height="32"></a>
<a class="site-logo" href="{{ url('/') }}"><img src="{{ $site->site_logo }}" alt="{{ $site->site_description }}" height="32"></a>
<a href="javascript:void(0);" class="mobi-toggler"><i class="fa fa-bars"></i></a>
<!-- BEGIN NAVIGATION -->
<div class="header-navigation pull-right font-transform-inherit">
<ul>
{{-- @todo Replace this with a function that can traverse children with multiple depths --}}
@foreach ($so->top_menu as $item => $menu)
@foreach ($site->top_menu as $item => $menu)
<li class="dropdown {{ Request::is($menu['url']) ? 'active' : '' }}">
@if (! \Illuminate\Support\Arr::get($menu,'children'))

View File

@@ -0,0 +1,45 @@
<?php
/**
* Extend Eloquent so that it includes singleOrFail calls to test that a query returns only 1 record
*/
namespace Leenooks\Traits;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\ModelNotFoundException;
trait SingleOrFail
{
public static function bootSingleOrfail(): void
{
// When a query should return 1 object, or FAIL if it doesnt
Builder::macro('singleOrFail',function () {
$result = $this->get();
if (($x=$result->count()) == 1)
return $result->first();
throw new ModelNotFoundException(sprintf('Query brings back %d record(s) called for singleOrFail()',$x));
});
// When a query should return 1 object, or NULL if it doesnt
Builder::macro('single',function () {
$result = $this->get();
if ($result->count() == 1)
return $result->first();
return NULL;
});
// When a query should return 1 object, or NULL if it doesnt
Builder::macro('singleOrNew',function ($args) {
$result = $this->where($args)->get();
if ($result->count() == 1)
return $result->first();
return $this->newModelInstance($args);
});
}
}