上一篇讲了Laravel展示产品-CRUD之show,现在我们说一下Laravel编辑产品,涉及到编辑和更新, 1,定义controller,update和create有点相似,我们复制一份过来修改.new item改为item::find public function edit($id) { // $item = Item::find($id); return view('items.edit')->with('item', $item); } public function update(…
上一篇说了laravel用crud之index列出产品items,我们现在试着添加产品,用到CRUD的 Create 和 Store 方法,打开/app/Http/Controllers/ItemController.php定义一下create和store方法 1,添加新产品 public function create() { return view('items.create'); } 2,保存刚刚添加的产品到数据库 public function store(Request $reques…
上一篇讲了Laravel创建产品-CRUD之Create and Store,现在我们来做产品展示模块,用到是show,①首先我们先修改controller,文件是在/app/Http/Controllers/ItemController.php,定义一下show function public function show($id) { $item = Item::find($id); return view('items.show')->with('item', $item); } ②创建sh…
Today, I had spent 3 hours to fix one problem, The old program has a bug, originally, when a user profile don't now allow Multi Logon, It will update the other login records of [LoginAudit] table of this user, But the code has a problem, it may no…