First Commit
This commit is contained in:
Executable
+49
@@ -0,0 +1,49 @@
|
||||
@extends('layout')
|
||||
|
||||
@section('title', 'Crud Example Create')
|
||||
|
||||
@section('content')
|
||||
<div class="container mt-5">
|
||||
<h1 class="text-success">Blade - Crud Example New Item</h1>
|
||||
|
||||
<!-- Display error message if any -->
|
||||
@if ($error)
|
||||
<div class="alert alert-danger">
|
||||
{{ $error }}
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<form action="/crudexample" method="POST">
|
||||
<?= csrf() ?>
|
||||
<div class="mb-3">
|
||||
<label for="name" class="form-label">Name:</label>
|
||||
<input type="text" id="name" name="name" class="form-control" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="password" class="form-label">Password:</label>
|
||||
<input type="password" id="password" name="password" class="form-control" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="company" class="form-label">Company:</label>
|
||||
<input type="text" id="company" name="company" class="form-control">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="address" class="form-label">Address:</label>
|
||||
<input type="text" id="address" name="address" class="form-control">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="phone" class="form-label">Phone:</label>
|
||||
<input type="text" id="phone" name="phone" class="form-control">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="email" class="form-label">Email:</label>
|
||||
<input type="email" id="email" name="email" class="form-control" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="notes" class="form-label">Notes:</label>
|
||||
<textarea id="notes" name="notes" class="form-control"></textarea>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">Create</button>
|
||||
</form>
|
||||
</div>
|
||||
@endsection
|
||||
Executable
+24
@@ -0,0 +1,24 @@
|
||||
@extends('layout')
|
||||
|
||||
@section('title', 'Crud example Delete')
|
||||
|
||||
@section('content')
|
||||
<div class="container mt-5">
|
||||
<h1 class="text-danger">Blade - Crud example Delete</h1>
|
||||
<form action="/clients/delete/{{ $client['id'] }}" method="POST">
|
||||
<input type="hidden" name="_method" value="POST"> <!-- Ensure that POST is used -->
|
||||
<p class="text-warning">
|
||||
Are you sure you want to delete client {{ $client['name'] }}?
|
||||
</p>
|
||||
<button type="submit" class="btn btn-danger">Delete</button>
|
||||
<a href="/clients" class="btn btn-secondary">Cancel</a>
|
||||
</form>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Executable
+50
@@ -0,0 +1,50 @@
|
||||
@extends('layout')
|
||||
|
||||
@section('title', 'Crud Example Edit')
|
||||
|
||||
@section('content')
|
||||
<div class="container mt-5">
|
||||
<h1 class="text-warning">Blade - Crud Example Edit</h1>
|
||||
<form action="/crudexample/update/{{ $crudexample['id'] }}" method="POST">
|
||||
<?= csrf() ?>
|
||||
<input type="hidden" name="_method" value="POST"> <!-- Changed to POST -->
|
||||
<div class="mb-3">
|
||||
<label for="name" class="form-label">Name:</label>
|
||||
<input type="text" id="name" name="name" class="form-control" value="{{ $crudexample['name'] }}" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="password" class="form-label">Password:</label>
|
||||
<input type="password" id="password" name="password" class="form-control">
|
||||
<input type="checkbox" id="showPassword" onclick="togglePassword()"> Show Password
|
||||
<script>
|
||||
function togglePassword() {
|
||||
var passwordInput = document.getElementById('password');
|
||||
var showPasswordCheckbox = document.getElementById('showPassword');
|
||||
passwordInput.type = showPasswordCheckbox.checked ? 'text' : 'password';
|
||||
}
|
||||
</script>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="company" class="form-label">Company:</label>
|
||||
<input type="text" id="company" name="company" class="form-control" value="{{ $crudexample['company'] }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="address" class="form-label">Address:</label>
|
||||
<input type="text" id="address" name="address" class="form-control" value="{{ $crudexample['address'] }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="phone" class="form-label">Phone:</label>
|
||||
<input type="text" id="phone" name="phone" class="form-control" value="{{ $crudexample['phone'] }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="email" class="form-label">Email:</label>
|
||||
<input type="email" id="email" name="email" class="form-control" value="{{ $crudexample['email'] }}" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="notes" class="form-label">Notes:</label>
|
||||
<textarea id="notes" name="notes" class="form-control">{{ $crudexample['notes'] }}</textarea>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">Update</button>
|
||||
</form>
|
||||
</div>
|
||||
@endsection
|
||||
Executable
+43
@@ -0,0 +1,43 @@
|
||||
@extends('layout')
|
||||
|
||||
@section('title', 'Crud Example List')
|
||||
|
||||
@section('content')
|
||||
<div class="container mt-5">
|
||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||
<h1 class="display-4 text-primary">Blade - Crud Example List</h1>
|
||||
<a href="/crudexample/create" class="btn btn-success btn-lg">Add New Item</a>
|
||||
</div>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-hover">
|
||||
<thead class="table-dark">
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Name</th>
|
||||
<th>Company</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($crudexample as $item)
|
||||
<tr>
|
||||
<td>{{ $item['id'] }}</td>
|
||||
<td>{{ $item['name'] }}</td>
|
||||
<td>{{ $item['company'] }}</td>
|
||||
<td>
|
||||
<a href="/crudexample/show/{{ $item['id'] }}" class="btn btn-info btn-sm me-2">View</a>
|
||||
<a href="/crudexample/edit/{{ $item['id'] }}" class="btn btn-warning btn-sm me-2">Edit</a>
|
||||
|
||||
<!-- Delete form -->
|
||||
<form action="/crudexample/delete/{{ $item['id'] }}" method="POST" style="display:inline;">
|
||||
<input type="hidden" name="_method" value="POST">
|
||||
<button type="submit" class="btn btn-danger btn-sm" onclick="return confirm('Are you sure?')">Delete</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
Executable
+48
@@ -0,0 +1,48 @@
|
||||
@extends('layout')
|
||||
|
||||
@section('title', 'Crud Example Show')
|
||||
|
||||
@section('content')
|
||||
<div class="container mt-5">
|
||||
<h1 class="text-info">Blade - Crud Example Show</h1>
|
||||
<table class="table table-bordered table-striped">
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<td>{{ $crudexample['id'] }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<td>{{ $crudexample['name'] }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Company</th>
|
||||
<td>{{ $crudexample['company'] }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Address</th>
|
||||
<td>{{ $crudexample['address'] }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Phone</th>
|
||||
<td>{{ $crudexample['phone'] }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Email</th>
|
||||
<td>{{ $crudexample['email'] }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Notes</th>
|
||||
<td>{{ $crudexample['notes'] }}</td>
|
||||
</tr>
|
||||
</table>
|
||||
<a href="/crudexample/edit/{{ $crudexample['id'] }}" class="btn btn-warning me-2">Edit</a>
|
||||
|
||||
<!-- Delete form -->
|
||||
<form action="/crudexample/delete/{{ $crudexample['id'] }}" method="POST" style="display:inline;">
|
||||
<input type="hidden" name="_method" value="POST">
|
||||
<button type="submit" class="btn btn-danger me-2" onclick="return confirm('Are you sure?')">Delete</button>
|
||||
</form>
|
||||
|
||||
<a href="/crudexample" class="btn btn-secondary">Back to List</a>
|
||||
</div>
|
||||
@endsection
|
||||
Reference in New Issue
Block a user