Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
saade committed Mar 26, 2024
1 parent 64c0255 commit 3d7d7a5
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
3 changes: 3 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
"spatie/laravel-ray": "^1.26"
},
"autoload": {
"files": [
"src/helpers.php"
],
"psr-4": {
"Saade\\FilamentFullCalendar\\": "src"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@

use Saade\FilamentFullCalendar\FilamentFullCalendarPlugin;

use function Saade\FilamentFullCalendar\array_merge_recursive_unique;

trait CanBeConfigured
{
public function config(): array
{
return [];
}



protected function getConfig(): array
{
return array_merge_recursive(
return array_merge_recursive_unique(
FilamentFullCalendarPlugin::get()->getConfig(),
$this->config(),
);
Expand Down
17 changes: 17 additions & 0 deletions src/helpers.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

namespace Saade\FilamentFullCalendar;

if(! function_exists('Saade\FilamentFullCalendar\array_merge_recursive_unique')) {
function array_merge_recursive_unique(array $array1, array $array2): array {
foreach ($array2 as $key => $value) {
if (is_array($value) && isset($array1[$key]) && is_array($array1[$key])) {
$array1[$key] = array_merge_recursive_unique($array1[$key], $value);
} else {
$array1[$key] = $value;
}
}

return $array1;
}
}

0 comments on commit 3d7d7a5

Please sign in to comment.