lopatin96/laravel-cashier-shop
最新稳定版本:1.0.88
Composer 安装命令:
composer require lopatin96/laravel-cashier-shop
包简介
Laravel cashier shop
README 文档
README
Create app/View/Components/ShopLayout.php.
<?php namespace App\View\Components; use Illuminate\View\Component; use Illuminate\View\View; class ShopLayout extends Component { public function render(): View { return view('layouts.shop'); } }
Create resources/views/layouts/shop.blade.php.
Trait
Add HasOrders trait and cast to User model.
use Atin\LaravelCashierShop\Traits\HasOrders; class User extends Authenticatable { use HasOrders; protected $casts = [ … 'shop_visited_at' => 'datetime', ];
Products
Create app/Products directory and TestProduct class:
<?php namespace App\Products; use App\Models\User; use Atin\LaravelCashierShop\Interfaces\Product; use Atin\LaravelCashierShop\Models\Order; class TestProduct implements Product { public function process(Order $order): void { // TODO: Implement process() method. } public function isListed(User $user): bool { // TODO: Implement isListed() method. } public function isPurchasable(User $user): bool { // TODO: Implement isPurchasable() method. } }
Console
Add DeleteTooOldIncompleteOrders to app/Console/Kernel.php
use Atin\LaravelCashierShop\Console\DeleteTooOldIncompleteOrders; class Kernel extends ConsoleKernel { protected function schedule(Schedule $schedule): void { $schedule->call(new DeleteTooOldIncompleteOrders)->daily();
Publishing
Localization
php artisan vendor:publish --tag="laravel-cashier-shop-lang"
Views
php artisan vendor:publish --tag="laravel-cashier-shop-views"
Config
php artisan vendor:publish --tag="laravel-cashier-shop-config"
Migrations
php artisan vendor:publish --tag="laravel-cashier-shop-migrations"
统计信息
- 总下载量: 4.86k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-03-20