title: Laravel Mail Attachment
body: <p>How to add email attachment in laravel? And the download link on that,and also to validate just the PDF and size is no longer up to 2mb. Sorry im just a student that love to code. Please help me.</p>
  
  <p>This is my controller code</p>
  
  <pre><code>public function store_applier(Request $request)
  {   
      $this-&gt;validate($request, [
          'nama' =&gt; 'required',
          'email' =&gt; 'required',
          'kontak' =&gt; 'required',
          'kategori'=&gt;'required',
          'posisi' =&gt; 'required',
          'alamat' =&gt; 'required',
      ]); 
  
      $tambah = new appliers(); //kita buat objek yang terhubung ke table JOBS
      $tambah-&gt;nama = $request['nama'];
      $tambah-&gt;email = $request['email'];
      $tambah-&gt;kontak = $request['kontak'];
      $tambah-&gt;kategori = $request['kategori'];
      $tambah-&gt;posisi = $request['posisi'];
      $tambah-&gt;alamat = $request['alamat'];
  
  
      $file = $request-&gt;file('upload_cv');
      $fileName = $file-&gt;getClientOriginalName();
      $request-&gt;file('upload_cv')-&gt;move("cv/", $fileName);
      $tambah-&gt;upload_cv = $fileName;
      $tambah-&gt;save();
  
      $email = DB::table('user')-&gt;where('email');
  
      Mail::send('emails.welcome', [
          'email' =&gt; $request['email'],
          'HP' =&gt; $request['kontak'],
          'nama' =&gt; $request['nama'], 
          'posisi' =&gt; $request['posisi'], 
          'CV' =&gt; $tambah-&gt;upload_cv = $fileName
      ], function ($message) use ($request, $tambah, $email) {
  
          $message-&gt;from('stevanajja@gmail.com', $request-&gt;posisi);   
  
          $message-&gt;to('stevantinusl47@gmail.com')
                  -&gt;subject('Lamaran Baru')
                  -&gt;cc('stevanlai@yahoo.com.sg')
                  -&gt;replyTo($request-&gt;email);
  
          $message-&gt;getSwiftMessage();
  
      });
  
      return redirect()-&gt;to('index'); 
  }
  </code></pre>
  
  <p>and this is the view code</p>
  
  <pre><code>**&lt;h1&gt;Lamaran Baru&lt;/h1&gt;
  
  From : {{ $email }}
  
  &lt;br /&gt;
  
  NO.HP : {{$HP}}
  
  &lt;br /&gt;
  
  =========================
  
  &lt;br /&gt;&lt;br /&gt;
  
  Nama saya {{ $nama }},
  
  &lt;br /&gt;&lt;br /&gt;
  
  Saya ingin melamar pekerjaan di PT.Halcom dengan posisi sebagai 
  
  &lt;h2&gt;{{$posisi}}&lt;/h2&gt;
  
  &lt;br /&gt;
  
  Berikut saya lampirkan CV saya
  
  &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;
  
  *Klik link dibawah untuk melihat CV
  
  &lt;br /&gt;
  
  &lt;a href="{!!URL::asset('../cv/{{$CV}}')!!}"&gt;KLIK&lt;/a&gt;**
  </code></pre>
  
  <p>sorry for my bad to wasting ur time to answer the stupid question.. i am just student</p>