/** * Delete a model from the database. * * @param int $id * @return int */ public function delete($id = null) { // If the delete method is being called on an existing model, we only want to delete // that model. If it is being called from an Eloquent query model, it is probably // the developer's intention to delete more than one model, so we will pass the // delete statement to the query instance. if (!$this->exists) { return $this->query->delete(); } return DB::connection(static::$connection)->table(static::table(get_class($this)))->delete($this->id); }
/** * Get a session database query. * * @return Query */ private function table() { return \System\DB::connection()->table(Config::get('session.table')); }