fix bugs
This commit is contained in:
@@ -90,7 +90,7 @@ class DivisionResource extends Resource
|
||||
Tabs\Tab::make('Контент')
|
||||
->icon('heroicon-o-document-text')
|
||||
->schema([
|
||||
ContentBuilderItem::getItem('content')
|
||||
ContentBuilderItem::getItem('description')
|
||||
]),
|
||||
]),
|
||||
]),
|
||||
|
||||
@@ -38,32 +38,6 @@ class CreateDivision extends CreateRecord
|
||||
|
||||
return strtolower($result);
|
||||
}
|
||||
private function getFirstBlockByName(string $name, array $content) : array|null
|
||||
{
|
||||
$data = null;
|
||||
foreach ($content as $block) {
|
||||
$data = ($block['type'] === $name) ? $block : null;
|
||||
break;
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
private function getBlockBySeoActiveState(string $name, array $content) : array|null
|
||||
{
|
||||
$data = [];
|
||||
foreach ($content as $block) {
|
||||
if ($block['type'] === $name) {
|
||||
$data[] = $block;
|
||||
}
|
||||
}
|
||||
$block = null;
|
||||
foreach ($data as $item) {
|
||||
if ($item['data']['seo_active'] === true) {
|
||||
$block = $item;
|
||||
}
|
||||
}
|
||||
return $block;
|
||||
}
|
||||
|
||||
private function getDataFromBlocks($block) : string
|
||||
{
|
||||
|
||||
@@ -2,9 +2,10 @@
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use App\Ship\Requests\Request;
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Inertia\Inertia;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
class EnsureUserIsSuperadmin
|
||||
@@ -16,9 +17,10 @@ class EnsureUserIsSuperadmin
|
||||
*/
|
||||
public function handle(Request $request, Closure $next)
|
||||
{
|
||||
// Проверяем, что пользователь аутентифицирован и имеет роль superadmin
|
||||
if (!Auth::check() || !Auth::user()->hasRole('super_admin')) {
|
||||
return response('Access denied. You do not have permission to access this route.', 403);
|
||||
return Inertia::render('Error', ['status' => 403])
|
||||
->toResponse($request)
|
||||
->setStatusCode(403);
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
|
||||
@@ -2,10 +2,11 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Services\App\Seo\SeoDescriptionInterface;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Division extends Model
|
||||
class Division extends Model implements SeoDescriptionInterface
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
@@ -24,4 +25,9 @@ class Division extends Model
|
||||
{
|
||||
return $this->belongsToMany(User::class, 'division_user')->withPivot(['administrativePosition', 'sort', 'service_email', 'service_phone', 'cabinet']);
|
||||
}
|
||||
|
||||
public function getSeoDescription(): array
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user