title: How to implement Abstract class in laravel 5
body: <p>in App/Abstracts/ folder I have following file </p>
  
  <p>1.Transformer.php</p>
  
  <pre><code>&lt;?php
  
  namespace App\Abstracts;
  
  use eventsTransformer;
  
  
  abstract class Transformer
  {
  
  
  public function transformCollection(array $item)
  {
      return array_map([$this ,'transform'],$item-&gt;toArray());
  } 
  
  public abstract function transform($event);
  
  }
  </code></pre>
  
  <p>2.eventsTransformer</p>
  
  <pre><code>&lt;?php
  
  namespace App\Abstracts;
  
  
   class EventTransformer extends Transformer
  {
  
  
  public function transform($event)
      {
  
  
                  return [
                          'event'=&gt; $event['event'],
                          'date' =&gt; $event['date'],
                          'e_code'=&gt; $event['eventcode'],
                          'country'=&gt; $event['country'],
                          'city'=&gt; $event['city']
                  ];
  
      }
  
  }
  </code></pre>
  
  <p>Now In my Controller I am using them like this </p>
  
  <pre><code>&lt;?php
  
  namespace App\Http\Controllers;
  use Illuminate\Routing\ResponseFactory;
  use App\Abstracts\eventsTransformer;
  use Illuminate\Http\Request;
  use Illuminate\Http\Response;
  use App\Http\Requests;
  use App\Http\Controllers\Controller;
  use App\Event;
  
  class EventsapiController extends Controller
  {
      /**
       * Display a listing of the resource.
       *
       * @return \Illuminate\Http\Response
       */
  
  
       //use EventTransformer;
       protected $eventTransformer;
  
       public function __construct(EventTransformer $EventTransformer){
  
          $this-&gt;$eventTransformer = $EventTransformer; // replace 'collector' with whatever role you need.
      }
  
  
      public function index()
      {
          //
          $events =  Event::All();
          $response = array();
  
          return response()-&gt;json([
  
          'data'=&gt;$this-&gt;eventTransformer-&gt;transform($events)
  
          ],200);
  
          //return $response['data']=$events;
  
      }
  
      /**
       * Show the form for creating a new resource.
       *
       * @return \Illuminate\Http\Response
       */
      public function create()
      {
          //
      }
  
      /**
       * Store a newly created resource in storage.
       *
       * @param  \Illuminate\Http\Request  $request
       * @return \Illuminate\Http\Response
       */
      public function store(Request $request)
      {
          //
      }
  
      /**
       * Display the specified resource.
       *
       * @param  int  $id
       * @return \Illuminate\Http\Response
       */
      public function show($id)
      {
          //
          $event = Event::find($id);
  
          if(!$event)
          {
              return response()-&gt;json([
  
                  'error'=&gt; 'Event does not exist',
                  'code' =&gt; 'e101'
                  ],404);
          }
  
              return response()-&gt;json([
  
                  'data'=&gt;$event-&gt;toArray()
  
              ],200);
      }
  
      /**
       * Show the form for editing the specified resource.
       *
       * @param  int  $id
       * @return \Illuminate\Http\Response
       */
      public function edit($id)
      {
          //
      }
  
      /**
       * Update the specified resource in storage.
       *
       * @param  \Illuminate\Http\Request  $request
       * @param  int  $id
       * @return \Illuminate\Http\Response
       */
      public function update(Request $request, $id)
      {
          //
      }
  
      /**
       * Remove the specified resource from storage.
       *
       * @param  int  $id
       * @return \Illuminate\Http\Response
       */
      public function destroy($id)
      {
          //
      }
  
  
  }
  </code></pre>
  
  <p>I am getting following error </p>
  
  <pre><code>ReflectionException in Container.php line 790: Class App\Http\Controllers\EventTransformer does not exist
  </code></pre>
  
  <p>Can any one help me out with this </p>
  
  <p>MyQuestion is the same what How to include abstract in Laravel5</p>
  
  <p>Thanks</p>