Skip to content

Does laravel-mongodb has laravel sanctum support? #2242

Answered by kudjieRaymond
rhasani asked this question in Q&A
Discussion options

You must be logged in to vote

Create a custom PersonalAccessToken Model
`use Laravel\Sanctum\Contracts\HasAbilities;
use Jenssegers\Mongodb\Eloquent\Model;

class PersonalAccessToken extends Model implements HasAbilities
{

/**
 * The attributes that should be cast to native types.
 *
 * @var array
 */
protected $casts = [
    'abilities' => 'json',
    'last_used_at' => 'datetime',
];

/**
 * The attributes that are mass assignable.
 *
 * @var array
 */
protected $fillable = [
    'name',
    'token',
    'abilities',
];

/**
 * The attributes that should be hidden for serialization.
 *
 * @var array
 */
protected $hidden = [
    'token',
];

/**
 * Get the tokenable model that the access token belongs to.
 *
 * @retur…

Replies: 2 comments 9 replies

Comment options

You must be logged in to vote
1 reply
@McMazalf
Comment options

Comment options

You must be logged in to vote
8 replies
@devsiodedra
Comment options

@devsiodedra
Comment options

@ruelrule05
Comment options

@jessetmia
Comment options

@alcaeus
Comment options

Answer selected by divine
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
9 participants
Converted from issue

This discussion was converted from issue #2233 on April 30, 2021 09:58.