我想在select选项标签中显示一个选定的值,具有特定的id,我有一个post表
+---------+-------------+---------------+-------------+
| post_id | post_title | post_content | category_id |
+---------+-------------+---------------+-------------+
| 1 | Title One | Content One | 1 |
+---------+-------------+---------------+-------------+
| 2 | TitleTwo | Content Two | 1 |
+---------+-------------+---------------+-------------+
| 3 | Title Three | Content Three | 2 |
+---------+-------------+---------------+-------------+
Run Code Online (Sandbox Code Playgroud)
然后我有一个类别表
+-------------+----------------+
| category_id | category |
+-------------+----------------+
| 1 | Category One |
+-------------+----------------+
| 2 | Category Two |
+-------------+----------------+
| 3 | Category Three |
+-------------+----------------+
Run Code Online (Sandbox Code Playgroud)
我用select选项标签显示类别
控制器添加
function add(){ …Run Code Online (Sandbox Code Playgroud) 我正在使用Crinsane的laravel购物车 https://github.com/Crinsane/LaravelShoppingcart
我想更新选项购物车,里面有很多选项,但是我只想更改一个选项,而我做不到
这是我的代码
Cart::add([
'id' => 1,
'name' => 'Keyboard',
'qty' => 30,
'price' => 399,
'options' => [
'item_code' => 'KEY01',
'dimension' => '30cm x 60cm', ...etc]
]);
Run Code Online (Sandbox Code Playgroud)
然后我想更改选项
这是我的代码
Cart::update(
$rowId, [
'qty' => 60,
'price' => 299,
'options' => [
'item_code' => 'KEY02']
]);
Run Code Online (Sandbox Code Playgroud)
然后结果选项只有item_code,其他选项消失了我希望其他选项仍然存在,如何处理?
对不起,英语不好
谢谢答案
我想问一个问题,有人知道如何将数据从本地/公共传输到 ftp,我正在使用存储类 https://laravel.com/docs/5.4/filesystem
这是我的代码
$file_local = Storage::disk('local')->get('public/uploads/ftp/file.pdf');
$file_ftp = Storage::disk('ftp')->put('/file.pdf', $file_local');
Run Code Online (Sandbox Code Playgroud)
但我的代码不起作用,当我在 ftp 上打开文件时,文件已损坏,然后我用记事本打开它,在文件内部,内容是“public/uploads/ftp/file.pdf”,我的意思是内容应该本地的不是我写的,
有人知道如何将文件从本地传输到 ftp,抱歉我的英语不好,无论如何还是感谢您的回答