This commit is contained in:
2021-11-30 15:10:01 +08:00
parent f50782c930
commit 6936b5cc8f
6 changed files with 16 additions and 16 deletions
+41
View File
@@ -0,0 +1,41 @@
<?php
namespace Database\Note;
use Note\Attribute;
use Database\Base\Relate;
use Exception;
/**
* Class Relation
* @package Note\Model
*/
#[\Attribute(\Attribute::TARGET_METHOD)] class Relation extends Attribute
{
/**
* Relation constructor.
* @param string $name
*/
public function __construct(public string $name)
{
}
/**
* @param mixed $class
* @param mixed|null $method
* @return bool
* @throws Exception
*/
public function execute(mixed $class, mixed $method = null): bool
{
di(Relate::class)->addRelate($this->name, $class, $method);
return true;
}
}