mardi 29 novembre 2016

How to catch errors and best practices?

I'm performing various tasks on an eloquent model.

e.g.

Flight Repository

function store($request){

    $flight = new Flight;

    $flight->name = $request->name;

    $flight->save();
}

This method is called from a controller:

public function store(FlightRepository $flight, $request){

    $flight->store($request);

}

How should one approach potential errors? try/catch? Where should it be placed in the controller or repository? What would I catch anyway, what exception type?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire