mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-15 05:00:49 +08:00
update php Dockerfile
This commit is contained in:
@@ -4,6 +4,8 @@ namespace App\Models;
|
||||
|
||||
use Illuminate\Contracts\Support\Htmlable;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Illuminate\Support\HtmlString;
|
||||
@@ -102,7 +104,12 @@ class PluginStore extends Model
|
||||
|
||||
private static function listAllFromRemote()
|
||||
{
|
||||
$list = Http::get(self::PLUGIN_LIST_API)->json();
|
||||
$response = Http::get(self::PLUGIN_LIST_API);
|
||||
if ($response->getStatusCode() != 200) {
|
||||
do_log(sprintf("status code: %d, body: %s", $response->getStatusCode(), $response->getBody()), 'error');
|
||||
return [];
|
||||
}
|
||||
$list = $response->json();
|
||||
foreach ($list as &$row) {
|
||||
foreach ($row as $key => $value) {
|
||||
if (is_array($value)) {
|
||||
@@ -115,6 +122,9 @@ class PluginStore extends Model
|
||||
|
||||
public static function getHasNewVersionCount(): int
|
||||
{
|
||||
if (!Gate::allows('viewAny', PluginStore::class)) {
|
||||
return 0;
|
||||
}
|
||||
$currentRouteName = Route::currentRouteName();
|
||||
$withoutCacheRouteName = ['filament.admin.resources.system.plugin-stores.index', 'filament.admin.pages.dashboard'];
|
||||
$list = self::listAll(in_array($currentRouteName, $withoutCacheRouteName));
|
||||
|
||||
@@ -277,11 +277,15 @@ class User extends Authenticatable implements FilamentUser, HasName
|
||||
|
||||
public function checkIsNormal(array $fields = ['status', 'enabled']): bool
|
||||
{
|
||||
$params = [
|
||||
'user_id' => $this->id,
|
||||
'username' => $this->username,
|
||||
];
|
||||
if (in_array('status', $fields) && $this->getAttribute('status') != self::STATUS_CONFIRMED) {
|
||||
throw new NexusException(nexus_trans("user.user_is_not_confirmed", ['user_id' => $this->id, 'username' => $this->username]));
|
||||
throw new NexusException(nexus_trans("user.user_is_not_confirmed", $params));
|
||||
}
|
||||
if (in_array('enabled', $fields) && $this->getAttribute('enabled') != self::ENABLED_YES) {
|
||||
throw new NexusException(nexus_trans("user.user_is_disabled", ['user_id' => $this->id, 'username' => $this->username]));
|
||||
throw new NexusException(nexus_trans("user.user_is_disabled", $params));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user