简介 编写数据填充类 使用模型工厂类 调用额外填充类 执行填充 #简介 Laravel includes a simple method of seeding your database with test data using seed classes. All seed classes are stored in database/seeds. Seed classes may have any name you wish, but probably should follow some s…
Eloquent: Serialization Introduction Basic Usage Hiding Attributes From JSON Appending Values To JSON Introduction When building JSON APIs, you will often need to convert your models and relationships to arrays or JSON. Eloquent includes convenient m…
Eloquent: Mutators Introduction Accessors & Mutators Date Mutators Attribute Casting Introduction Accessors and mutators allow you to format Eloquent attributes when retrieving them from a model or setting their value. For example, you may want to us…
Eloquent: Collections Introduction Available Methods Custom Collections Introduction All multi-result sets returned by Eloquent are an instance of theIlluminate\Database\Eloquent\Collection object, including results retrieved via the get method or ac…
Eloquent: Relationships Introduction Defining Relationships One To One One To Many Many To Many Has Many Through Polymorphic Relations Many To Many Polymorphic Relations Querying Relations Eager Loading Constraining Eager Loads Lazy Eager Loading Ins…
介绍 建立迁移文件 迁移文件结构 执行迁移 回滚迁移 填写迁移文件 创建表 重命名/ 删除表 创建字段 修改字段 删除字段 建立索引 删除索引 外键约束 #介绍 Migrations are like version control for your database, allowing a team to easily modify and share the application's database schema. Migrations are typically paired wit…