summaryrefslogtreecommitdiff
path: root/Year_3/TSDWL/LARAVEL/iBook/resources/views/books/edit.blade.php
diff options
context:
space:
mode:
authorSanto Cariotti <santo@dcariotti.me>2022-01-24 19:34:26 +0100
committerSanto Cariotti <santo@dcariotti.me>2022-01-24 19:34:26 +0100
commit710f54c0156c5fa081bc6af1a68e7cb44723939b (patch)
tree056a85c362b7b9c5439506a76e0802e57342cc10 /Year_3/TSDWL/LARAVEL/iBook/resources/views/books/edit.blade.php
parentb69d50c415ef1571bd42bb3eb1a1b3b38eab43dd (diff)
add example in laravel
Diffstat (limited to 'Year_3/TSDWL/LARAVEL/iBook/resources/views/books/edit.blade.php')
-rw-r--r--Year_3/TSDWL/LARAVEL/iBook/resources/views/books/edit.blade.php34
1 files changed, 34 insertions, 0 deletions
diff --git a/Year_3/TSDWL/LARAVEL/iBook/resources/views/books/edit.blade.php b/Year_3/TSDWL/LARAVEL/iBook/resources/views/books/edit.blade.php
new file mode 100644
index 0000000..1889b18
--- /dev/null
+++ b/Year_3/TSDWL/LARAVEL/iBook/resources/views/books/edit.blade.php
@@ -0,0 +1,34 @@
+@extends('layout')
+
+@section('content')
+<h1>Edit `{{ $book->name }}`</h1>
+
+<form method="post" action="/books/<?php echo $book->id; ?>">
+ @csrf
+ @method('put')
+ <div>
+ <label for="name">Name: </label>
+ <input type="text" name="name" id="name" required value="<?php echo $book->name; ?>">
+ </div>
+ <div>
+ <label for="published_at">Published at: </label>
+ <input type="datetime" name="published_at" id="published_at" value="<?php echo $book->published_at; ?>">
+ </div>
+ <div>
+ <label for="is_online">Is online?: </label>
+ <input type="checkbox" name="is_online" id="is_online" <?php echo ($book->is_online ? 'checked': ''); ?>>
+ </div>
+ <div>
+ <label for="author_id">Author: </label>
+ <select id="author_id" name="author_id">
+ <option value="">Select an author</option>
+ @foreach ($authors as $author)
+ <option value="{{ $author->id }}" <?php if($author->id == $book->author_id) { echo 'selected';
+ } ?>>
+{{ $author->name }}</option>
+ @endforeach
+ </select>
+ </div>
+ <button type="submit">Save</button>
+</form>
+@endsection