Ejemplo n.º 1
0
 public function delete($media_id)
 {
     try {
         $user = sentinel()->getUser();
         $media = Library\Media\Model\Media::withDrafts()->userId($user->id)->findOrFail($media_id);
         $this->medialib->setMedia($media);
         $category = $media->category;
         $this->medialib->deleteMedia($media_id);
         redirect('media/show/' . $category->id, 'refresh');
     } catch (\Exception $e) {
         set_message_error('Media tidak tersedia.');
         redirect('media', 'refresh');
     }
 }
Ejemplo n.º 2
0
 public function fillMeta($files)
 {
     $mediaFiles = array();
     for ($i = 0; $i < count($files); $i++) {
         $name = $files[$i]['file_name'];
         $created_at = $files[$i]['created_at'];
         $status = $files[$i]['status'];
         $userId = $files[$i]['user_id'];
         $mediaFiles[$i] = $this->media_model->getFileData($name, $created_at, $userId, $status);
         foreach ($mediaFiles[$i] as $m) {
             $media = Library\Media\Model\Media::withDrafts()->userId($userId)->findOrFail($m->id);
         }
         $data['media'][$i] = $media;
     }
     $data['files'] = $mediaFiles;
     $this->template->build('add_meta', $data);
 }