This commit is contained in:
2025-06-03 12:40:13 +05:45
parent 50c804d445
commit f9a589c05f
201 changed files with 34026 additions and 2 deletions

View File

@ -0,0 +1,24 @@
@extends('layouts.app')
@section('content')
<div class="container">
<h1>Create New Post</h1>
<form method="POST" action="{{ route('posts.store') }}">
@csrf
<div class="mb-3">
<label class="form-label">Title</label>
<input type="text" name="title" class="form-control" required>
</div>
<div class="mb-3">
<label class="form-label">Content</label>
<textarea name="content" class="form-control" rows="5" required></textarea>
</div>
<button class="btn btn-success">Save</button>
<a href="{{ route('posts.index') }}" class="btn btn-secondary">Cancel</a>
</form>
</div>
@endsection

View File

@ -0,0 +1,24 @@
@extends('layouts.app')
@section('content')
<div class="container">
<h1>Edit Post</h1>
<form method="POST" action="{{ route('posts.update', $post->id) }}">
@csrf @method('PUT')
<div class="mb-3">
<label class="form-label">Title</label>
<input type="text" name="title" class="form-control" value="{{ $post->title }}" required>
</div>
<div class="mb-3">
<label class="form-label">Content</label>
<textarea name="content" class="form-control" rows="5" required>{{ $post->content }}</textarea>
</div>
<button class="btn btn-success">Update</button>
<a href="{{ route('posts.index') }}" class="btn btn-secondary">Cancel</a>
</form>
</div>
@endsection

View File

@ -0,0 +1,41 @@
@extends('layouts.app')
@section('content')
<div class="container">
<h1>Posts</h1>
<a href="{{ route('posts.create') }}" class="btn btn-primary mb-3">Create New Post</a>
@if(session('success'))
<div class="alert alert-success">{{ session('success') }}</div>
@endif
<table class="table">
<thead>
<tr>
<th>Title</th>
<th>Content (preview)</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
@forelse($posts as $post)
<tr>
<td>{{ $post->title }}</td>
<td>{{ \Illuminate\Support\Str::limit($post->content, 50) }}</td>
<td>
<a href="{{ route('posts.show', $post->id) }}" class="btn btn-sm btn-info">View</a>
<a href="{{ route('posts.edit', $post->id) }}" class="btn btn-sm btn-warning">Edit</a>
<form action="{{ route('posts.destroy', $post->id) }}" method="POST" style="display:inline-block">
@csrf @method('DELETE')
<button class="btn btn-sm btn-danger" onclick="return confirm('Delete this post?')">Delete</button>
</form>
</td>
</tr>
@empty
<tr><td colspan="3">No posts found.</td></tr>
@endforelse
</tbody>
</table>
</div>
@endsection

View File

@ -0,0 +1,14 @@
@extends('layouts.app')
@section('content')
<div class="container">
<h1>{{ $post->title }}</h1>
<div class="mb-4">
<p>{{ $post->content }}</p>
</div>
<a href="{{ route('posts.edit', $post->id) }}" class="btn btn-warning">Edit</a>
<a href="{{ route('posts.index') }}" class="btn btn-secondary">Back</a>
</div>
@endsection