Skip to content

Instantly share code, notes, and snippets.

@vkuberan
Last active September 5, 2019 06:38
Show Gist options
  • Save vkuberan/1b155e0d468b4e63ed62aab2d74a5c03 to your computer and use it in GitHub Desktop.
Save vkuberan/1b155e0d468b4e63ed62aab2d74a5c03 to your computer and use it in GitHub Desktop.
<?php
Route::get('customer/delete/{id}', function ($id) {
try {
$customer = App\Customer::find($id);
if($customer->delete()) echo "Customer with ID: $id is deleted";
else echo "Customer with ID: $id is not deleted";
} catch (\Illuminate\Database\QueryException $ex) {
echo $ex->getMessage();
} catch(Throwable $e) {
echo $e->getMessage();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment