Commit 3b2d51c3 authored by Nicolas Widart's avatar Nicolas Widart

Adding a FileService

parent fea7e73a
<?php namespace Modules\Media\Services;
use Modules\Media\Helpers\FileHelper;
use Modules\Media\Repositories\FileRepository;
class FileService
{
/**
* @var FileRepository
*/
private $file;
public function __construct(FileRepository $file)
{
$this->file = $file;
}
public function store($file)
{
// Save the file info to db
$savedFile = $this->file->createFromFile($file);
dd($savedFile);
// Move the uploaded file to /public/assets/media/
$file->move(public_path() . '/assets/media', $savedFile->path);
return $savedFile;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment