首页 \ 问答 \ Eloquent模型是否与MVC模型相同(在laravel中)?(Is an Eloquent Model the same as a MVC model (in laravel)?)

Eloquent模型是否与MVC模型相同(在laravel中)?(Is an Eloquent Model the same as a MVC model (in laravel)?)

我看过这篇文章( Eloquent模型和模型之间的区别? )但它没有明确地回答我的问题。

我可能没有在这里使用正确的术语......

我理解Eloquent是“......用于处理数据库的ActiveRecord实现......”正如文档中所述。 但是我不清楚的是这些雄辩的模型与MVC意义上的模型之间的区别。

如果我在特定的laravel应用程序中说这样做,那听起来合乎逻辑吗?

  1. 会有很多模型,其中一些是Eloquent模型,其中一些是MVC意义上的模型。
  2. 雄辩的模型非常精简和纯粹的类,允许与数据库层交互。
  3. 相比之下,MVC模型可能包含各种业务规则和逻辑
  4. 这两种类型都可以通过php artisan make:model轻松创建,尽管有一个Eloquent模型,人们可能希望同时创建迁移。
  5. 除非另有组织,否则所有模型都存储在同一个地方。 这并不是说有一些外部可见的位置或命名约定来表明这是一个Eloquent Model或MVC模型。

......那是对的吗?


I saw this post (The difference between an Eloquent Model and a Model?) but it doesn't explicitly answer the question for me.

I may not be using the right terminology here...

I understand Eloquent to be "...an ActiveRecord implementation for working with your database..." as it says in the documentation. But is what is not clear to me is difference between these eloquent models, and models as one refers to them in the MVC sense.

Does it sound logical if I was to say that in a particular laravel application

  1. there will be many models, some of which are Eloquent models, and some of which are models in the MVC sense.
  2. Eloquent models are quite lean and pure classes, allowing interaction with the database layer.
  3. MVC models, by comparison may contain all sorts of business rules & logic
  4. Both types are easily created by php artisan make:model although with an Eloquent model one might want to create the migration at the same time.
  5. All models are stored in the same place, unless otherwise organised. It's not as if there is some externally visible location or naming convention to indicate that this is an Eloquent Model, or a MVC model.

...is that about right?


原文:https://stackoverflow.com/questions/38825825
更新时间:2022-04-01 20:04

最满意答案

(我将在这里复制我的答案 。)你可以使用sloecode来托管集市分支,你可以使用loggerhead来获取代码的web视图。 另一个需要考虑的选择是fusionforge.org我认为在Ubuntu上你最近可以得到它。


(I'll copy my answer from another question here.) You can use sloecode for hosting bazaar branches and you can use loggerhead for a web view of the code. Another option to consider is fusionforge.org I think on Ubuntu you can apt-get that these days.

相关问答

更多
  • bzr blame 将向您显示哪些行引入了哪些更改: $ bzr blame Makefile 548 steve-b | # | # 861 steve-b | OVERRIDE_TARBALL=yes 548 steve-b | | include common/Make.rules | | DIRS=parser ...
  • Assembla为您提供了在同一项目中添加多个存储库的可能性,或者他们称之为空间的多个存储库,并且在每个存储库上每个角色(观察者,成员,所有者)拥有不同的权限。 或者您可以选择一个投资组合解决方案来管理具有不同团队和权限的单个投资组合内的多个空间 这是一个复杂的产品,可以做很多事情,只需要花时间并深入检查。 I have since looked around a little bit and believe I have found a svn solution for the kind of acces ...
  • 这取决于你对“问题”的理解。 有些人在日常工作中使用bzr,从未遇到任何使他们的工作变得不可能或非常困难的问题。 这并不意味着bzr中没有奇怪的特征或怪癖。 如果您了解自己在做什么,这意味着您可以轻松使用bzr。 一般来说,bzr非常适合工作的VCS,但要有效地使用它,你最好知道你的限制。 如果您将开始使用bzr,您应该了解分支,存储库,共享存储库和工作树之间的区别。 共享存储库如何帮助您完成工作以及如何在其中保留分支。 您应该了解普通分支和结帐/轻量级结账之间的区别。 如果您想继续使用CVS样式,您可能希 ...
  • 如果我是你,我会写自己的插件。 您将在CC.NET存储库中的project / core / sourcecontrol下找到当前实现的源代码控件。 你需要一些东西。 一个是主类,它将继承自ProcessSourceControl并且应该基于当前的源控件提供程序。 这个初始类将实现GetModifications,LabelSourceControl和GetSource之类的东西。 然后,您将需要一些辅助类,它们是historyparser类和urlbuilder类。 这些特定于每个源控件提供程序,并负责解 ...
  • (我将在这里复制我的答案 。)你可以使用sloecode来托管集市分支,你可以使用loggerhead来获取代码的web视图。 另一个需要考虑的选择是fusionforge.org我认为在Ubuntu上你最近可以得到它。 (I'll copy my answer from another question here.) You can use sloecode for hosting bazaar branches and you can use loggerhead for a web view of t ...
  • 使用go get你处理包而不是git refs或文件系统路径。 尝试 go get launchpad.net/ubuntu-push With go get you work on packages and not on git refs or file system paths. Try go get launchpad.net/ubuntu-push
  • 我认为bzr heads应该做你需要的东西(它是bzrtools插件的一部分,它应该是标准发行版的一部分)。 请注意,如果bzr heads则不会在不同目录中显示不同的分支。 它检查存储库结构的DAG,而不是目录布局。 I think bzr heads should do what you need (it's part of the bzrtools plugin, which should be part of the standard distribution). Note that bzr hea ...
  • 我不完全确定你的帖子你在寻找什么。 我正在试着给出答案; 如果那不是您需要的,请告诉我。 以下是将所有分支从源复制到目标仓库的简单脚本。 请注意,如果分支目录名称包含任何空格,它将不起作用。 您必须首先使用bzr init-repo设置目标存储库。 #!/bin/sh SOURCEREPO=$1 TARGETREPO=$2 if [ ! -d "$TARGETREPO/.bzr" ]; then echo "$TARGETREPO is not a Bazaar repository; create o ...
  • 我假设你已经在〜/ .bazaar / authentication.conf等效的windows中设置了身份验证(使用bzr version -v来获取正确的位置)。 哈德森是否与用于连接命令行的用户运行相同的用户? 因为这将影响它将尝试使用哪个authentication.conf。 我的hudson正在使用authentication.conf,但我在Ubuntu上运行它。 I solved the problem. The authentication.conf is not being consi ...
  • 自动生成显示明智版本号的Id标签是无法使用像Bazaar这样的DSCM工具的,因为每个人的开发路线都可能与其他所有路线不同。 所以有人可以参考一个文件的版本“1.41”,但是该文件的版本“1.41”是不同的。 基本上,$ Id $对Bazaar,Git和其他分布式源代码管理工具没有任何意义。 Having automatically generated Id tags that show a sensible version number is impossible to do with DSCM tool ...

相关文章

更多

最新问答

更多
  • 获取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的基本操作命令。。。