错误在Laravel 8.未定义常量AppModelsPerson::token


namespace AppModels;
use IlluminateDatabaseEloquentFactoriesHasFactory;
use IlluminateDatabaseEloquentModel;
class Person extends Model
{
private static $token = 'PWPu3Wl71N39x3M';
public static function getToken() {
return self::token;
}
}

如何获得token?

$token = 'PWPu3Wl71N39x3M';
namespace AppModels;
use IlluminateDatabaseEloquentFactoriesHasFactory;
use IlluminateDatabaseEloquentModel;
class Person extends Model
{
/** @var string */
private const TOKEN = 'text';

/**
* @return string
*/
public static function getToken(): string
{
return self::TOKEN; // text
}
}
/**
* Usage
*/
Person::getToken(); // text

相关内容

  • 没有找到相关文章

最新更新