/** * Make media model * * @param File $file file model * @return static */ public static function make(File $file) { $model = new static($file->getAttributes()); $model->exists = true; return $model; }
/** * insert query * * @param File $file file instance * @return File */ public function insert(File $file) { $attributes = array_merge($file->getAttributes(), ['createdAt' => date('Y-m-d H:i:s')]); $this->conn->table($this->table)->insert($attributes); return $this->createFile($attributes); }