@extends('layouts.dashboard') @section('contents') @if(Session::has('success')) Info {{ Session::get('success') }} @php Session::forget('success'); @endphp Close @elseif(Session::has('failed')) Info {{ Session::get('failed') }} @php Session::forget('failed'); @endphp Close @endif Add Posts to Circular Add Post @if ($errors->any()) Danger Ensure that these requirements are solved: {{-- @foreach($errors->all() as $error) {{$error}} {{ str_replace(['nposts.', 'nPostType.', 'ndepts.'], 'Row ', $error) }} @endforeach --}} @foreach($errors->getMessages() as $key => $messages) @foreach($messages as $message) @php // 1. Split 'nposts.0' into ['nposts', '0'] $parts = explode('.', $key); $fieldName = $parts[0]; $rowIndex = isset($parts[1]) ? ($parts[1] + 1) : null; // 2. Map your input names to nice Labels $labels = [ 'nposts' => 'Post', 'nPostType' => 'PostType', 'ndepts' => 'Department' ]; $niceName = $labels[$fieldName] ?? $fieldName; @endphp @if($rowIndex) Row {{ $rowIndex }}: The {{ $niceName }} field is invalid. @else {{ $message }} @endif @endforeach @endforeach @endif @csrf Circular* Choose the Circular @foreach($circulars as $circular) id ? 'selected' : '' }}>{{$circular->title}} @endforeach Add Posts @endsection @section('scripts') @endsection
{{ Session::get('failed') }}