theoluirard/laravel-get-table-name
最新稳定版本:v1.0.3
Composer 安装命令:
composer require theoluirard/laravel-get-table-name
包简介
A package that adds a trait to the Laravel Model class and extends the Laravel Relation class with two new types of relations.
README 文档
README
This package provides a way to get statically table name and primary key in laravel
Features
- Implement 2 methods to retrieve table name & primary key name
Installation
To install the package, use the following command:
composer require theoLuirard/laravel-get-table-name
Configuration
Add the trait to your model
Simply add the trait to your model definition
<?php namespace App\Models; use HasTreeStructure; use Illuminate\Database\Eloquent\Model; class MyModel extends Model { use HasTreeStructure; }
Usage
To get the table name statically
MyModel::getTableName(); // Returns "my_table_name" MyModel::getTableName(true); // Returns "my_connection.my_table_name"
To get the primary key name statically
MyModel::getTableName(); // Returns "my_primary_key" MyModel::getTableName(true); // Returns "my_table_name.my_primary_key"
统计信息
- 总下载量: 10
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 4
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-04-16