PHP code example of meubleo / shop

1. Go to this page and download the library: Download meubleo/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/ */

    

meubleo / shop example snippets


return [
    'prefix'   => 'admin',          // Admin URL prefix
    'provider' => \App\Meubleo\MeubleoServiceProvider::class,
    'shop_name' => 'My Shop',
    'tax_rate'  => 0.20,
    'free_shipping_threshold' => 500,
    'shipping_cost'           => 29.90,
    'stripe' => [
        'key'    => env('STRIPE_KEY'),
        'secret' => env('STRIPE_SECRET'),
    ],
];

// app/Meubleo/Screens/ProductListScreen.php
class ProductListScreen extends Screen
{
    public function query(): iterable
    {
        return ['products' => Product::paginate(20)];
    }

    public function commandBar(): iterable
    {
        return [
            Link::make('New')->icon('bs.plus')->route('meubleo.admin.products.create'),
        ];
    }

    public function layout(): iterable
    {
        return [ProductTableLayout::class];
    }
}

class ProductTableLayout extends Table
{
    protected string $target = 'products';

    protected function columns(): iterable
    {
        return [
            TD::make('name', 'Product')->sort(),
            TD::make('price', 'Price')
                ->alignRight()
                ->render(fn($p) => meubleo_price($p->price)),
            TD::make('stock', 'Stock')
                ->render(fn($p) => '<span class="badge bg-success">'.$p->stock.'</span>'),
        ];
    }
}

class ProductFormLayout extends Rows
{
    protected function fields(): iterable
    {
        return [
            Input::make('product.name')->title('Name')->ke('product.price')->title('Price')->type('number'),
            Switcher::make('product.is_featured')->title('Featured'),
        ];
    }
}
bash
php artisan meubleo:admin
# or with arguments:
php artisan meubleo:admin "John Doe" [email protected] secret123
bash
php artisan meubleo:screen ProductListScreen
bash
php artisan meubleo:table ProductTableLayout
bash
php artisan meubleo:rows ProductFormLayout