Troubleshooting
Run your command again with -v. It prints what it does, and it explains why a model is skipped.
Nothing appears on my dashboard
Check these four things, in this order:
- The command ran. Run it by hand with
-vand read the output. - The key is set.
ELOQUENTIZE_API_TOKENmust be in your.envfile. After changing.envon a server that caches its config, runphp artisan config:clear. - You are looking at the right app. Run the command with
--dry: it prints the app name Eloquentize will use, made ofAPP_URLandAPP_ENV. If you changed one of them, your data went to a new source. - The scheduler runs. Your server needs a cron entry that runs
php artisan schedule:runevery minute.
No models found
The command found no model files. By default it reads app/Models, or app if that folder does not exist, and only looks at files directly in it. If your models are somewhere else, see Models in another folder.
A model is skipped
With -v, the command says why. The two common reasons:
- "does not use timestamps": the model has
public $timestamps = false. Eloquentize needs timestamps. - "does not have a column named ...": the table has no column for the event you asked for. Check the name given to
--event.
Table not found
If a model is a pivot, Laravel guesses its table name, and the guess can be wrong. Eloquentize then looks for a table that does not exist (for example user_widgets). Set the table on the model:
class UserWidget extends Model
{
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'user_widget';
}
Invalid date format
The day must match the date format. The default format is DD/MM/YYYY, for example 31/01/2024. If you write dates another way, pass the format with --dateFormat, using PHP date letters:
php artisan eloquentize:models-count 2024-01-31 --dateFormat="Y-m-d"
"scope option requires --models"
models-count needs to know which model owns the scope. Add --models=YourModel. In the same way, --scopeValue needs --scope.
"is not a valid aggregation type"
The aggregation must be min, max, avg or sum.
Command not found
Run php artisan list eloquentize. If no command appears, register them yourself in app/Console/Kernel.php:
protected $commands = [
\Eloquentize\LaravelClient\Commands\ModelsCount::class,
\Eloquentize\LaravelClient\Commands\PropertyAggregate::class,
\Eloquentize\LaravelClient\Commands\ModelsCountLegacy::class,
];
Still stuck?
Open the live chat at the bottom of any page, or book a call.