martinbean/eloquent-singular-table-names
Makes Eloquent models use singular (rather than plural) table names by default.
4,823
| Install | |
|---|---|
composer require martinbean/eloquent-singular-table-names |
|
| Latest Version: | v1.0.2 |
| License: | MIT |
| Last Updated: | Aug 26, 2015 |
| Links: | GitHub · Packagist |
Maintainer: martinbean
Eloquent singular table names
Makes Eloquent models use singular (rather than plural) table names by default.
Usage
Simple apply the trait to your Eloquent model:
namespace App;
use Illuminate\Database\Eloquent\Model;
use MartinBean\Database\Eloquent\SingularTableName;
class User extends Model
{
use SingularTableName;
}
The default table name will be user now, rather than users.
If you wish to use singular table names for all of your models, then you can create an abstract class that implements the trait, and have all of your models extend that class:
namespace App;
use Illuminate\Database\Eloquent\Model;
use MartinBean\Database\Eloquent\SingularTableName;
abstract class SingularModel extends Model
{
use SingularTableName;
}
namespace App;
class User extends SingularModel
{
// No need to implement trait
}
Related Packages
doctrine/dbal
Powerful PHP database abstraction layer (DBAL) with many features for database s...
637,827,751
9,703
laravel/serializable-closure
Laravel Serializable Closure provides an easy and secure way to serialize closur...
413,412,504
609
nunomaduro/collision
Cli error handling for console/command-line PHP applications.
394,964,158
4,660
Version History
| Version | Released | Laravel | License |
|---|---|---|---|
| v1.0.2 | ~5.0 | MIT | |
| v1.0.1 | ~4.0 | MIT | |
| v1.0.0 | ~4.0 | MIT |