I have a file called InvoiceDataSource.php and it's path is app\Core\Forms\Invoice\InvoiceDataSource.php, and that file contains this.
<?php
namespace App\Core\Forms\Invoice;
class InvoiceDataSource {
public function getAllCustomers(){
return Customer::selectRaw('id as `value`,'.
'name as `label`')
->get()
->toArray();
}
}
?>
I have included this in composer.json file as well like so,
"autoload": {
"classmap": [
"database/seeds",
"database/factories",
"app/Core/Forms/Invoice/InvoiceDataSource.php"
],
"psr-4": {
"App\\": "app/"
}
},
It has also been added to autoloader in autoload_classmap.php file.
Now when I am trying to access this in the controller like this
//
public function getDataSource($id,Request $request){
return InvoiceDataSource::getAllCustomers();
}
But for some reason the error read this,
{message: "Class 'App\Http\Controllers\InvoiceDataSource' not found",…}
exception: "Symfony\Component\Debug\Exception\FatalThrowableError"
file: "/home/zrehan/projects/erp/app/Http/Controllers/FormController.php"
line: 88
message: "Class 'App\Http\Controllers\InvoiceDataSource' not found"
trace: [{function: "getDataSource", class: "App\Http\Controllers\FormController", type: "->"},…]
Can someone help me with this?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire