PHP code example of illizian / nova-carbon-modifier-field

1. Go to this page and download the library: Download illizian/nova-carbon-modifier-field 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/ */

    

illizian / nova-carbon-modifier-field example snippets


/* ... */
use \Illizian\NovaCarbonModifier\NovaCarbonModifier;
/* ... */

class Example extends Resource
{
    /* ... */
    public function fields(Request $request)
    {
        return [
            /* ... */
            NovaCarbonModifier::make(__('Modifier'), 'modifier'),
        ];
    }

/* ... */
use \Illizian\NovaSuggestWrapper\NovaSuggestWrapper;
/* ... */

class Example extends Resource
{
    /* ... */
    public function fields(Request $request)
    {
        return [
            /* ... */
            NovaCarbonModifier::make(__('Modifier'), 'modifier')
                ->popular('startOfWeek,hour:10,minute:0', 'subDays:1,hour:13,minute:0'),
        ];
    }

use \Carbon\Carbon;
use \Illizian\NovaSuggestWrapper\NovaSuggestWrapper;

$date = Carbon::now();
$modifiers = 'startOfWeek,hour:10,minute:0';

$date_modified = NovaCarbonModifier::applyModifier($date, $modifiers);