title: Laravel csrf token within PHP form
body: <p>I created a little helper function for accepting friend requests. This function lies within a PHP file (obviously) and looks like this:</p>
  
  <p>(Only the relevant part)</p>
  
  <pre><code>foreach($friendrequests as $request){
      $username = DB::table('users')-&gt;where('id', $request-&gt;sender_id)-&gt;value('name');
      $notify .= '&lt;li&gt;';
      $notify .= '&lt;strong&gt;&lt;a href="/profile/'.$username.'"&gt;'.$username.'&lt;/a&gt;&lt;/strong&gt;&lt;br&gt;möchte dein Freund sein';
      $notify .= '&lt;form action="/friend/request/accept/'.$request-&gt;sender_id.'" method="post"&gt;&lt;input type="hidden" name="_token" value="csrf_field();"&gt;&lt;button type="submit"&gt;Akzeptieren&lt;/button&gt;&lt;/form&gt;';
      $notify .= '&lt;form action="/friend/request/deny/'.$request-&gt;sender_id.'" method="post"&gt;&lt;input type="hidden" name="_token" value="csrf_field();"&gt;&lt;button type="submit"&gt;Ablehnen&lt;/button&gt;&lt;/form&gt;';
      $notify .= '&lt;/li&gt;';
  }
  </code></pre>
  
  <p>I know it's kind of messy. I'm fairly new to Laravel.</p>
  
  <p>Anyway, there are two forms. One for accepting and one for denying the request. Now the thing I'm struggling with is the csrf token.</p>
  
  <p><strong>How do I implement this within the PHP helper file?</strong> I know how to use them in the blade templates, but I can't seem to make it work within the helper function.</p>