16 lines
280 B
PHP
16 lines
280 B
PHP
<?php
|
|
|
|
namespace Tests\Traits;
|
|
|
|
use App\Models\User;
|
|
|
|
trait ActingJWTUser
|
|
{
|
|
public function JWTActingAs(User $user)
|
|
{
|
|
$token = \Auth::guard('api')->fromUser($user);
|
|
$this->withHeaders(['Authorization' => 'Bearer ' . $token]);
|
|
|
|
return $this;
|
|
}
|
|
} |