question about eloquent model

Posted 2 years ago by yuyenkan

in my class, if I define the column of table

use Illuminate\Database\Eloquent\Model as Model;

class Staff extends Model
{
public $id;
}

then in controller

$staff = new Staff();
$staff->id = 1;
$staff->save();

the data is inserted as NULL in mariaDB, what should I do or is there other way to do it?

Please sign in or create an account to participate in this conversation.