1: <?php
2:
3: namespace LaravelUi5\Core\Ui5;
4:
5: use LaravelUi5\Core\Exceptions\MissingCardManifestException;
6: use LaravelUi5\Core\Traits\SluggedSource;
7: use LaravelUi5\Core\Ui5\Contracts\Ui5CardInterface;
8: use LaravelUi5\Core\Ui5\Contracts\Ui5ModuleInterface;
9:
10: abstract class AbstractUi5Card implements Ui5CardInterface
11: {
12: use SluggedSource;
13:
14: public function __construct(protected Ui5ModuleInterface $module)
15: {
16: }
17:
18: public function getModule(): Ui5ModuleInterface
19: {
20: return $this->module;
21: }
22:
23: public function getManifest(): string
24: {
25: $path = $this->getModule()
26: ->getSourceStrategy()
27: ->resolvePath("cards/{$this->getSlug()}.blade.php");
28:
29: if (!file_exists($path)) {
30: throw new MissingCardManifestException($path);
31: }
32:
33: return file_get_contents($path);
34: }
35: }
36: