If the Table.php class is a independent class with no other dependencies. You can also load them as you would load another Service class.
All you need to do is :
Specify the App directory in composer.json :
"psr-0":{
"Myapp":"app/"
}
In you can drop the class anywhere for this example , app/Myapp/Lib/Table.php
<?php namespace Myapp\Lib;
class Table .... // You table class
In your controller
<?php
use Myapp\Lib\Table as Table;
class Mycontroller ....
protected $table;
public function __contruct(Table $t){
$this->table = $t;
}
When you type hint the class it should get injected since you don't have much ambiguity on which class the app container should load.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community