can I call a controller method in the seeder?
i created a method in the controller that calls a trello api i was wondering how to invoke this method in the seeder?
Just use the controller class
for example he created the controller dog.
within it I create a method:
public function _returnDog(Dog $dog) {
return $dog;
}
how do I call this method inside the seeder?
use App\Http\Controllers\DogController;
assuming that the name of your contriller class is DogController, if not, adjust
ok but then how do I call that function inside the seeder?
if I call it like this it gives me an error:
$this->_returnDog($dog);
@sr57
You have to instantiate your class first.
$obj1 = new ;
see last msg of @newbie360
Make an another class for that and then use it where you need.
Yes, like this:
$controller = new TheController();
$bar = $controller->methodYouWantToCall(...$args);
Please or to participate in this conversation.