Call to undefined method Seshac\Shiprocket\ShiprocketApi::token()
Closed this issue · 4 comments
surajitbasak109 commented
I am using Ubuntu 20.10 OS.
PHP Version: 7.2
I published the vendor file using following command:
php artisan vendor:publish --provider="Seshac\Shiprocket\ShiprocketServiceProvider" --tag="config"
Suggestion
Please add this method after the constructor in ShiprocketApi class:
/**
* Get the login details including token (valid for 24 hours)
*
* @return mixed
*/
public function token()
{
return $this->login([
'email' => config('shiprocket.credentials.email'),
'password' => config('shiprocket.credentials.password')
]);
}
seshac commented
Please use Seshac\Shiprocket\Shiprocket::token()
surajitbasak109 commented
Please use Seshac\Shiprocket\Shiprocket::token()
I am alerady using the same namespace as you mentioned. And please check your ShiprocketApi.php class file. There is no token method in your class. I have foked your repo and used it
use Seshac\Shiprocket\Shiprocket;
seshac commented
It's uses Laravel facade, you find all methods in ShiprocketApi.php file.
I updated the docs, to get token use Seshac\Shiprocket\Shiprocket::getToken()
Thanks.
surajitbasak109 commented
@seshac
Thank you. :)
Nice api sdk. And got token back when used token method.