1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- <?php
- namespace App\Models;
- use App\Constants\HttpStatus;
- use App\Constants\Util;
- use Illuminate\Foundation\Auth\User as Authenticatable;
- use Illuminate\Notifications\Notifiable;
- use Laravel\Sanctum\HasApiTokens;
- use Illuminate\Database\Eloquent\Builder;
- /**
- * @mixin Builder
- * @method static Builder|static where($column, $operator = null, $value = null, $boolean = 'and')
- */
- class Collect extends Authenticatable
- {
- use HasApiTokens, Notifiable;
- protected $table = 'collects';
- protected $hidden = ['created_at', 'updated_at'];
- // ✅ 允许批量赋值的字段
- protected $fillable = [
- 'from_address',
- 'to_address',
- 'amount',
- 'coin',
- 'net',
- 'status',
- 'txid',
- 'fee',
- 'confirmations',
- 'block_number',
- 'remark',
- ];
- const STATUS_STAY = 0;
- const STATUS_START = 1;
- const STATUS_SUCCESS = 2;
- const STATUS_FAIL = 3;
- public static $STATUS = [
- 0 => '待处理',
- 1 => '已发起',
- 2 => '已确认',
- 3 => '失败',
- ];
- protected function getCreatedAtAttribute($value)
- {
- return \Carbon\Carbon::parse($value)->setTimezone('Asia/Shanghai')->format('Y-m-d H:i:s');
- }
- protected function getUpdatedAtAttribute($value)
- {
- return \Carbon\Carbon::parse($value)->setTimezone('Asia/Shanghai')->format('Y-m-d H:i:s');
- }
- }
|