laravel eloquent implementation principle
滿天的星座
滿天的星座 2017-05-16 16:56:22
0
4
691

laravel eloquent implementation principle

滿天的星座
滿天的星座

reply all(4)
世界只因有你

For example:
<?php

class BusinessWork extends Eloquent
{

/**
 * The database table used by the model.
 * @var string
 */
protected $table = 'businessWork';
protected $connection = 'mysql';
public $timestamps = 0;
protected $fillable = array(
    'businessId',
    'title',
    'content',
    'createAt',
);

}

BusinessWork::find(1); This is how table binding is implemented

Ty80

Let me try to answer. I'm not familiar with it, I'm new to it, I hope I'm not misleading.
You can see that BusinessWork inherits Eloquent and has its own tables, operable field properties, etc.
BusinessWork::find(1) is inherited from Eloquent. It also has some common operations such as fetching all records: BusinessWork::all(), which can also be rewritten in BusinessWork.
You can take the time to go out and turn left to Baidu or right to Google to download Laravel's Eloquent ORM documentation.
hope this helps.

習慣沉默

Use the class reflection mechanism to obtain the class name, and then parse it into a table name.
Any questions?

淡淡烟草味

For delayed binding implementation, refer to PHP 5.3’s static

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!