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

Commit d1d1379

Browse files
committed
Patched function shortcut issue (see PR #61).
1 parent e00880a commit d1d1379

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

resources/views/includes.blade.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -132,16 +132,16 @@ function tinx_query($class, ...$args)
132132
${!! $name !!}_ = {!! $class !!}::latest($latestColumn)->first() ?: app('{!! $class !!}');
133133
array_set($GLOBALS, 'tinx.shortcuts.{!! $name !!}', ${!! $name !!});
134134
array_set($GLOBALS, 'tinx.shortcuts.{!! $name !!}_', ${!! $name !!}_);
135+
if (!function_exists('{!! $name !!}')) {
136+
function {!! $name !!}(...$args) {
137+
return tinx_query('{!! $class !!}', ...$args);
138+
}
139+
}
135140
} catch (Throwable $e) {
136141
@include('tinx::on-name-error')
137142
} catch (Exception $e) {
138143
@include('tinx::on-name-error')
139144
}
140-
if (!function_exists('{!! $name !!}')) {
141-
function {!! $name !!}(...$args) {
142-
return tinx_query('{!! $class !!}', ...$args);
143-
}
144-
}
145145
@endforeach
146146
unset($latestColumn);
147147

resources/views/on-name-error.blade.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@
44
${!! $name !!}_ = app('{!! $class !!}');
55
array_set($GLOBALS, 'tinx.shortcuts.{!! $name !!}', ${!! $name !!});
66
array_set($GLOBALS, 'tinx.shortcuts.{!! $name !!}_', ${!! $name !!}_);
7+
if (!function_exists('{!! $name !!}')) {
8+
function {!! $name !!}(...$args) {
9+
return '{!! $class !!}';
10+
}
11+
}
712
} catch (Throwable $e) {
813
tinx_forget_name('{!! $class !!}');
914
} catch (Exception $e) {
1015
tinx_forget_name('{!! $class !!}');
1116
}
12-
if (!function_exists('{!! $name !!}')) {
13-
function {!! $name !!}(...$args) {
14-
return '{!! $class !!}';
15-
}
16-
}
1717
@else
1818
tinx_forget_name('{!! $class !!}');
1919
@endif

0 commit comments

Comments
 (0)