What I am trying to do:
I have a procedure in my workflow the user goes through to create, with various steps of inserting data. In each step the user is required to upload a file. Let's say that when step 3 is completed, I want to create a notification that is send by mail with a message and the relative file attached. I also want to have a view in my app where a list of all the notifications the user has received is displayed, and when each of them clicked, to display the notification message (the one that was send by mail) and a link to the relative file. I.e. I want the user to be able to access his notifications both by email and through the app.
What troubles me:
The attach() method for the MailMessage, needs an absolute path to the file, which is in the following format:
my-local-disk-path/storage/app/files/procedure/[procedure_id]/documents/[step_id]/[file_id]/[name_of_file]
I "construct" the string
$path = '\\files\\procedure\\'.$procedure_id.'\\documents\\'.$step_id.'\\'.$file_id;
in the notification __construct function and then do
$path = Storage::path($path.'\\'.$name_of_file);
and add
->attach($path)
to the MailMessage. I also store the notification to database with toArray().
I am now trying to build a view for the notification, which includes a link to the relative file. I have tried various things, but before presenting them (since they failed), I would like to ask your opinions on how to implement this.