-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
25 changed files
with
236 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Concerns; | ||
|
||
use Illuminate\Support\Facades\Cache; | ||
|
||
trait ClearsCache | ||
{ | ||
abstract public function getCacheTags(): array; | ||
|
||
public static function bootClearsCache(): void | ||
{ | ||
self::created(fn (self $model) => self::clearCache($model)); | ||
self::updated(fn (self $model) => self::clearCache($model)); | ||
self::deleted(fn (self $model) => self::clearCache($model)); | ||
} | ||
|
||
private static function clearCache(self $model): void | ||
{ | ||
Cache::tags($model->getCacheTags())->flush(); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Models; | ||
|
||
use App\Concerns\ClearsCache; | ||
use Datlechin\FilamentMenuBuilder\Models\Menu as BaseMenu; | ||
|
||
class Menu extends BaseMenu | ||
{ | ||
use ClearsCache; | ||
|
||
public function getCacheTags(): array | ||
{ | ||
return ['menus']; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Models; | ||
|
||
use App\Concerns\ClearsCache; | ||
use Datlechin\FilamentMenuBuilder\Models\MenuItem as BaseMenuItem; | ||
|
||
class MenuItem extends BaseMenuItem | ||
{ | ||
use ClearsCache; | ||
|
||
public function getCacheTags(): array | ||
{ | ||
return ['menus']; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Models; | ||
|
||
use App\Concerns\ClearsCache; | ||
use Datlechin\FilamentMenuBuilder\Models\MenuLocation as BaseMenuLocation; | ||
|
||
class MenuLocation extends BaseMenuLocation | ||
{ | ||
use ClearsCache; | ||
|
||
public function getCacheTags(): array | ||
{ | ||
return ['menus']; | ||
} | ||
} |
Oops, something went wrong.