【发布时间】:2018-02-08 10:37:45
【问题描述】:
我想在另一个名为“property”的模型中调用listcity函数
/model/Crawler.php
class Crawler extends Model {
public function listcity($statename)
{
$ins="exec Prc_Lst_CityMaster @CountryName = 'India', @StateName = '".$statename."'";
return DB::select($ins);
}
}
/model/Property.php
use App\Models\Crawler,
class Property extends Model {
public function __construct(Crawler $Crawler)
{
$this->Crawler = $Crawler;
}
public function propertyDetails($id)
{
$this->Crawler->listcity($id);
}
}
但我得到一个错误
错误异常 (E_NOTICE) 试图获取非对象的属性
【问题讨论】: