我在我的控制器中使用了 我想知道我使用该功能的方式是否正常,我需要验证它是否正常工作? p>
< / DIV> DB :: transaction code>这样的函数, p >
public function store(){
$ plant = new Plant;
DB :: transaction(function()
{
Plant :: create(request([ 'name','plant_code','place']));
});
}
code> pre>
I have used DB::transaction
function in my controller like this,
public function store(){
$plant = new Plant;
DB::transaction(function()
{
Plant::create(request(['name','plant_code','place']));
});
}
I want to know the way I have used the function is ok and i need to verify is it working correctly?