Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/laravel/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 在抽象类中定义模型属性_Php_Laravel_Laravel 8 - Fatal编程技术网

Php 在抽象类中定义模型属性

Php 在抽象类中定义模型属性,php,laravel,laravel-8,Php,Laravel,Laravel 8,IDE无休止地提醒我们在使用模型键入提示函数参数时使用契约 我让步了,并试图通过为模型定义接口+抽象类来做正确的事情 我接着添加了一个接口和一个由模型扩展的抽象类: <?php namespace App\Models\I18n; use App\Models\Product; use Autogo\Contracts\Models\ProductInterface; abstract class ProductBase extends Base implements Product

IDE无休止地提醒我们在使用模型键入提示函数参数时使用契约

我让步了,并试图通过为模型定义接口+抽象类来做正确的事情

我接着添加了一个接口和一个由模型扩展的抽象类:

<?php

namespace App\Models\I18n;

use App\Models\Product;
use Autogo\Contracts\Models\ProductInterface;

abstract class ProductBase extends Base implements ProductInterface
{
    public ?Store $store = null;
    public ?int $id;
    public ?int $images;
    public ?int $price;
    public ?Supplier $supplier;
}