seshac/laravel-shiprocket-api

Call to undefined method Seshac\Shiprocket\ShiprocketApi::token()

Closed this issue · 4 comments

Screenshot from 2021-02-12 17-08-14

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')
        ]);
    }

Please use Seshac\Shiprocket\Shiprocket::token()

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;

@surajitbasak109 ,

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.

@seshac
Thank you. :)
Nice api sdk. And got token back when used token method.