testimonial done

This commit is contained in:
2025-06-05 17:21:28 +05:45
parent 27d26848e2
commit 9ceb854168
14 changed files with 435 additions and 4 deletions

View File

@ -0,0 +1,24 @@
@extends('layouts.app')
@section('content')
<div class="container">
<h1>Add Testimonial</h1>
<form action="{{ route('testimonials.store') }}" method="POST" enctype="multipart/form-data">
@csrf
<div class="form-group mb-3">
<label for="name">Name</label>
<input type="text" name="name" class="form-control">
</div>
<div class="form-group mb-3">
<label for="message">Message</label>
<textarea name="message" rows="5" class="form-control"></textarea>
</div>
<div class="form-group mb-3">
<label for="image">Profile Picture</label>
<input type="file" name="image" class="form-control">
</div>
<button type="submit" class="btn btn-success">Save</button>
<a href="{{ route('testimonials.index') }}" class="btn btn-secondary">Cancel</a>
</form>
</div>
@endsection

View File

@ -0,0 +1,27 @@
@extends('layouts.app')
@section('content')
<div class="container">
<h1>Edit Testimonial</h1>
<form method="POST" action="{{ route('testimonials.update', $testimonial->id) }}" enctype="multipart/form-data">
@csrf @method('PUT')
<div class="form-group mb-3">
<label for="name" class="form-label">Name</label>
<input type="text" name="name" class="form-control" value="{{ $testimonial->name}}">
</div>
<div class="form-group mb-3">
<label for="message" class="form-label">Message</label>
<textarea name="message" rows="5" class="form-control">{{ $testimonial->message }}</textarea>
</div>
<div class="form-group mb-3">
<label for="image">Profile Picture</label>
<input type="file" name="image" class="form-control">
@if ($testimonial->image)
<p>Current image: <img src="{{ asset('storage/' . $testimonial->image) }}" width="150"></p>
@endif
</div>
<button class="btn btn-success">Update</button>
<a href="{{ route('testimonials.index') }}" class="btn btn-danger">Cancel</a>
</form>
</div>
@endsection

View File

@ -0,0 +1,49 @@
@extends('layouts.app')
@section('content')
<div class="container">
<h1>Testimonials</h1>
<a href="{{ route('testimonials.create') }}" class="btn btn-primary mb-3">Create New Testimonial</a>
@if(session('success'))
<div class="alert alert-success">{{ session('success') }}</div>
@endif
<table class="table">
<thead>
<tr>
<th>Name</th>
<th>Message</th>
<th>Profile Picture</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
@forelse($testimonials as $testimonial)
<tr>
<td>{{ $testimonial->name }}</td>
<td>{{ \Illuminate\Support\Str::limit($testimonial->message, 50) }}</td>
<td>
@if($testimonial->image)
<img src="{{ asset('storage/' . $testimonial->image) }}" alt="bg-img" width="100">
@else
N/A
@endif
</td>
<td>
<a href="{{ route('testimonials.show', $testimonial->id) }}" class="btn btn-sm btn-info">View</a>
<a href="{{ route('testimonials.edit', $testimonial->id) }}" class="btn btn-sm btn-warning">Edit</a>
<form action="{{ route('testimonials.destroy', $testimonial->id) }}" method="POST" style="display:inline-block">
@csrf @method('DELETE')
<button class="btn btn-sm btn-danger" onclick="return confirm('Delete this testimonial?')">Delete</button>
</form>
</td>
</tr>
@empty
<tr><td colspan="3">No testimonials found.</td></tr>
@endforelse
</tbody>
</table>
</div>
@endsection

View File

@ -0,0 +1,21 @@
@extends('layouts.app')
@section('content')
<div class="container">
<h1>Testimonial Details</h1>
<ul class="list-group">
<li class="list-group-item"><strong>Name:</strong> {{ $testimonial->name }}</li>
<li class="list-group-item"><strong>Message:</strong>{{ $testimonial->message}}</li>
<li class="list-group-item">
<strong>Profile Picture</strong>
@if($testimonial->image)
<img src="{{ Storage::url($testimonial->image) }}" alt="bg-img" width="100">
@else
N/A
@endif
</li>
</ul>
<a href="{{ route('testimonials.edit', $testimonial->id) }}" class="btn btn-warning">Edit</a>
<a href="{{ route('testimonials.index') }}" class="btn btn-secondary mt-3">Back to List</a>
</div>
@endsection