コード例 #1
0
 /**
  * Get the model instance or create one.
  *
  * @param string $file
  * @return mixed
  */
 public function find($file)
 {
     return Document::whereName($file)->first() ?: Document::create(['author_id' => 1, 'name' => $file, 'content' => File::get($this->getPath($file))]);
 }