Adding api route to find a media

parent e27d4fc0
...@@ -63,6 +63,11 @@ class MediaController extends Controller ...@@ -63,6 +63,11 @@ class MediaController extends Controller
return MediaTransformer::collection($this->file->serverPaginationFilteringFor($request)); return MediaTransformer::collection($this->file->serverPaginationFilteringFor($request));
} }
public function find(File $file)
{
return new MediaTransformer($file);
}
/** /**
* Store a newly created resource in storage. * Store a newly created resource in storage.
* *
......
...@@ -31,4 +31,9 @@ $router->group(['middleware' => 'api.token'], function (Router $router) { ...@@ -31,4 +31,9 @@ $router->group(['middleware' => 'api.token'], function (Router $router) {
'uses' => 'MediaController@sortMedia', 'uses' => 'MediaController@sortMedia',
'as' => 'api.media.sort', 'as' => 'api.media.sort',
]); ]);
$router->get('media/{media}', [
'uses' => 'MediaController@find',
'as' => 'api.media.find',
]);
}); });
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