-1

i do a script on root of my site. This script is lauch by cron. At the end of script, i try to send mail with the result of process by use Mail facade laravel, but it doens't work.

On the top of my script i put this:

 require_once('../../vendor/autoload.php');
 use Illuminate\Support\Facades\Mail;

and call

Mail::send(...)

but i have "a facade root has not been set".

Thanks for your help

Edit: I add theses lines

require __DIR__.'/../' . 'bootstrap/autoload.php';
$app = require_once __DIR__.'/../' . 'bootstrap/app.php';

$kernel = $app->make('Illuminate\Contracts\Http\Kernel');

$kernel->handle(;
  $request = Illuminate\Http\Request::capture()
);

for replace

require_once('../../vendor/autoload.php');

Now i have no error message, but I don't receive the mail

Someone can help me

Stephsen
  • 11
  • 1

1 Answers1

0

Facades are called statically, so try Mail::send();

Laravel facades serve as "static proxies" to underlying classes in the service container, providing the benefit of a terse, expressive syntax while maintaining more testability and flexibility than traditional static methods. https://laravel.com/docs/5.6/facades

Ellen
  • 26
  • 4