71 lines
3.7 KiB
PHP
71 lines
3.7 KiB
PHP
@extends('layouts.app')
|
|
|
|
@section('title', 'Create Thread - Forum - ClearGame')
|
|
|
|
@section('content')
|
|
<div class="container">
|
|
<nav aria-label="breadcrumb" class="mb-4">
|
|
<ol class="breadcrumb">
|
|
<li class="breadcrumb-item"><a href="{{ route('forum.index') }}" class="text-decoration-none">Forum</a></li>
|
|
@if(isset($category_id))
|
|
@php
|
|
$category = \App\Models\ForumCategory::find($category_id);
|
|
@endphp
|
|
@if($category)
|
|
<li class="breadcrumb-item"><a href="{{ route('forum.categories.show', $category) }}" class="text-decoration-none">{{ $category->name }}</a></li>
|
|
@endif
|
|
@endif
|
|
<li class="breadcrumb-item active">Create Thread</li>
|
|
</ol>
|
|
</nav>
|
|
|
|
<div class="card bg-dark text-white">
|
|
<div class="card-header">
|
|
<h1 class="h3 mb-0">Create New Thread</h1>
|
|
</div>
|
|
<div class="card-body">
|
|
<form action="{{ route('forum.threads.store') }}" method="POST">
|
|
@csrf
|
|
<div class="mb-3">
|
|
<label for="category_id" class="form-label">Category</label>
|
|
<select class="form-select bg-dark text-white @error('category_id') is-invalid @enderror" id="category_id" name="category_id" required>
|
|
<option value="">Select a category</option>
|
|
@foreach($categories as $category)
|
|
<option value="{{ $category->id }}" {{ old('category_id', $category_id) == $category->id ? 'selected' : '' }}>
|
|
{{ $category->name }}
|
|
</option>
|
|
@endforeach
|
|
</select>
|
|
@error('category_id')
|
|
<div class="invalid-feedback">{{ $message }}</div>
|
|
@enderror
|
|
</div>
|
|
<div class="mb-3">
|
|
<label for="title" class="form-label">Thread Title</label>
|
|
<input type="text" class="form-control bg-dark text-white @error('title') is-invalid @enderror" id="title" name="title" value="{{ old('title') }}" required>
|
|
@error('title')
|
|
<div class="invalid-feedback">{{ $message }}</div>
|
|
@enderror
|
|
</div>
|
|
<div class="mb-3">
|
|
<label for="content" class="form-label">Initial Post Content</label>
|
|
<textarea class="form-control bg-dark text-white @error('content') is-invalid @enderror" id="content" name="content" rows="10" required>{{ old('content') }}</textarea>
|
|
<div class="form-text text-muted">This will be the first topic in your thread.</div>
|
|
@error('content')
|
|
<div class="invalid-feedback">{{ $message }}</div>
|
|
@enderror
|
|
</div>
|
|
<div class="d-flex gap-2">
|
|
<button type="submit" class="btn btn-gradient">Create Thread</button>
|
|
@if(isset($category_id) && $category)
|
|
<a href="{{ route('forum.categories.show', $category) }}" class="btn btn-outline-light">Cancel</a>
|
|
@else
|
|
<a href="{{ route('forum.index') }}" class="btn btn-outline-light">Cancel</a>
|
|
@endif
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@endsection
|