'date', 'planning' => 'array' ]; protected $fillable = [ 'start', 'planning', 'user_id' ]; public static function getWeekBlock(Carbon $start): array { $start = $start->copy(); $out = []; $daysOfWeek = 5; for ($i = 1; $i <= $daysOfWeek; $i++) { $out[$start->timestamp] = []; foreach (TableRow::toArray() as $tableRow) { $out[$start->timestamp][$tableRow->value] = \array_replace( self::getCell(), [ 'row' => $tableRow->value ] ); } $day = $start->addDay(); } return $out; } public static function getCell(): array { return [ /** @var \App\Enums\Planning\CellType */ 'type' => null, /** @var \App\Enums\Planning\TableRow */ 'row' => null, 'foreign' => null, /** @var \App\Enums\Planning\CellModel */ 'cellModel' => null, 'text' => '' ]; } public function user() { return $this->belongsTo(User::class); } }