Laravel Envoy - Class Config Does Not Exist
I'm currently trying to use Laravel Envoy ( https://laravel.com/docs/5.8/envoy ). It works fine but I would like going further by being able to use
Illuminate\Foundation\Application class to be able to inject some dependencies into
@setup Envoy directive (e.g. retrieve some config or Eloquent models). But I keep getting this error, whatever I tried.
@servers(['localhost' => '127.0.0.1']) @include('vendor/autoload.php') @setup $laravelApp = include 'bootstrap/app.php'; dump(config('database')); @endsetup @task('foo', ['on' => 'localhost']) ls @endtask
Any help would be greatly appreciated, thanks!
I finally found out the origin of my issue. It came from Laravel bootstrappers which are not called. They get called by a Kernel class instead of Application. So, I added this to make it work:
@servers(['localhost' => '127.0.0.1']) @setup define('LARAVEL_START', microtime(true)); $app = require_once __DIR__.'/bootstrap/app.php'; $kernel = $app->make(Illuminate\Contracts\Console\Kernel::class); $kernel->bootstrap(); dump(config('database')); @endsetup @task('foo', ['on' => 'localhost']) ls @endtask
Notice that bootstrappers are not automatically called, and because I do not wish using Artisan on this use-case, I called
bootstrap method manually.
Thanks anyway for your help!
- → "failed to open stream" error when executing "migrate:make"
- → October CMS Plugin Routes.php not registering
- → OctoberCMS Migrate Table
- → OctoberCMS Rain User plugin not working or redirecting
- → October CMS Custom Mail Layout
- → October CMS - How to correctly route
- → October CMS create a multi select Form field
- → October CMS - Conditionally Load a Different Page
- → How to disable assets combining on development in OctoberCMS
- → October CMS - Radio Button Ajax Click Twice in a Row Causes Content to disappear
- → OctoberCms component: How to display all ID(items) instead of sorting only one ID?
- → In OctoberCMS how do you find the hint path?
- → How to register middlewares in OctoberCMS plugin?