vendredi 14 octobre 2016

How to catch SQL Exception in Laravel 5

Hay I'm creating a code like this :

\Log::info("saving log....");
    try{
        $data = AstronautCandidateLog::insert($request->logs);
    }catch (SQLException $e)
    {
        \Log::info("SQL Exception happened");
    }catch (Exception $e)
    {
        \Log::info("Exception happened");
    }

    \Log::info("status save data : ". $data);

But it seems that my Exception never get hit. So how to capture exception in laravel when something wrong in sql query...??

Thanks in advance.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire