This commit is contained in:
xiaomlove
2024-10-08 00:22:52 +08:00
parent 000862fd8f
commit 9fec1a7ede
5 changed files with 46 additions and 14 deletions

View File

@@ -2,9 +2,7 @@
namespace Nexus\Plugin;
use App\Repositories\BaseRepository;
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\Artisan;
use Nexus\Database\NexusDB;
abstract class BasePlugin extends BaseRepository
{
@@ -44,4 +42,14 @@ abstract class BasePlugin extends BaseRepository
$pluginRoot = dirname($reflection->getFileName(), 2);
return $pluginRoot . "/resources/views/" . trim($name, "/");
}
public function trans($name): string
{
return nexus_trans(sprintf("%s::%s", static::ID, $name));
}
public static function getInstance(): static
{
return Plugin::getById(static::ID);
}
}