Reputation: 35
I setup the dependency injection as I felt it should go into my Patient Controller but for some reason it will never execute the dependency on the index function on the last line, it will even return the $request data before it but for some reason will not execute the data in the Patient Repository I attempt to return.
I have attempted to just do:
return (new Patient)->getByAccNumAndDateOrZip($this->client_code, $this->account_number, $this->dob, $this->zip);
Also, keep in mind yes all $requests do have a valid value and do not return a empty or null value.
And still get nothing back....
namespace App\Http\Controllers\api;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
//Repositories
use App\Repositories\Patient;
class PatientController extends Controller {
private $patient;
public function __construct(Patient $patient) {
$this->middleware('auth.client');
$this->patient = $patient;
}
public function index(Request $request) {
//I can do return $request->client_code
//But I can't use this dependency... It's weird...
return $this->patient->getByAccNumAndDateOrZip($request->client_code, $request->account_number, $request->dob, $request->zip);
}
}
I'm expecting to call to my dependency that pulls all the my patients by account number. The dependency is just a standard class with a namespace of App\Repositories it has no set constructor just a couple standard public functions that will take specific variables in the function.
Upvotes: 0
Views: 617
Reputation: 35
After reviewing the log files in laravel I was able to see that the system was stating that the class name has already been used so I would have to choose something else.
This was suggested by Matt Wohler to check the logs and boy did it help me!
Thanks Again for all the help!
Upvotes: 1