Skip to content

Instantly share code, notes, and snippets.

@Cerwyn
Created May 29, 2021 02:52
Show Gist options
  • Save Cerwyn/29ee70665101c34ed5f83d4a81036f8b to your computer and use it in GitHub Desktop.
Save Cerwyn/29ee70665101c34ed5f83d4a81036f8b to your computer and use it in GitHub Desktop.
<?php
public function store(Request $request)
{
DB::beginTransaction();
$user = User::create();
$response = app('service')->create($user);
if (!$response) {
DB::rollback();
return;
}
// ...
DB::commit();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment