| Path : /var/www/html/phkaynews-v2/resources/views/admin/post/ |
|
B-Con CMD Config cPanel C-Rdp D-Log Info Jump Mass Ransom Symlink vHost Zone-H |
| Current File : /var/www/html/phkaynews-v2/resources/views/admin/post/postForm.blade.php |
@extends('layouts.admin')
@isset ($post)
@section('title','Admin Edit Posts')
@else
@section('title','Admin Create Posts')
@endisset
@push('styles')
@endpush
@section('content')
<div class="row">
<x-content-header :title="isset($post)?'Edit Post':'Create Post'" />
<div class="col-12">
<x-card>
<form class="custom-validation" novalidate autocomplete method="POST"
@isset($post)
action="{{route('admin.posts.update', $post)}}"
@else
action="{{route('admin.posts.store')}}"
@endisset
enctype="multipart/form-data">
@csrf
@isset($post)
@method('PUT')
@endisset
<button type="submit" class="btn btn-success rounded-pill w-md float-right"><i class="bx bx-check-shield"></i> Save</button>
<a href="{{route('admin.posts.index')}}" class="btn btn-warning rounded-pill w-md"><i class="bx bx-left-arrow-alt"></i> Back</a>
<div class="row flex-column-reverse flex-md-row">
<div class="col-md-8 align-self-center">
<div class="form-group row mb-4">
<label for="title" class="col-sm-2 col-form-label">Title<sup class="text-danger">*</sup></label>
<div class="col-sm-10">
<input type="text" name="title" @isset($post) value="{{ $post->title }}" @endisset class="form-control @error('title') parsley-error @enderror" id="title" placeholder="Enter title..." required>
@error('title')
<ul class="parsley-errors-list filled" id="parsley-id-5" aria-hidden="false">
<li class="parsley-required">{{ $message }}</li>
</ul>
@enderror
</div>
</div>
<div class="form-group row mb-4">
<label for="keyword" class="col-sm-2 col-form-label">Keyword<sup class="text-danger">*</sup></label>
<div class="col-sm-10">
<input type="text" name="keyword" @isset($post) value="{{ $post->keyword }}" @endisset class="form-control @error('keyword') parsley-error @enderror" id="keyword" placeholder="Enter keyword..." required>
@error('keyword')
<ul class="parsley-errors-list filled" id="parsley-id-5" aria-hidden="false">
<li class="parsley-required">{{ $message }}</li>
</ul>
@enderror
</div>
</div>
<div class="form-group row mb-4">
<label for="released" class="col-sm-2 col-form-label">Category<sup class="text-danger">*</sup></label>
<div class="col-sm-10">
@isset($post)
@php
$existing_categories = $post->post_categories->pluck('category_id')->toArray();
@endphp
@endisset
<x-select2 name="category_ids[]">
@foreach ($categories as $category)
<option value="{{ $category->id }}"
@isset($post)
@if(in_array($category->id, $existing_categories))
selected
@endif
@endisset
>{{ $category->name }}</option>
@endforeach
</x-select2>
@error('category_id')
<ul class="parsley-errors-list filled" id="parsley-id-5" aria-hidden="false">
<li class="parsley-required">{{ $message }}</li>
</ul>
@enderror
</div>
</div>
<div class="form-group row mb-4">
<div class="col-sm-10 offset-2">
<div class="custom-control custom-checkbox mt-2">
<input type="checkbox" class="custom-control-input" name="public" id="public" @isset($post) {{ $post->public?'checked':'' }} @else checked @endisset>
<label class="custom-control-label" for="public">Public</label>
</div>
</div>
</div>
</div>
<div class="col-md-4">
<div class="position-relative">
<label class="d-block text-center">Thumbnail(1280x720px)<sup class="text-danger">*</sup></label>
<div class="d-flex w-50 m-auto">
<img class="img-thumbnail mw-50 img-clickable feature-img feature-image @error('feature_image') border-danger @enderror"
src="{{ isset($post)?asset($post->feature_image):asset('backend/images/no-image.jpg') }}" alt="No Image" />
<input type="file" id="feature_image" class="custom-file-input d-none feature-image" name="feature_image" />
</div>
</div>
</div>
<div class="col-12">
<div class="form-group">
<label for="desc" class="col-sm-2 col-form-label">Description </label>
<x-ckeditor name="description">
@isset($post)
{{$post->description}}
@endisset
</x-ckeditor>
</div>
</div>
</div>
<button type="submit" class="btn btn-success rounded-pill w-md float-right"><i class="bx bx-check-shield"></i> Save</button>
<a href="{{route('admin.posts.index')}}" class="btn btn-warning rounded-pill w-md"><i class="bx bx-left-arrow-alt"></i> Back</a>
</form>
</x-card>
</div>
</div>
@endsection
@push('scripts')
@endpush