PHP Classes

File: resources/js/Pages/Posts/Edit.vue

Recommend this page to a friend!
  Classes of Rodrigo Faustino   Vue.js PHP CRUD Example Using Laravel Vite   resources/js/Pages/Posts/Edit.vue   Download  
File: resources/js/Pages/Posts/Edit.vue
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Vue.js PHP CRUD Example Using Laravel Vite
Example application to manage users and blog posts
Author: By
Last change:
Date: 11 months ago
Size: 3,726 bytes
 

Contents

Class file image Download
<script setup> import BreezeAuthenticatedLayout from '@/Layouts/Authenticated.vue'; import BreezeLabel from '@/Components/Label.vue'; import BreezeInput from '@/Components/Input.vue'; import BreezeTextArea from '@/Components/Textarea.vue'; import { Head, Link, useForm } from '@inertiajs/inertia-vue3'; const props = defineProps({ post: Object, }); const form = useForm({ title: props.post.title, body: props.post.body }); const submit = () => { form.put(route('posts.update', props.post.id)); }; </script> <template> <Head title="Dashboard" /> <BreezeAuthenticatedLayout> <template #header> <h2 class="font-semibold text-xl text-gray-800 leading-tight"> Edit Post </h2> </template> <div class="py-12"> <div class="max-w-7xl mx-auto sm:px-6 lg:px-8"> <div class="bg-white overflow-hidden shadow-sm sm:rounded-lg"> <div class="p-6 bg-white border-b border-gray-200"> <div className="flex items-center justify-between mb-6"> <Link className="px-6 py-2 text-white bg-blue-500 rounded-md focus:outline-none" :href="route('posts.index')" > Back </Link> </div> <form name="createForm" @submit.prevent="submit"> <div className="flex flex-col"> <div className="mb-4"> <BreezeLabel for="title" value="Title" /> <BreezeInput id="title" type="text" class="mt-1 block w-full" v-model="form.title" autofocus /> <span className="text-red-600" v-if="form.errors.title"> {{ form.errors.title }} </span> </div> <div className="mb-4"> <BreezeLabel for="body" value="Body" /> <BreezeTextArea id="body" class="mt-1 block w-full" v-model="form.body" autofocus /> <span className="text-red-600" v-if="form.errors.body"> {{ form.errors.body }} </span> </div> </div> <div className="mt-4"> <button type="submit" className="px-6 py-2 font-bold text-white bg-green-500 rounded" > Save </button> </div> </form> </div> </div> </div> </div> </BreezeAuthenticatedLayout> </template>