首页 \ 问答 \ 雄辩模型与模型的区别?(The difference between an Eloquent Model and a Model?)

雄辩模型与模型的区别?(The difference between an Eloquent Model and a Model?)

所以,我对此感到困惑:在Laravel的官方文档中,他们说:

Laravel附带的Eloquent ORM为您的数据库提供了一个美丽的,简单的ActiveRecord实现。 每个数据库表都有一个对应的“模型”,用于与该表进行交互。

Ok util这里都很棒,我明白了!

所以我做了一个迁移来创建一个数据库: php artisan make:migration create_items_table --create =“items”

太好了,直到这里:)

所以从理论上讲,当我将make: php artisan make:model Item时 ,Laravel将创建一个php类(用于与items表进行交互):

   class Item extends Eloquent {

     ...

    }

但是,在现实世界中,当我做: php artisan make:model Item ,Laravel创建php类(用于与items表交互)::

   class Item extends Model {

     ...

    }

那么为什么模型而不是雄辩? 我错过了什么? 雄辩模型和模型有什么区别。

如果有差异,我应该何时使用雄辩和模型...?

谢谢^^


So, i'm confused with this : In Laravel's official documentation, they say :

The Eloquent ORM included with Laravel provides a beautiful, simple ActiveRecord implementation for working with your database. Each database table has a corresponding "Model" which is used to interact with that table.

Ok util here all is Great, i get it !

So I make a migration to create a database : php artisan make:migration create_items_table --create="items"

Great until here too :)

So theoretically speaking, when i will make : php artisan make:model Item , Laravel will create a php class ( which is used to interact with items table) :

   class Item extends Eloquent {

     ...

    }

But,in real world, when i make : php artisan make:model Item , Laravel creates php class ( which is used to interact with items table) ::

   class Item extends Model {

     ...

    }

So Why Model and not Eloquent ?? Am i missing sth ? And What's the difference between Eloquent Model and Model.

And if there's a difference, when should i use Eloquent and when Model ... ?

Thank you ^^


原文:https://stackoverflow.com/questions/31380624
更新时间:2023-05-22 21:05

最满意答案

这是一个文档限制,Silverlight版本5不支持您尝试使用的构造函数。来自MSDN文章

受以下支持:4,3

不是水晶,为什么它被丢弃,可能与它有关[SecurityCritical]。

为什么你的IntelliSense仍然显示它很难猜测,我当然不能重复。 您可能应该验证mscorlib引用的路径,我的指向C:\ Program Files(x86)\ Reference Assemblies \ Microsoft \ Framework \ Silverlight \ v5.0 \ mscorlib.dll


It is a documented restriction, the constructor you are trying to use is not supported in Silverlight version 5. From the MSDN article:

Supported in: 4, 3

Not crystal why it was dropped, probably has something to do with it being [SecurityCritical].

Why your IntelliSense still shows it is hard to guess, I certainly can't repro that. You probably ought to verify the path to the mscorlib reference, mine points to C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\Silverlight\v5.0\mscorlib.dll

相关问答

更多

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。