找回密码
 注册

QQ登录

只需一步,快速开始

BCM 门户 IT世界 资料备录 查看内容

Architecture of Laravel Applications

2014-1-13 15:16| 发布者: Test| 查看: 733| 评论: 0|来自: laravel book

摘要: Laravel is referred to as a “full stack” framework because it handles everything from web serving to database management right down to HTML generation. A vertically integrated web development enviro ...
Data Models


At the base of any application are the data models that describe the business rules of your application. Each piece of data is represented by using a database table. Laravel provides a few technologies to simplify access to databases.

Laravel connects the application data models and database tables by turning table rows from the database into PHP objects that can be easily manipulated. It also enables you to enforce business rules, describe relationships between the different data models in your application and so on. For example, a person’s family relationships can be described using Laravel’s Eloquent OR/M as follows:

class Person extends Eloquent
{
    public function mother()
    {
        return $this->belongsTo('Mother');
    }

    public function father()
    {
        return $this->belongsTo('Father');
    }

    public function spouse()
    {
        return $this->hasOne('Spouse');
    }

    public function sisters()
    {
        return $this->hasMany('Sister');
    }

    public function brothers()
    {
        return $this->hasMany('Brother');
    }
}
123

鲜花

握手

雷人

路过

鸡蛋

相关阅读

手机版|小黑屋|BC Morning Website ( Best Deal Inc. 001 )

GMT-8, 2026-4-12 06:23 , Processed in 0.014880 second(s), 18 queries .

Supported by Weloment Group X3.5

© 2008-2026 Best Deal Online

返回顶部