services done

This commit is contained in:
2025-06-05 15:19:12 +05:45
parent 18e5f8f173
commit 01785b7bb9
21 changed files with 691 additions and 8 deletions

View File

@ -0,0 +1,30 @@
@extends('layouts.app')
@section('content')
<div class="container">
<h1>Add Services</h1>
<form action="{{ route('services.store') }}" method="POST" enctype="multipart/form-data">
@csrf
<div class="form-group mb-3">
<label for="title">Title</label>
<input type="text" name="title" class="form-control">
</div>
<div class="form-group mb-3">
<label for="description">Description</label>
<textarea name="description" rows="5"class="form-control"></textarea>
</div>
<div class="form-group mb-3">
<label for="image">Image</label>
<input type="file" name="image" class="form-control">
</div>
<div class="form-group mb-3">
<label for="button_url">Button URL</label>
<input type="url" name="button_url" class="form-control">
</div>
<button type="submit" class="btn btn-success">Save</button>
<a href="{{ route('services.index') }}" class="btn btn-secondary">Cancel</a>
</form>
</div>
@endsection

View File

@ -0,0 +1,40 @@
@extends('layouts.app')
@section('content')
<div class="container">
<h1>Edit Service</h1>
<form action="{{ route('services.update', $service->id) }}" method="POST" enctype="multipart/form-data">
@csrf
@method('PUT')
<div class="form-group mb-2">
<label>Title</label>
<input type="text" name="title" class="form-control" value="{{ $service->title }}">
</div>
<div class="form-group mb-2">
<label>Description</label>
<textarea name="description" class="form-control">{{ $service->description }}</textarea>
</div>
<div class="form-group mb-2">
<label>Button URL</label>
<input type="url" name="button_url" class="form-control" value="{{ $service->button_url }}">
</div>
<div class="form-group mb-2">
<label>Image</label>
<input type="file" name="image" class="form-control">
@if($service->image)
<div class="mt-2">
<img src="{{ asset('storage/' . $service->image) }}" width="150">
</div>
@endif
</div>
<button class="btn btn-success">Update</button>
<a href="{{ route('services.index') }}" class="btn btn-secondary">Cancel</a>
</form>
</div>
@endsection

View File

@ -0,0 +1,48 @@
@extends('layouts.app')
@section('content')
<div class="container">
<h1>Services</h1>
<a href="{{ route('services.create') }}" class="btn btn-primary mb-3">+ Add New Service</a>
@if(session('success'))
<div class="alert alert-success">{{ session('success') }}</div>
@endif
<table class="table table-bordered">
<thead>
<tr>
<th>Title</th>
<th>Description</th>
<th>Button URL</th>
<th>Image</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
@foreach($services as $service)
<tr>
<td>{{ $service->title }}</td>
<td>{{ Str::limit($service->description, 100) }}</td>
<td><a href="{{ $service->button_url }}" target="_blank">{{ $service->button_url }}</a></td>
<td>
@if($service->image)
<img src="{{ asset('storage/' . $service->image) }}" width="100">
@endif
</td>
<td>
<a href="{{ route('services.show', $service->id) }}" class="btn btn-sm btn-info">Show</a>
<a href="{{ route('services.edit', $service->id) }}" class="btn btn-sm btn-warning">Edit</a>
<form action="{{ route('services.destroy', $service->id) }}" method="POST" style="display:inline-block;">
@csrf
@method('DELETE')
<button class="btn btn-sm btn-danger" onclick="return confirm('Delete this?')">Delete</button>
</form>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
@endsection

View File

@ -0,0 +1,16 @@
@extends('layouts.app')
@section('content')
<div class="container">
<h1>{{ $service->title }}</h1>
<p>{{ $service->description }}</p>
@if($service->image)
<img src="{{ asset('storage/' . $service->image) }}" width="300">
@endif
@if($service->button_url)
<p><a href="{{ $service->button_url }}" target="_blank" class="btn btn-info">Visit</a></p>
@endif
</div>
@endsection