我遇到了一个问题。我需要从表中插入的最后一个 id 将被添加到同一个表中,即在我的表中我有两个字段“id”和“translation-of”,它们都应该保存相同的值。Id 字段是自动递增的。如何实现????我也在使用excel上传类别,在这种情况下也是同样的问题......请帮我解决这个......
我的控制器功能是
$insert[] = ['translation_lang'=>'en','parent_id' =>$a[0],'name' => $value->name,'slug' =>$value->name,'description' => $value->description,'picture'=>$pic,'active'=>1];
$last_id = \DB::table('categories')->max('id');
if(!empty($insert)){
\DB::table('categories')->insert($insert);
\DB::table('categories')->where('id2',$last_id)->update(['translation_of' => $last_id]);
return Redirect::to('admin/category');
}
Run Code Online (Sandbox Code Playgroud)
等待回应。
我遇到了无法运行测试用例的问题。我有一个 laravel 项目,我在其中编写了测试用例并尝试从我的 homestead 服务器运行。但它显示错误。
“供应商/bin/phpunit:第1行:../phpunit/phpunit/phpunit:没有这样的文件或目录”
我的供应商文件中有 phpunit 。
其他人也遇到过这样的问题,为什么会出现此错误?
等待回复..