laravel小技巧

1、自增字段不修改updated_at

 $mE= Merchant::where('user_id',$id)->first();
 $mE->timestamps = false;
$mE->increment('read_count');

2、全局函数

在composer.json里面加入files

"autoload": {
        "classmap": [
            "database/seeds",
            "database/factories"
        ],
        "psr-4": {
            "App\\": "app/"
        },
        "files": [
            "app/Common/common.php"
        ]
    },

执行 composer dump-auto

你可能感兴趣的:(laravel小技巧)