Show the complete method where you call it please
Error with logoutOtherDevices
I have never done this before and I am not super experienced with Laravel APIs, but I was trying to use Auth::logoutOtherDevices($request->password); after a successful login.
I am not sure if it matters to enable \Illuminate\Session\Middleware\AuthenticateSession::class, in the 'web` middlewareGroups as I am only using this for APIs.
However, when I call Auth::logoutOtherDevices($request->password); I get this exception:
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'portal_access_token' in 'field list' (SQL: update users set password = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, portal_access_token = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, users.updated_at = 2022-08-16 17:39:22 where id = 8)
I am not sure why it's looking for a column named portal_access_token in the users table.
That only identifies a custom field that I return in my UserResource object:
class UserResource extends ResourceBase
{
/**
* Transform the resource into an array.
*
* @param Request $request
* @return array
*/
public function toArray($request): array
{
$includes = Helpers::getIncludesFromRequest($request);
return [
'id' => $this->id,
'name' => $this->name,
'email' => $this->email,
'createdAt' => $this->created_at,
$this->mergeWhen($includes->contains('tokens'), [
'portal_access_token' => $this->portal_access_token,
]),
'roles' => new RoleResourceCollection($this->roles),
'ts' => new TSUserResource($this),
'ld' => new LDUserResource($this),
'meta' => new MetaDataResourceCollection($this->metaData),
'logo' => new FileResource($this->logo()),
];
}
}
Does anybody know why it throws this error and how to make it work? Let me know if i need to post mode code details, thanks!
Please or to participate in this conversation.