mirror of
https://github.com/pixelfed/pixelfed.git
synced 2025-01-31 00:40:47 +00:00
Update BaseApiController
This commit is contained in:
parent
16336bf5bc
commit
2348621510
1 changed files with 22 additions and 1 deletions
|
@ -7,7 +7,7 @@ use App\Http\Controllers\{
|
||||||
Controller,
|
Controller,
|
||||||
AvatarController
|
AvatarController
|
||||||
};
|
};
|
||||||
use Auth, Cache, URL;
|
use Auth, Cache, Storage, URL;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use App\{
|
use App\{
|
||||||
Avatar,
|
Avatar,
|
||||||
|
@ -290,6 +290,27 @@ class BaseApiController extends Controller
|
||||||
return response()->json($res);
|
return response()->json($res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function deleteMedia(Request $request)
|
||||||
|
{
|
||||||
|
$this->validate($request, [
|
||||||
|
'id' => 'required|integer|min:1|exists:media,id'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$media = Media::whereNull('status_id')
|
||||||
|
->whereUserId(Auth::id())
|
||||||
|
->findOrFail($request->input('id'));
|
||||||
|
|
||||||
|
Storage::delete($media->media_path);
|
||||||
|
Storage::delete($media->thumbnail_path);
|
||||||
|
|
||||||
|
$media->forceDelete();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'msg' => 'Successfully deleted',
|
||||||
|
'code' => 200
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
public function verifyCredentials(Request $request)
|
public function verifyCredentials(Request $request)
|
||||||
{
|
{
|
||||||
$profile = Auth::user()->profile;
|
$profile = Auth::user()->profile;
|
||||||
|
|
Loading…
Reference in a new issue