Use DB::raw(...)
.
In your case:
public static create($data) {
$data['b'] = DB::raw('now()');
parent::create($data);
}
Worked a treat!
The reason I didn't use date("Y-m-d H:i:s") was that I wasn't really all that interested in NOW() as the actual function. I'm doing some work with PostGIS which requires a whole load of stuff like:
$this->geom_point = DB::raw('ST_SetSRID(ST_MakePoint(' . $this->longitude . ',' . $this->latitude . '), ' . $this->srid . ')');
So I was looking for the more generic solution.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community