Vue Inertia + Laravel Course. 12/17: Delete Record

preview_player
Показать описание
This lesson is about Inertia submit of the form without the form helper, showing the example of the delete method

- - - - -
Support the channel by checking out our products:
Рекомендации по теме
Комментарии
Автор

this is exactly what I've thinking about, and took me hours to figure it out

matinlh
Автор

Hello, I want to ask, I perform deleting a file, but it redirects me and shows the file still exists untill I refresh manually the page? Can you help me what is wrong? Thank you

zapikk
Автор

in destroy function I receive only id of Post, not a Post object, so $post->delete() won't work, I need to $post=Post::find($id) first. Any suggestions why?

FrytaPL
Автор

Wow nice content I will make that tutorial

RedempleMarcelo
Автор

Inertia.delete reloads page,
this.$inertia.delete does not. Can't figure out why.

KarSlon
Автор

Its working for me (Composition API):
<script setup>

const props = defineProps({
post: Object,
});

const deletePost= () => {
if (confirm(`Are you sure you want to delete the course "${props.post.name}"?`)) {
router.delete(route('post.destroy', props.post.id), {
onSuccess: () => {
},
onError: (error) => {
console.error(error);
},
});
}
};
</script>

Roman_Nikolaevich