Fix mkdir permission denied
This commit is contained in:
parent
960a50d6ba
commit
03619ea601
|
@ -209,11 +209,11 @@ class InvoiceController extends Controller
|
||||||
//Check if the directory already exists.
|
//Check if the directory already exists.
|
||||||
if (!is_dir(public_path($directoryName))) {
|
if (!is_dir(public_path($directoryName))) {
|
||||||
//Directory does not exist, so lets create it.
|
//Directory does not exist, so lets create it.
|
||||||
mkdir($directoryName, 0755);
|
mkdir(public_path($directoryName), 0755);
|
||||||
}
|
}
|
||||||
|
|
||||||
$title = trans('messages.invoice') . ' ' . $invoice->period;
|
$title = trans('messages.invoice') . ' ' . $invoice->period;
|
||||||
$message = "";
|
$message = $title;
|
||||||
|
|
||||||
$file = PDF::loadView('emails.invoice', $invoice->toArray())->setPaper('a4', 'landscape')->setWarnings(false)->save(public_path($directoryName . $filename));
|
$file = PDF::loadView('emails.invoice', $invoice->toArray())->setPaper('a4', 'landscape')->setWarnings(false)->save(public_path($directoryName . $filename));
|
||||||
|
|
||||||
|
@ -222,7 +222,7 @@ class InvoiceController extends Controller
|
||||||
Mail::mailer('smtp')->raw($message, function ($message) use ($recipients, $title, $file) {
|
Mail::mailer('smtp')->raw($message, function ($message) use ($recipients, $title, $file) {
|
||||||
$message->subject($title)
|
$message->subject($title)
|
||||||
->to($recipients)
|
->to($recipients)
|
||||||
->attachData($file->output(), $title . '.pdf');
|
->attachData($file->output(), str_replace(' ', '-', $title) . '.pdf');
|
||||||
});
|
});
|
||||||
|
|
||||||
} catch (\Throwable $t) {
|
} catch (\Throwable $t) {
|
||||||
|
|
Loading…
Reference in New Issue