title: How to use APIGuard with Fractal Transformer in Laravel?
body: <p>I'm trying to create a web API in Laravel.
  I'm using the following packages for me to manage the REST return: <a href="http://fractal.thephpleague.com/" rel="nofollow">fractal</a>, spatie/fractal and also <a href="https://github.com/chrisbjr/api-guard" rel="nofollow">ApiGuard</a>.</p>
  
  <p>My controller has the following code:</p>
  
  <pre><code>&lt;?php
  
  namespace App\Http\Controllers;
  
  use Chrisbjr\ApiGuard\Http\Controllers\ApiGuardController;
  use App\CSV;
  use App\CSVTransformer;
  
  class ApiController extends ApiGuardController
  {
      public function info()
      {
          $csvs = CSV::all();
          $estado = [0,0,0,0];
  
          foreach ($csvs as $csv) {
              switch ($csv-&gt;estado) {
                  case "Renovado":
                      $estado[0]++;
                      break;
                  case "Expirado":
                      $estado[1]++;
                      break;
                  case "Aguardar Pagamento":
                      $estado[2]++;
                      break;
                  case "Não Renovado":
                      $estado[3]++;
                      break;
              }
          }            
  
          return $this-&gt;response-&gt;withCollection($csvs, new CSVTransformer);
      }
  
      public function renovacoes() {
          $csvs = CSV::all();
  
          return json_encode([ "data" =&gt; $csvs ]);
      }
  }
  </code></pre>
  
  <p>This is what the transformer looks like:
      
  
  <pre><code>namespace App;
  
  use App\CSV;
  use League\Fractal\TransformerAbstract;
  
  class CSVTransformer extends TransformerAbstract
  {
      public function transform(CSV $csv)
      {
          return [
              'id'      =&gt; (int) $csv-&gt;id,
              'renovacao'   =&gt; $csv-&gt;renovacao
          ];
      }
  }
  </code></pre>
  
  <p>The problem is, when accessing the chosen POST route to get the JSON return, the following error is thrown:</p>
  
  <pre><code>Class 'League\Fractal\TransformerAbstract' not found.
  </code></pre>
  
  <p>How do I solve this, so that my transformer works as it is supposed to?</p>
  
  <p>EDIT:</p>
  
  <p>Also, here's the <code>CSV</code> class:</p>
  
  <pre><code>&lt;?php
  
  namespace App;
  
  use Illuminate\Auth\Authenticatable;
  use Illuminate\Database\Eloquent\Model;
  use Illuminate\Auth\Passwords\CanResetPassword;
  use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
  use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;
  
  class CSV extends Model
  {
      protected $table = "csv";
  }
  </code></pre>
  
  <p>Routes file:</p>
  
  <pre><code>Route::group(["middleware" =&gt; ["apiguard"]], function () {
      Route::group(['prefix' =&gt; 'api'], function () {
          Route::group(['prefix' =&gt; 'v1'], function () {
              Route::post("/renovations/info","ApiController@info");
  
              Route::post("/renovations","ApiController@renovacoes");
          });
      });
  });
  </code></pre>