When starting tinx on Laravel 5.7.21 I'm greeted with a message saying:
root@3c1a41a39166:/app# php artisan tinx
Tinx – something awesome is about to happen.
ErrorException : Class 'Arr' not found (View: /app/vendor/ajthinking/tinx/resources/views/includes.blade.php)
at /app/storage/framework/views/be5e1af9a1a729ea1878b73c6383511207e78a62.php:129
125| * For "first" variable, returns "::first()" if class DB table exists, otherwise "new" (if 'tableless_models' set to true).
126| * For "last" variable, returns "::latest()->first()" if class DB table exists, otherwise "new" (if 'tableless_models' set to true).
127| * */
128| Arr::set($GLOBALS, 'tinx.names', <?php echo var_export($names);; ?>);
> 129| $latestColumn = '<?php echo e(Arr::get($config, 'latest_column', 'created_at')); ?>';
130| <?php $__currentLoopData = $names; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $class => $name): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
131| try {
132| $<?php echo $name; ?> = <?php echo $class; ?>::first() ?: app('<?php echo $class; ?>');
133| $<?php echo $name; ?>_ = <?php echo $class; ?>::latest($latestColumn)->first() ?: app('<?php echo $class; ?>');
Exception trace:
1 Illuminate\View\Engines\CompilerEngine::handleViewException(Object(Symfony\Component\Debug\Exception\FatalThrowableError))
/app/vendor/laravel/framework/src/Illuminate/View/Engines/PhpEngine.php:47
2 Illuminate\View\Engines\PhpEngine::evaluatePath("/app/storage/framework/views/be5e1af9a1a729ea1878b73c6383511207e78a62.php", [Object(Illuminate\View\Factory), Object(Illuminate\Foundation\Application)])
/app/vendor/laravel/framework/src/Illuminate/View/Engines/CompilerEngine.php:59
Please use the argument -v to see more details.
root@3c1a41a39166:/app# php artisan --version
Laravel Framework 5.7.21
Adding the namespace to Arr on that line fixes the error. Evaluated code in is executed as if in a new file, so it doens't copy the namespace from the parent script.
Please note—after updating Tinx (composer update ajthinking/tinx), you'll probably need to clear your cached Laravel views (php artisan view:clear) before you can run Tinx again without issue.
When starting tinx on Laravel 5.7.21 I'm greeted with a message saying:
Adding the namespace to Arr on that line fixes the error. Evaluated code in is executed as if in a new file, so it doens't copy the namespace from the parent script.