に、私はこのエラー FatalErrorExceptionFatalErrorException構文エラー、予期しない ':'、予期している ';' 「:」私はXAMPPを再インストールして、私のlaravelプロジェクトを実行する場合や「{」PermissionRegistrar.php
構文エラー、予期しないそうだ、期待を「;」または '{' PermissionRegistrar.php(ライン33)に マイコードは
public function __construct(Gate $gate, Repository $cache, Log $logger)
{
$this->gate = $gate;
$this->cache = $cache;
$this->logger = $logger;
}
public function registerPermissions(): bool
{
try {
$this->getPermissions()->map(function (Permission $permission) {
$this->gate->define($permission->name, function ($user) use($permission)
{
return $user->hasPermissionTo($permission);
});
});
return true;
} catch (Exception $exception) {
if ($this->shouldLogException()) {
$this->logger->alert(
"Could not register permissions because {$exceptiongetMessage()}".PHP_EOL.
$exception->getTraceAsString()
);
}
return false;
}
}
に
から
: bool
を削除しますか?エラーはクリアです。なぜそれを修正しないのですか? – Hassaan@サランヤ:1)ループが正しく閉じているかどうかを確認してください。 2)セミクロンが不足していることを確認してください。 – Abhijit
PermissionRegistrar.php(行33)を共有し、1行上にあることを確認してください。 – C2486