Laravel 4.2 - Throwing exception (-1)

I am getting the following error:

ReflectionException (-1)

Class PhotosController does not exist

      

This is my route:

Route::resource('photos', ' PhotosController');

      

When I go to Route :: get ('photos', 'PhotosController @index'); works fine but using the resource it crashes? What's happening? PhotosController:

<?php

class PhotosController extends \BaseController {

    /**
     * Display a listing of the resource.
     * GET /photos
     *
     * @return Response
     */
    public function index()
    {
        return Photo::all();
    }

    /**
     * Show the form for creating a new resource.
     * GET /photos/create
     *
     * @return Response
     */
    public function create()
    {
        //
    }

    /**
     * Store a newly created resource in storage.
     * POST /photos
     *
     * @return Response
     */
    public function store()
    {
        //
    }

    /**
     * Display the specified resource.
     * GET /photos/{id}
     *
     * @param  int  $id
     * @return Response
     */
    public function show($id)
    {
        //
    }

    /**
     * Show the form for editing the specified resource.
     * GET /photos/{id}/edit
     *
     * @param  int  $id
     * @return Response
     */
    public function edit($id)
    {
        //
    }

    /**
     * Update the specified resource in storage.
     * PUT /photos/{id}
     *
     * @param  int  $id
     * @return Response
     */
    public function update($id)
    {
        //
    }

    /**
     * Remove the specified resource from storage.
     * DELETE /photos/{id}
     *
     * @param  int  $id
     * @return Response
     */
    public function destroy($id)
    {
        //
    }

}

      

+3


source to share


1 answer


If it composer dump-autoload

doesn't fix it, then it is probably a typo in the class name or routes file, or is misusing subdirectories / namespaces on your controllers.



+1


source







All Articles