vendredi 22 juillet 2016

How to execute an external function in Laravel 5.2?

I have a controller with the following function

public function completeRegistration(Request $request)
{
        $yy = $request->exp_year;
        $mm = $request->exp_month;
        $cardnum = $request->cardnum;
        $cvc = $request->cvc;
}

and I want to be able to do something like this

public function completeRegistration(Request $request)
{
        $yy = $request->exp_year;
        $mm = $request->exp_month;
        $cardnum = $request->cardnum;
        $cvc = $request->cvc;

    if(billUser($cardnum, $mm, $yy, $cvc))
    {
        echo "charge success";
    }
    else 
    {
        echo "uh something was wrong";
    }
}

What are my options since 5.2 no longer has Commands and Handlers? Other controllers will need to be able to interact with my payment gateway's API. I'll need a list of payment related functions that I can easily call into any controller.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire