0

When i comment the inserting query, the return works.but with the query return is not working.it would be great if anyone can help immediatly


 public function regCustomer()
{
    $arr = [];

    $cus_name = Input::get('cusname');
    $cus_address = Input::get( 'address' );
    $cus_phone = Input::get( 'phone' );
    $cus_email = Input::get( 'email' );

    try{
        DB::table('Customers')->insert(
            array(
                'customer_name' => $cus_name,
                'address' => $cus_address,
                'phone' => $cus_phone,
                'email' => $cus_email
                )
        );

       return 1;

    }catch(Exception $ex){
        return '0';
    }
}
1

1 Answer 1

0

replace the catch block parameter to match this:

catch (\Illuminate\Database\QueryException $e)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.