New route & controller to create folders

parent bbefca15
<?php
namespace Modules\Media\Http\Controllers\Api;
use Illuminate\Routing\Controller;
use Modules\Media\Http\Requests\CreateFolderRequest;
use Modules\Media\Repositories\FolderRepository;
class FolderController extends Controller
{
/**
* @var FolderRepository
*/
private $folder;
public function __construct(FolderRepository $folder)
{
$this->folder = $folder;
}
public function store(CreateFolderRequest $request)
{
$this->folder->create($request->all());
return response()->json([
'errors' => false,
'message' => trans('media::folders.folder was created'),
]);
}
}
......@@ -4,6 +4,12 @@ use Illuminate\Routing\Router;
/** @var Router $router */
$router->group(['middleware' => 'api.token'], function (Router $router) {
$router->post('folder', [
'uses' => 'FolderController@store',
'as' => 'api.media.folders.store',
'middleware' => 'token-can:media.folders.create',
]);
$router->post('file', [
'uses' => 'MediaController@store',
'as' => 'api.media.store',
......
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