PHP code example of imagina / ischedulable-module

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

    

imagina / ischedulable-module example snippets


      use Modules\Ischedulable\Support\Traits\Schedulable;
    
      class YourEntityClass extends CrudModel
      {
        use Translatable, Schedulable;
      
        // Your entity code...
      }
      

        //Entity Data
        {
        // Your entity attributes/data..
        
        // Schedule data to sync with the entity
        "schedule": {
          "zone": "main",
          "status": 1,
          "from_date" : "2021-03-08 08:00",
          "to_date" : "2021-03-08 08:00",
          "work_times": [
            {
              "day_id": 2,
              "start_hour": "2021-03-08 08:00",
              "end_hour": "2021-03-08 10:00",
              "shift_time" : "60",
            },
            {
              "day_id": 1,
              "start_hour": "2021-03-08 07:00",
              "end_hour": "2021-03-08 12:30",
              "shift_time" : "60",
            }
         ]
        }
      }
      

                  //Obtain the shifts to 2021-09-01 until 2021-09-03 according to workTimes by day of the shedule model
                  $scheduleModel->getShifts(['dateRange' => ['2021-09-01', '2021-09-03']])
                  

                  $scheduleModel->getShifts([
                    'busyShifts' => [
                      ['startTime' => '06:00:00', 'endTime' => '08:22:00', 'calendarDate' => '2021-09-06'],
                      ['startTime' => '06:00:00', 'endTime' => '07:22:00', 'calendarDate' => '2021-09-02'],
                      ['startTime' => '08:00:00', 'endTime' => '09:00:00', 'calendarDate' => '2021-09-03'],
                    ]
                  ]);
                  

              //You get a array of arrays with shifts on this format
              [▼
                "busyBy" => [/*busy model set on parameter busyShift*/]
                "calendarDate" => "2021-09-06"
                "day" => //Modules\Ischedulable\Entities\Day Model 
                "dayId" => 1 //Iso Day
                "endTime" => "09:00:00"
                "isBusy" => 1
                "scheduleId" => 7
                "startTime" => "08:00:00"
              ] 
              

          $workTimeModel->getShifts()
          
bash
php artisan module:enable Ischedulable