Skip to content

Commit

Permalink
add Import media function.
Browse files Browse the repository at this point in the history
  • Loading branch information
cuneytsenturk committed Mar 25, 2019
1 parent b6da292 commit d58731b
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions app/Traits/Uploads.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,21 @@ public function getMedia($file, $folder = 'settings', $company_id = null)

return MediaUploader::fromSource($file)->toDirectory($path)->upload();
}

public function importMedia($file, $folder = 'settings', $company_id = null, $disk = null)
{
$path = '';

if (!$disk) {
$disk = config('mediable.default_disk');
}

if (!$company_id) {
$company_id = session('company_id');
}

$path = $company_id . '/' . $folder . '/' . basename($file);

return MediaUploader::importPath($disk, $path);
}
}

0 comments on commit d58731b

Please sign in to comment.