Changeset View
Changeset View
Standalone View
Standalone View
src/app/Http/Controllers/API/V4/Reseller/InvitationsController.php
Show All 22 Lines | class InvitationsController extends Controller | ||||
* Remove the specified invitation. | * Remove the specified invitation. | ||||
* | * | ||||
* @param int $id Invitation identifier | * @param int $id Invitation identifier | ||||
* | * | ||||
* @return \Illuminate\Http\JsonResponse | * @return \Illuminate\Http\JsonResponse | ||||
*/ | */ | ||||
public function destroy($id) | public function destroy($id) | ||||
{ | { | ||||
$invitation = SignupInvitation::withUserTenant()->find($id); | $invitation = SignupInvitation::withSubjectTenantContext()->find($id); | ||||
if (empty($invitation)) { | if (empty($invitation)) { | ||||
return $this->errorResponse(404); | return $this->errorResponse(404); | ||||
} | } | ||||
$invitation->delete(); | $invitation->delete(); | ||||
return response()->json([ | return response()->json([ | ||||
Show All 21 Lines | class InvitationsController extends Controller | ||||
*/ | */ | ||||
public function index() | public function index() | ||||
{ | { | ||||
$pageSize = 10; | $pageSize = 10; | ||||
$search = request()->input('search'); | $search = request()->input('search'); | ||||
$page = intval(request()->input('page')) ?: 1; | $page = intval(request()->input('page')) ?: 1; | ||||
$hasMore = false; | $hasMore = false; | ||||
$result = SignupInvitation::withUserTenant() | $result = SignupInvitation::withSubjectTenantContext() | ||||
->latest() | ->latest() | ||||
->limit($pageSize + 1) | ->limit($pageSize + 1) | ||||
->offset($pageSize * ($page - 1)); | ->offset($pageSize * ($page - 1)); | ||||
if ($search) { | if ($search) { | ||||
if (strpos($search, '@')) { | if (strpos($search, '@')) { | ||||
$result->where('email', $search); | $result->where('email', $search); | ||||
} else { | } else { | ||||
Show All 25 Lines | class InvitationsController extends Controller | ||||
* Resend the specified invitation. | * Resend the specified invitation. | ||||
* | * | ||||
* @param int $id Invitation identifier | * @param int $id Invitation identifier | ||||
* | * | ||||
* @return \Illuminate\Http\JsonResponse | * @return \Illuminate\Http\JsonResponse | ||||
*/ | */ | ||||
public function resend($id) | public function resend($id) | ||||
{ | { | ||||
$invitation = SignupInvitation::withUserTenant()->find($id); | $invitation = SignupInvitation::withSubjectTenantContext()->find($id); | ||||
if (empty($invitation)) { | if (empty($invitation)) { | ||||
return $this->errorResponse(404); | return $this->errorResponse(404); | ||||
} | } | ||||
if ($invitation->isFailed() || $invitation->isSent()) { | if ($invitation->isFailed() || $invitation->isSent()) { | ||||
// Note: The email sending job will be dispatched by the observer | // Note: The email sending job will be dispatched by the observer | ||||
$invitation->status = SignupInvitation::STATUS_NEW; | $invitation->status = SignupInvitation::STATUS_NEW; | ||||
▲ Show 20 Lines • Show All 133 Lines • Show Last 20 Lines |