add staff remove & staff invite test
This commit is contained in:
@@ -110,7 +110,17 @@ class EventController extends Controller
|
||||
|
||||
$this->authorize('delete', $event);
|
||||
|
||||
$event->guests()->updateExistingPivot($user, array('is_staff' => 1), false);
|
||||
$event->guests()->updateExistingPivot($user, ['is_staff' => true], false);
|
||||
|
||||
return (new EventResource($event))
|
||||
->response()
|
||||
->setStatusCode(200);
|
||||
}
|
||||
|
||||
public function deleteGuestToStaffEvent(Event $event, User $user) {
|
||||
$this->authorize('delete', $event);
|
||||
|
||||
$event->guests()->updateExistingPivot($user, ['is_staff' => false], false);
|
||||
|
||||
return (new EventResource($event))
|
||||
->response()
|
||||
|
||||
@@ -28,7 +28,7 @@ class User extends JsonResource
|
||||
'last_login' => optional($this->login_at)->diffForHumans(),
|
||||
'is_admin' => $this->isAdmin(),
|
||||
'is_staff' => $this->whenPivotLoaded('event_guest', function() {
|
||||
return $this->pivot->is_staff;
|
||||
return (int) $this->pivot->is_staff;
|
||||
}),
|
||||
],
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user