PHP code example of marshmallow / dataset-google-product-categories

1. Go to this page and download the library: Download marshmallow/dataset-google-product-categories 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/ */

    

marshmallow / dataset-google-product-categories example snippets


use Marshmallow\Datasets\GoogleProductCategories\Models\GoogleProductCategory;

// All categories
$categories = GoogleProductCategory::all();

// Look up a category by its Google category id
$category = GoogleProductCategory::find(1);
$category->name;
bash
php artisan migrate
bash
php artisan db:seed --class="Marshmallow\Datasets\GoogleProductCategories\Seeds\GoogleProductCategorySeeder"
bash
php artisan marshmallow:resource GoogleProductCategory Datasets\\GoogleProductCategories