我创造了一个叫“歌”的新班。
类app/ClassName的位置,所以它的app/ so s.php
<?php
namespace App;
use Illuminate\Database\Eloquent\Model as Eloquent;
class Song extends Eloquent {
//put your code here
}
我的路线:
Route::get('/','SongsController@index');
我的SongsController.php位置:app/Http/controller/Http sControl
所以我有两个表,文章和sub_categories。它们是通过Eloquent链接的:文章有很多子类别,以及sub_categories belongsTo文章。它们与外键链接在一起:在“文章”categorie_id中。 如何检索整个表数据文章,其中categorie是“狗”的示例抱歉的抽象,但这是我能解释的最好的方式?:D 文章模型 <?php
namespace App;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class Articles ex
我在我的项目中使用了laravel 5.8,因为我在特征中删除了LaravelSubQueryTrait,所以我得到了错误Bad call Call to undefined method Illuminate\Database\Eloquent\Builder::withSum()。当我重新添加LaravelSubQueryTrait时,我的项目没有运行,我得到了这个错误Trait method newBaseQueryBuilder has not been applied, because there are collisions with other trait methods on