Updated user management
This commit is contained in:
@@ -112,6 +112,25 @@ class UsersController extends Controller
|
||||
return view('admin.users.update', compact('user', 'paidPlans'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantly revoke a user's active subscriptions (Set to 0 days)
|
||||
*/
|
||||
public function revokeSubscription(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'user_id' => 'required|exists:users,id',
|
||||
]);
|
||||
|
||||
$user = \App\Models\User::findOrFail($request->user_id);
|
||||
|
||||
// Instantly expire ALL active subscriptions by setting them to 'now()'
|
||||
$user->userSubscribers()
|
||||
->where('expired_at', '>', now())
|
||||
->update(['expired_at' => now()]);
|
||||
|
||||
return back()->with('success', 'اشتراک کاربر با موفقیت صفر (لغو) شد.');
|
||||
}
|
||||
|
||||
public function update(UpdateUserRequest $request, User $user)
|
||||
{
|
||||
$validated = $request->validated();
|
||||
|
||||
Reference in New Issue
Block a user