5

I want to add a view to my email. I already set the namespace in my provider but it cannot be found

My map structure is:

src-> Domain -> Quotation -> views-> BookedMail.php
src-> Domain -> Quotation -> QuotationController.php
src-> Providers

The Function being called (from the controller from the Quotation dir)

    Mail::send('Quotation::BookedMail', [], function ($message) use ($request) {
        $message->to($request['email'], '')->subject('Loslijst ' . date('d-m-Y'));
    });

The setting of the namespace ( in the Providers dir )

$this->loadViewsFrom('../Domain/Quotation/views','Quotation');

the error is View [BookedMail] not found

Nick Alexander
  • 361
  • 2
  • 5
  • 21

2 Answers2

2

You are attempting to load the views from the server root since your path is starting with a /.

You could use the app_path helper instead by changing it to:

$this->loadViewsFrom(app_path('Domain/Quotation/views'), 'Quotation');

However, if you want to use relative path, you could do it like this:

$this->loadViewsFrom(__DIR__.'/../Domain/Quotation/views', 'Quotation');

Note: If you are wondering why your blade directives are not working, you should your view to .blade.php instead of .php.

Chin Leung
  • 14,621
  • 3
  • 34
  • 58
0

This looks like a typo: you're calling Quotation::BookedMail where your view file is named BookedEmail.

EDIT: this was a typo on the question itself rather than in the project, please disregard this answer

Zarunet
  • 38
  • 7