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

Class 'Arr' not found on start up #69

Closed
Rinze-Smits opened this issue Sep 23, 2019 · 2 comments
Closed

Class 'Arr' not found on start up #69

Rinze-Smits opened this issue Sep 23, 2019 · 2 comments

Comments

@Rinze-Smits
Copy link
Contributor

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.

furey added a commit that referenced this issue Sep 24, 2019
Fix for issue #69 (use fully qualified name for "Arr" in eval'd code).
@furey
Copy link
Owner

furey commented Sep 24, 2019

Patched via PR #70 and released as v2.4.1.

Cheers!

😀

@furey furey closed this as completed Sep 24, 2019
@furey
Copy link
Owner

furey commented Sep 24, 2019

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.

🤓👍

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants