Example #1
0
 /**
  * set the target be have a file
  *
  * @param string $fileableId fileable identifier
  * @param File   $file       file instance
  * @return void
  */
 public function bind($fileableId, File $file)
 {
     $file->getConnection()->table($file->getFileableTable())->insert(['fileId' => $file->getKey(), 'fileableId' => $fileableId, 'createdAt' => Carbon::now()]);
     $file->increment('useCount');
 }