mirror of https://github.com/pixelfed/pixelfed
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
776 B
PHTML
32 lines
776 B
PHTML
1 year ago
|
<?php
|
||
|
|
||
|
namespace App\Http\Controllers\Groups;
|
||
|
|
||
|
use App\Http\Controllers\Controller;
|
||
|
use Illuminate\Http\Request;
|
||
|
use App\Services\GroupService;
|
||
|
use App\Models\Group;
|
||
|
|
||
|
class GroupsMetaController extends Controller
|
||
|
{
|
||
|
public function __construct()
|
||
|
{
|
||
|
$this->middleware('auth');
|
||
|
}
|
||
|
|
||
|
public function deleteGroup(Request $request)
|
||
|
{
|
||
|
abort_if(!$request->user(), 404);
|
||
|
$id = $request->input('gid');
|
||
|
$group = Group::findOrFail($id);
|
||
|
$pid = $request->user()->profile_id;
|
||
|
abort_if(!$group->isMember($pid), 404);
|
||
|
abort_if(!in_array($group->selfRole($pid), ['founder', 'admin']), 404);
|
||
|
|
||
|
$group->status = "delete";
|
||
|
$group->save();
|
||
|
GroupService::del($group->id);
|
||
|
return [200];
|
||
|
}
|
||
|
}
|