I've installed Baum on laravel 5 and ran php artisan baum:install Category
, which created Category class that look like this:
<?php
use Baum\Node;
class Category extends Node {
}
When I try to run:
$root = Category::create(['name' => 'Root category'])
I get the error:
[Symfony\Component\Debug\Exception\FatalErrorException]
Class 'Category' not found
I ran composer dump-autoload
, but it did not help.
your declaration need to set the namespace.
<?php
namespace App; // use your app namespace
use Baum\Node;
class Category extends Node {
}
when you'll run, you can use full namespace call or with 'use' stat.
$root = App\Category::create(['name' => 'Root category']);
or
use App\Category;
$root = Category::create(...);