invisnik/laravel-steam-inventory

Laravel Steam Inventory

v1.1.0 2018-09-07 15:33 UTC

This package is auto-updated.

Last update: 2024-09-20 08:18:10 UTC


README

Code Climate Latest Stable Version Total Downloads License

依赖项

  • Laravel 缓存驱动程序,支持标签。例如 RedisMemcached

通过 Composer 安装

将以下内容添加到您的 composer.json 文件中的 require 对象

"invisnik/laravel-steam-inventory": "1.*"

然后,运行 composer install 以安装软件包。

Laravel 5.4 及以下版本

将服务提供者添加到 app/config/app.php 中的 providers 数组。

'providers' => [
	// ...
	Invisnik\LaravelSteamInventory\ServiceProvider::class,
]

如果您使用的是 Laravel 5.5,软件包将自动添加。

配置文件

最后,发布配置文件并配置它。

php artisan vendor:publish

使用示例

namespace App\Http\Controllers;

use Invisnik\LaravelSteamInventory\SteamInventory;

class YourController extends Controller
{
    /**
     * @var SteamInventory
     */
    private $steamInventory;

    public function __construct(SteamInventory $steamInventory)
    {
        $this->steamInventory = $steamInventory;
    }

    public function index()
    {
    	$user = App\User::find(1);
	// $user->steamid = '76561198233097000'
    	$items = $this->steamInventory
		->loadInventory($user->steamid, 730)->getInventoryWithDescriptions();
		
	return view('your.view.file', compact('items'));
    }
}