title: Laravel auth via ajax
body: <p>i write Controller for management ajax requests . i write construct method for check user login or not <code>if</code> block work fine but always return <code>user.setting</code> view and return in construct not work .</p>
  
  <p>controller:</p>
  
  <pre><code>&lt;?php
  
  namespace App\Http\Controllers;
  
  use Illuminate\Http\Request;
  use App\Http\Requests;
  use App\Http\Controllers\Controller;
  use Auth;
  
  class AjaxController extends Controller {
  
      public function __construct() {
          if (Auth::check() == FALSE) {
              return view('errors.notLogin');
          }
      }
  
      public function settings() {
          return view('user.setting');
      }
  
  }
  </code></pre>
  
  <p>route:</p>
  
  <pre><code>Route::post('ajax/settings', 'AjaxController@settings');
  </code></pre>
  
  <p>js:</p>
  
  <pre><code>acc_settings = function (url) {
      $.ajaxSetup({
          headers: {
              'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
          }
      });
      $.ajax({
          url: url,
          type: 'POST',
          data: 'settings=settings',
          success: function (data) {
              $("#ajax").html(data);
          }
      });
  };
  </code></pre>