I just created a simple app in Laravel 4 and when I create a model, I get an exception that it's not found.
// /app/models/Worker.php:
<?php
class Worker extends Eloquent {}
And then in the Controller
var_dump(Worker::find(1));
This gives me Error: Class 'Worker' not found. What am I doing wrong? This used to work in Laravel 3 and also watching the screencasts it seems like this should work.
Anytime you create a new class file in L4 run this command.
php composer dump-autoload
I think there are two commands to get the autoload started:
$ composer dump-autoload
and
$ php artisan dump-autoload
Seems composer dump-autoload is to let composer create autoloads as defined in the composer.json files. And php artisan dump-autoload glues all the composer dump-autoloads ( also from vendors and workbenches ) together.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With