jeudi 3 août 2017

Laravel FatalThrowableError Call to a member function create() on null when I tried to create a new applicant user

I am just new to laravel 5.4 and I am trying to create a register form that will validate and stores it on the applicants table and it says that Call to a member function create() on null. heres my code:

private $applicantRepository;

    public function repo(ApplicantRepository $applicantRepo)
    {   
        $this->middleware('auth');
        $this->applicantRepository = $applicantRepo;
    }

public function store(CreateApplicantRequest $request)
    {
        $input = $request->all();

        $applicants = $this->applicantRepository->create([
            'name' => $input['name'],
            'email' => $input['email'],
            'password' => bcrypt($input['password']),
            'address' => $input['address'],
            'cellphone_no' => $input['cellphone_no']
        ]);

        Flash::success('Cashier saved successfully.');

        return redirect(route('applicants/home'));
    }



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire