0

I'm getting an error that a class (a controller) is not being found. Thing is, it is found in my local development environment. I created the controller with php artisan controller:make CssController --path=app/controllers/home.

I renamed the class (not the file) Home_CssController. I added the route:

Route::get('home/css-php', 'Home_CssController@index');

to my routes file. Everything works fine in my local environment. I did forget to run composer dump-autoload but there were no issues with viewing the controller/view in my local environment. I've uploaded everything to the live server, but I'm getting the error:

Class Home_CssController does not exist

I've uploaded the controller, the routes file and the view multiple times. But I still get the error. Is it because the controller wasn't registered with composer? I've since registered it, but am not sure what I need to upload to the server. I've uploaded both the config and bootstrap folders. What do I need to do to get the controller/view to be found? This is Laravel 4.

2
  • You said you didn't rename the file. Did you try renaming it to see if that works? Commented Aug 17, 2013 at 21:47
  • I found the solution. You have to upload the vendor/composer folder and the autoload.php file in the vendor directory. Commented Aug 17, 2013 at 21:47

1 Answer 1

1

If the controller isn't in the app/controllers folder, then it will need to be namespaced (unless you want to continue using your autoload.php trick).

Namespace Home_CssController to Home.

<?php namespace Home;

class CssController extends \BaseController

Then, you can use it in your routes:

Route::get('home/css-php', 'Home\CssController@index');
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.