id = str_random(40); $token->user_id = $userId; return $token; } /** * Define the relationship with the owner of this access token. * * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ public function user() { return $this->belongsTo('Flarum\Core\Models\User'); } }