laravel try catch integrity duplicate entry

Solutions on MaxInterview for laravel try catch integrity duplicate entry by the best coders in the world

showing results for - "laravel try catch integrity duplicate entry"
Jen
29 Aug 2016
1according to this sample:
2
3
4    public function store(ServiceStoreRequest $request, int $id)
5    {
6        $service = new Serviceable();
7        $service->package_id = $id;
8        $service->fill($request->all());
9        try {
10            $service->save();
11        } catch (\Exception $exception) {
12            return response(array(
13                "code"=> 409,
14                "error"=>"duplicate " . $exception->getMessage()));
15        }
16        return response($service);
17    }
queries leading to this page
sqlstate 5b23000 5d 3a integrity constraint violation 3a 1062 duplicate entry 272147483647 27 for key 27pnfl 27integrity constraint violation 3a 1062 duplicate entryintegrity constraint violation 3a 1062 duplicate entry 270 27 for key 27primary 27sqlstate 5b23000 5d 3a integrity constraint violation 3a 1062 duplicate entry 27integrity constraint violation 3a 1062 duplicate entry 272 27 for key 27primary 27sqlstate 5b23000 5d 3a integrity constraint violation 3a 1062 duplicate entryintegrity constraint violation 3a 1062 duplicate entry 271 27 for key unique laravel with relation idsqlstate 5b23000 5d 3a integrity constraint violation 3a 1062 duplicate entry laravellaravel save integrity constraint violation 3a 1062 duplicate entrylaravel catch duplicate entry exceptionsqlstate 5b23000 5d 3a integrity constraint violation 3a 1062 duplicate entry 270 27 for key 27primary 27 28sql 3a insert into 60usersintegrity constraint violation 3a 1062 duplicate entry 271 27 for key laravellaravel check 22sqlstate 5b23000 5d 3a integrity constraint violation 3a 1062 duplicate entrylaravel try catch integrity duplicate entrylaravel updateorcreate sqlstate 23000 integrity constraint violation 1062 duplicate entryintegrity constraint violation 3a 1062 duplicate entry laravel unit testintegrity constraint violation 3a 1062 duplicate entry laravel validation requestintegrity constraint violation 3a 1062 duplicate entry 275 27 for key 27primary 27 28sql 3a insert into 60employee types 60 28 60id 60 2c 60name 60 29 values 285 2c driver 29 29laravel try catch integrity duplicate entry