小编Ari*_*Ari的帖子

Laravel 5.4字段没有默认值

我有这个错误,我检查的google搜索结果都没有类似于我的问题.

我有一个类Deal,User和Matches的应用程序

一笔交易有很多比赛.用户有很多匹配.用户有很多优惠.

我正在尝试使用我的Deal对象创建一个新的Match

$deal->matches()->create(['user_id'=>$id]);
Run Code Online (Sandbox Code Playgroud)

这是我的匹配类,我已经定义了所有需要的关系

class Match extends Model
{
    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $guarded = [];
    public $timestamps = false;
    public $expired_on = "";


    public static function boot()
    {
        parent::boot();

        static::creating(function ($model) {
            $model->matched_on = $model->freshTimestamp();
        });
    }

    public function __construct(){
        $d = (new \DateTime($this->matched_on))->modify('+1 day');
        $this->expired_on = $d->format('Y-m-d H:i:s');
    }


    /**
     * Get the user that owns the match.
     */
    public function user()
    {
        return $this->belongsTo('App\User');
    } …
Run Code Online (Sandbox Code Playgroud)

php mysql laravel laravel-5.4

18
推荐指数
7
解决办法
6万
查看次数

在python或类似的地方"静默地"打开URL

无论如何在Python中打开URL而不在浏览器中打开选项卡?

我有一个预构建的URL,我想在计算机空闲时运行,例如http://foo.com/bar

我已经能够使用startwebbrowser方法,但这些在我的浏览器中打开一个新选项卡.

仅供参考该URL返回一个空白页面,其中只有OK我不需要的单词.

任何人都可以建议任何其他方式,如通过批处理或任何其他程序可以做到这一点?

python batch-file

4
推荐指数
2
解决办法
5639
查看次数

标签 统计

batch-file ×1

laravel ×1

laravel-5.4 ×1

mysql ×1

php ×1

python ×1