aboutsummaryrefslogtreecommitdiff
path: root/src/CamilStaps/BotleaguesApi/UserToken.php
blob: 9909f6a719c914fb69e05a4e08fe01ad3fb20deb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?php
namespace CamilStaps\BotleaguesApi;

use Illuminate\Database\Eloquent\Model;

class UserToken extends Model {
    
    protected $table = 'user_tokens';
    protected $hidden = ['token'];
    protected $fillable = ['userId', 'token', 'valid_till'];

    /**
     * Override the parent's save() function to automatically update the valid_till timestamp
     */
    public function save(array $options = array()) {
        $this->valid_till = date("Y-m-d H:i:s", time() + 3600);

        return parent::save($options);
    }

}