Changeset View
Changeset View
Standalone View
Standalone View
src/app/Http/Controllers/API/V4/GroupsController.php
Show All 40 Lines | public function destroy($id) | ||||
if (!$this->guard()->user()->canDelete($group)) { | if (!$this->guard()->user()->canDelete($group)) { | ||||
return $this->errorResponse(403); | return $this->errorResponse(403); | ||||
} | } | ||||
$group->delete(); | $group->delete(); | ||||
return response()->json([ | return response()->json([ | ||||
'status' => 'success', | 'status' => 'success', | ||||
'message' => __('app.distlist-delete-success'), | 'message' => \trans('app.distlist-delete-success'), | ||||
]); | ]); | ||||
} | } | ||||
/** | /** | ||||
* Show the form for editing the specified group. | * Show the form for editing the specified group. | ||||
* | * | ||||
* @param int $id Group identifier | * @param int $id Group identifier | ||||
* | * | ||||
▲ Show 20 Lines • Show All 231 Lines • ▼ Show 20 Lines | public function store(Request $request) | ||||
$group->save(); | $group->save(); | ||||
$group->assignToWallet($owner->wallets->first()); | $group->assignToWallet($owner->wallets->first()); | ||||
DB::commit(); | DB::commit(); | ||||
return response()->json([ | return response()->json([ | ||||
'status' => 'success', | 'status' => 'success', | ||||
'message' => __('app.distlist-create-success'), | 'message' => \trans('app.distlist-create-success'), | ||||
]); | ]); | ||||
} | } | ||||
/** | /** | ||||
* Update a group. | * Update a group. | ||||
* | * | ||||
* @param \Illuminate\Http\Request $request The API request. | * @param \Illuminate\Http\Request $request The API request. | ||||
* @param string $id Group identifier | * @param string $id Group identifier | ||||
▲ Show 20 Lines • Show All 41 Lines • ▼ Show 20 Lines | public function update(Request $request, $id) | ||||
return response()->json(['status' => 'error', 'errors' => $errors], 422); | return response()->json(['status' => 'error', 'errors' => $errors], 422); | ||||
} | } | ||||
$group->members = $members; | $group->members = $members; | ||||
$group->save(); | $group->save(); | ||||
return response()->json([ | return response()->json([ | ||||
'status' => 'success', | 'status' => 'success', | ||||
'message' => __('app.distlist-update-success'), | 'message' => \trans('app.distlist-update-success'), | ||||
]); | ]); | ||||
} | } | ||||
/** | /** | ||||
* Execute (synchronously) specified step in a group setup process. | * Execute (synchronously) specified step in a group setup process. | ||||
* | * | ||||
* @param \App\Group $group Group object | * @param \App\Group $group Group object | ||||
* @param string $step Step identifier (as in self::statusInfo()) | * @param string $step Step identifier (as in self::statusInfo()) | ||||
▲ Show 20 Lines • Show All 144 Lines • Show Last 20 Lines |