I have controller file that has a function login() that logs in(authenticates and returns a token) to some third party portal. Now i want to reuse that controller function in a custom command. Please suggest how to do so. My controller file looks like this-
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class mmt extends Controller {
public function login() {
//code to login to third party portal
// returns a token after successful login
}
my custom command file located in app/Console/Commands looks like this-
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
class RcvSurveyEmails extends Command {
protected $signature = 'RcvSurveyEmails:name';
protected $description = 'command description here';
public function handle(){
//I need to use the login() function here and get the token.
}
?>
I search online for similar solution but could not fine any