我想通过使用“USE”为模型类的名称提供别名来使用laravel雄辩方法中的相关模型的类名。例如,我已经使用用户配置模型类: namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use App\Models\UserProfile;
,现在我用它雄辩如下: public function profileDetails(
class Like(models.Model):
user = models.ForeignKey(User)
picture = models.ForeignKey(Picture)
created = models.DateTimeField(auto_now_add=True)
或者 class Like(models.Model):
user
每次我试图得到一个相关的对象,我得到的错误不设置到对象 相关代码的实例 对象引用: public class Project
{
public int ProjectId { get; set; }
public string ProjName { get; set; }
public string Description { get; set; }
pu