PHP code example of digital-creative / nova-json-wrapper

1. Go to this page and download the library: Download digital-creative/nova-json-wrapper 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/ */

    

digital-creative / nova-json-wrapper example snippets


class User extends Model
{
    protected $casts = [
        'options' => 'array'
    ];
}


use DigitalCreative\JsonWrapper\JsonWrapper;
use DigitalCreative\JsonWrapper\HasJsonWrapper;

class User extends Resource
{
    use HasJsonWrapper; // Important!

    public function fields(Request $request)
    {
        //...
        JsonWrapper::make('options', [

            Text::make('First Name')->rules('

public function fields(Request $request)
{
    Select::make('Type')
          ->options([
              1, 2, 3, 4, 5
          ])
          ->rules('ke('Last Name')->rules('               ->rules('=== female'),

        ])

    ])->if('type >= 2'),
}