douzhi1919 2018-06-09 11:11
浏览 17

如何使用Laravel 5.6 post方法在数据库中延长时间

In database I've got column called 'expiration', which type is DateTime, and so values are like "2018-06-10 01:00:05".

In laravel 5.6 im working on form, by which sending Im about to extend time in database by for example 10 seconds.

What I've got at the moment is:

1) Form

{!! Form::open(['url' => '/addbid', 'method' => 'post']) !!}
   <input type="hidden" name="value" value="60">
   <input type="hidden" name="id" value="{{ $data->id }}">
   <button type="submit" class="btn btn-success">Add bid</button>
   <a href="{{ url()->previous() }}" class="btn btn-danger">Go back</a>
 {!! Form::close() !!}

2) And function in my controller

public function addbid(Request $request)
{
    $id = Input::only('id');
    $time = Input::only('value');
    $post = Auction::where('id', $id);
    $post -> expiration += $request-> $time;
    $post -> save();
    return redirect()->route('auctions.list');
}

3) Post data

value   "60"
id      "3"

4) Error which occurs

"Unsupported operand types"

I'd be really thankful for any advices as I'm struggling with this problem for quite a lot time.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 关于#Java#的问题,如何解决?
    • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
    • ¥15 想问一下树莓派接上显示屏后出现如图所示画面,是什么问题导致的
    • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
    • ¥15 cmd cl 0x000007b
    • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
    • ¥500 火焰左右视图、视差(基于双目相机)
    • ¥100 set_link_state
    • ¥15 虚幻5 UE美术毛发渲染
    • ¥15 CVRP 图论 物流运输优化