826行上的ReflectionException Container.php

时间:2019-02-03 10:14:40

标签: php laravel laravel-5.7

我在服务层有两个类 CashTransactionServices.php

namespace App\Services\Cash;

use App\Models\Cash\CashTransaction;
use App\Models\Cash\CashBoxTransaction;
use DB;

class CashTransactionServices {

    protected $AccountingAPI;

    public function __construct(AccountingAPI $acc) {

        $this->AccountingAPI = $acc;

    }

CashBoxTransactionServices.php

namespace App\Services\Cash;

use App\Models\Cash\CashBoxTransaction;

class CashBoxTransactionServices extends CashTransactionServices {}

和控制器

namespace App\Http\Controllers\Cash;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Services\Cash\CashBoxTransactionServices;

class CashBoxTransactionController extends Controller {

    //
    private $services;

    public function __construct(CashBoxTransactionServices $cash_box_transaction_services) {

        $this->services = $cash_box_transaction_services;
    }

我遇到此错误

ReflectionException:文件C:\ xampp \ htdocs \ easyerp \ vendor \ laravel \ framework \ src \ Illuminate \ Container \ Container.php在文件826中不存在App \ Services \ Cash \ CashBoxTransactionServices类

我确保使用正确的名称空间和正确的类名称!

PS:当我从CashBoxTransactionServices类中删除inheretance时,它起作用了!

0 个答案:

没有答案