Adding method to get all media for vuejs

parent e1c91bd0
...@@ -15,6 +15,7 @@ use Modules\Media\Http\Requests\UploadMediaRequest; ...@@ -15,6 +15,7 @@ use Modules\Media\Http\Requests\UploadMediaRequest;
use Modules\Media\Image\Facade\Imagy; use Modules\Media\Image\Facade\Imagy;
use Modules\Media\Repositories\FileRepository; use Modules\Media\Repositories\FileRepository;
use Modules\Media\Services\FileService; use Modules\Media\Services\FileService;
use Modules\Media\Transformers\MediaTransformer;
use Yajra\DataTables\Facades\DataTables; use Yajra\DataTables\Facades\DataTables;
class MediaController extends Controller class MediaController extends Controller
...@@ -57,6 +58,11 @@ class MediaController extends Controller ...@@ -57,6 +58,11 @@ class MediaController extends Controller
->toJson(); ->toJson();
} }
public function allVue(Request $request)
{
return MediaTransformer::collection($this->file->serverPaginationFilteringFor($request));
}
/** /**
* Store a newly created resource in storage. * Store a newly created resource in storage.
* *
......
...@@ -22,6 +22,11 @@ $router->group(['middleware' => 'api.token'], function (Router $router) { ...@@ -22,6 +22,11 @@ $router->group(['middleware' => 'api.token'], function (Router $router) {
'as' => 'api.media.all', 'as' => 'api.media.all',
'middleware' => 'token-can:media.medias.index', 'middleware' => 'token-can:media.medias.index',
]); ]);
$router->get('media/all-vue', [
'uses' => 'MediaController@allVue',
'as' => 'api.media.all-vue',
'middleware' => 'token-can:media.medias.index',
]);
$router->post('media/sort', [ $router->post('media/sort', [
'uses' => 'MediaController@sortMedia', 'uses' => 'MediaController@sortMedia',
'as' => 'api.media.sort', 'as' => 'api.media.sort',
......
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