title: Laravel attach a file in pdf to email
body: <p>I have a problem to attach official letter that have been create in the system which is in pdf to lecturer's email that have in the database.</p>
  
  <p>public function approve($id,Request $request)
      {</p>
  
  <pre><code>    try {
  
          $letter = Letter::where('id',$id)
          -&gt;update([
              'isApproved' =&gt; 1,
              'approvedBy' =&gt; $request-&gt;session()-&gt;get('users.id')
              ]);
  
  
          $letter = Letter::where('id',$id)
          -&gt;first();
  
          $lecturer = User::where('id',$letter-&gt;user_id)
          -&gt;get();
  
          $emailBody="Hello, ".$lecturer[0]-&gt;username.",&lt;br&gt;".
          "Your letter have been approved by ".$request-&gt;session()-&gt;get('users.username').".&lt;br&gt;".
          "Kindly check the attachment. Thank you.&lt;br&gt;&lt;br&gt;".
          "This is system generated email. Please do-not reply on this email.";
  
          mail($lecturer[0]-&gt;email, "Certification Approved", $emailBody);
  
          return redirect()
          -&gt;back()
          -&gt;with('success_approve_letter','Record successfully approve');
  
      } catch (Exception $e) {
  
          return redirect()
          -&gt;back()
          -&gt;withErrors(["Error: ".$e-&gt;getMessage()]);
      }
  }
  </code></pre>
  
  <p>But in the email, it just send this.</p>
  
  <p><a href="https://i.stack.imgur.com/YgZhw.png" rel="nofollow noreferrer">Gmail Image</a></p>