PHP code example of lopatin96 / laravel-cashier-shop
1. Go to this page and download the library: Download lopatin96/laravel-cashier-shop library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
lopatin96 / laravel-cashier-shop example snippets
namespace App\View\Components;
use Illuminate\View\Component;
use Illuminate\View\View;
class ShopLayout extends Component
{
public function render(): View
{
return view('layouts.shop');
}
}
use Atin\LaravelCashierShop\Traits\HasOrders;
class User extends Authenticatable
{
use HasOrders;
protected $casts = [
…
'shop_visited_at' => 'datetime',
];
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.
}
}
use Atin\LaravelCashierShop\Console\DeleteTooOldIncompleteOrders;
class Kernel extends ConsoleKernel
{
protected function schedule(Schedule $schedule): void
{
$schedule->call(new DeleteTooOldIncompleteOrders)->daily();