title: How to handle incoming POST data from external server in Laravel
body: <p>I have a route for handling incoming POST data in laravel:</p>
  
  <pre><code>Route::get('/sendgrid/api', 'SendGrid\EmailEventsController@parse');
  </code></pre>
  
  <p>Here's my controller:</p>
  
  <pre><code>namespace App\Http\Controllers\SendGrid;
  
  use App\Http\Controllers\Controller;
  use App\Models\SendGrid\EmailEvents;
  
  class EmailEventsController extends Controller
  {
      public function parse()
      {
          $contents = file_get_contents("php://input");
          $requests = json_decode($contents);
  
          $data = array();
  
          foreach ($requests as $request)
          {
              array_push($data, array(
                  'email' =&gt; $request-&gt;email,
                  'event' =&gt; $request-&gt;event,
                  'category' =&gt; $request-&gt;category
              ));
          }
  
          EmailEvents::insert($data);
      }
  }
  </code></pre>
  
  <p>But still doesn't work. What did I do wrong?</p>