bulk-operations v0.3 add multi shared cancel to contextMenu

This commit is contained in:
Milos Holba
2020-12-04 13:34:00 +01:00
parent ee14c34671
commit d31e2ab98b
10 changed files with 124 additions and 26 deletions

View File

@@ -93,16 +93,18 @@ class ShareController extends Controller
* @return ResponseFactory|\Illuminate\Http\Response
* @throws \Exception
*/
public function destroy($token)
public function destroy(Request $request)
{
// Get sharing record
$shared = Share::where('token', $token)
->where('user_id', Auth::id())
->firstOrFail();
foreach($request->input('folders') as $tokens) {
// Delete shared record
$shared->delete();
// Get sharing record
$shared = Share::where('token', $tokens['token'])
->where('user_id', Auth::id())
->firstOrFail();
// Delete shared record
$shared->delete();
}
// Done
return response('Done!', 204);
}