Laravel 5.2 Ajax internal server error 500
<p>I'm using Laravel 5.2 with ajax but I have internal server error 500 when I click on the link for example. </p>

<p>Here my code . . .</p>

<p>Blade file:</p>

<pre><code>&lt;a class="delete" href="#" data-userid="{{ $user-&gt;id }}"&gt;X&lt;/a&gt;
</code></pre>

<p>Js file:</p>

<pre><code>var userId = 0;
$('.delete').on('click', function(event){
event.preventDefault();
userId = event.target.dataset['userid'];

$.ajax({
    method:'POST',
    url: 'users/delete',
    data: {userId: userId, _token: token}
}).done(function() {
    console.log('done');
    });
    console.log(userId);
});
</code></pre>

<p>Route file:</p>

<pre><code>Route::post('users/delete', 'HomeController@delete');
</code></pre>

<p>HomeController file:</p>

<pre><code>public function delete(Request $request)
{
    $user = POST::find($request['userId']);
    $user-&gt;delete();
    return response();
}
</code></pre>

<p>Js file works good out of laravel . . .
Of course I have database with users table, and connection with database.
I'm working locally and using windows 10.</p>

<p>This is error screenshot:</p>

<p><a href="https://i.stack.imgur.com/mMDRz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mMDRz.png" alt="enter image description here"></a></p>