samedi 9 juin 2018

How to extend time in database with Laravel 5.6 post method

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="">
   <button type="submit" class="btn btn-success">Add bid</button>
   <a href="" 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.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire