Laravel associated model can't find the Model?
PHP中文网
PHP中文网 2017-05-16 16:52:04
0
3
430

I put the Models file under AppModels

PHP中文网
PHP中文网

认证高级PHP讲师

reply all(3)
PHPzhong

It must be written completely. When this code is actually parsed, it will not be clear where the Class you specified is, so you have to write the complete namespace

->belongsTo('AppModelsGroup', 'uid', 'gid')

or

->belongsTo(AppModelsGroup::class, 'uid', 'gid')

为情所困

Check whether your space name path is the same as your current path

刘奇

Add

to the beginning of the file in the current screenshot (the next line of <?php)
namespace App\Models;
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!