PHP code example of dev1437 / pinia-model-generator

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

    

dev1437 / pinia-model-generator example snippets


use Dev1437\PiniaModelGenerator\PiniaModelsBuilder;

// Default
$pmb = new PiniaModelsBuilder();
// Specify a different path e.g. to have the model put in resources/ts/pinia
$pmb = new PiniaModelsBuilder(resource_path('ts/pinia')); 
// Generate code for specific models
use App\Models\User;
use App\Models\Post;

$pmb = new PiniaModelsBuilder(null, [], [
    User::class,
    Post::class
]);
// Specify options for specific model e.g. Include hidden fields and remove email_verified_at from User
use App\Models\User;

$pmb = new PiniaModelsBuilder(null, [
    User::class => [
        'ignoreHidden' => false,
        'filters' => [
            'email_verified_at',
        ],
    ]
]);

$pmb->buildModels();

...
/* --- user header --- */
/* --- end user header --- */
...
/* --- user code --- */
/* --- end user code --- */
...