Reputation: 39
I am trying to implement REST API from github
In my existing Codeigniter project.
There is a library in which trait is defined. I am trying to use that library "REST_Controller"
In my controller file "Api.php"
. But I am getting error on the line where is am using the "use"
keyword to implement it which says that unable to
Error
**"Trait 'REST_Controller' not found"
class Books extends CI_Controller {
use REST_Controller {
REST_Controller::__construct as private __resTraitConstruct;
}
Upvotes: 3
Views: 302
Reputation: 11034
Import the trait on top of your class in order to be able to use it
use Restserver\Libraries\REST_Controller;
class Books extends CI_Controller {
use REST_Controller {
REST_Controller::__construct as private __resTraitConstruct;
}
Upvotes: 3