模型运动所有其他模型与laravel模型结构工作正常,但在这个模型上它给null我不知道我想知道原因的原因。
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Auth;
class Campaign extends Model
{
protected $table = 'campaigns';
public $timestamps = true;
use SoftDeletes;
protected $dates = ['deleted_at'];
protected $fillable = [
'name',
'campaign_type_id',
'medium_type_id ',
'pause ',
'uuid',
'resend_to_days',
'trigger_mailing',
'send_to_all',
'email_id',
'created_by'
];
}
控制器值:
// returns null
$campaign = Campaign::where('uuid', $campaign_uuid)->first();
// returns value
$campaign = DB::table('campaigns')->where('uuid', '=', $campaign_uuid)->first();