我不知道爲什麼我收到此錯誤:當我剛DD-ING的結果值laravel未定義的屬性(資料庫)
MedicineCOntroller.php
Undefined property: App\Repositories\Admin\MedicineRepository::$getMedicineInformation
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Repositories\Admin\MedicineRepository;
use App\Http\Requests;
use App\Dosage;
class MedicineController extends Controller
{
public function __construct(MedicineRepository $MedicineRepository)
{
$this->MedicineRepository = $MedicineRepository;
}
public function getMedicine()
{
$medicine = $this->MedicineRepository->getMedicineInformation;
dd($medicine);
//return view('admin.show-medicines',compact('dosage'));
}
}
MedicineRepository.php
<?php
namespace App\Repositories\Admin;
use App\Medicine,
App\Dosage;
class MedicineRepository
{
public function __construct(Medicine $medicine, Dosage $dosage){
$this->medicine = $medicine;
$this->dosage = $dosage;
}
public function getMedicineInformation()
{
return $medicine
->join($this->dosage,'medicines.id' ,'=', 'dosages.medicine_id')
->select('generic_name','dosages.dosage_name');
}
}
嗨,老兄,我能問什麼? – d3cypher