Skip to content
This repository has been archived by the owner on Dec 14, 2019. It is now read-only.

Commit

Permalink
Patched function shortcut issue (see PR #61).
Browse files Browse the repository at this point in the history
  • Loading branch information
furey committed Mar 22, 2019
1 parent e00880a commit d1d1379
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions resources/views/includes.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,16 +132,16 @@ function tinx_query($class, ...$args)
${!! $name !!}_ = {!! $class !!}::latest($latestColumn)->first() ?: app('{!! $class !!}');
array_set($GLOBALS, 'tinx.shortcuts.{!! $name !!}', ${!! $name !!});
array_set($GLOBALS, 'tinx.shortcuts.{!! $name !!}_', ${!! $name !!}_);
if (!function_exists('{!! $name !!}')) {
function {!! $name !!}(...$args) {
return tinx_query('{!! $class !!}', ...$args);
}
}
} catch (Throwable $e) {
@include('tinx::on-name-error')
} catch (Exception $e) {
@include('tinx::on-name-error')
}
if (!function_exists('{!! $name !!}')) {
function {!! $name !!}(...$args) {
return tinx_query('{!! $class !!}', ...$args);
}
}
@endforeach
unset($latestColumn);

Expand Down
10 changes: 5 additions & 5 deletions resources/views/on-name-error.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@
${!! $name !!}_ = app('{!! $class !!}');
array_set($GLOBALS, 'tinx.shortcuts.{!! $name !!}', ${!! $name !!});
array_set($GLOBALS, 'tinx.shortcuts.{!! $name !!}_', ${!! $name !!}_);
if (!function_exists('{!! $name !!}')) {
function {!! $name !!}(...$args) {
return '{!! $class !!}';
}
}
} catch (Throwable $e) {
tinx_forget_name('{!! $class !!}');
} catch (Exception $e) {
tinx_forget_name('{!! $class !!}');
}
if (!function_exists('{!! $name !!}')) {
function {!! $name !!}(...$args) {
return '{!! $class !!}';
}
}
@else
tinx_forget_name('{!! $class !!}');
@endif

0 comments on commit d1d1379

Please sign in to comment.