CINXE.COM

Laravel Bootcamp

<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Laravel Bootcamp</title> <!-- Primary Meta Tags --> <meta name="title" content="Laravel Bootcamp - Learn the PHP Framework for Web Artisans"> <meta name="description" content="Together let's walk through building and deploying a modern Laravel application from scratch."> <!-- Open Graph / Facebook --> <meta property="og:type" content="website"> <meta property="og:url" content="https://bootcamp.laravel.com/"> <meta property="og:title" content="Laravel Bootcamp - Learn the PHP Framework for Web Artisans"> <meta property="og:description" content="Together let's walk through building and deploying a modern Laravel application from scratch."> <meta property="og:image" content="https://bootcamp.laravel.com/img/og-image.jpg"> <!-- Twitter --> <meta property="twitter:card" content="summary_large_image"> <meta property="twitter:url" content="https://bootcamp.laravel.com/"> <meta property="twitter:title" content="Laravel - Learn the PHP Framework for Web Artisans"> <meta property="twitter:description" content="Together let's walk through building and deploying a modern Laravel application from scratch."> <meta property="twitter:image" content="https://bootcamp.laravel.com/img/og-image.jpg"> <!-- Favicon --> <link rel="apple-touch-icon" sizes="180x180" href="/img/favicon/apple-touch-icon.png"> <link rel="icon" type="image/png" sizes="32x32" href="/img/favicon/favicon-32x32.png"> <link rel="icon" type="image/png" sizes="16x16" href="/img/favicon/favicon-16x16.png"> <link rel="manifest" href="/img/favicon/site.webmanifest"> <link rel="mask-icon" href="/img/favicon/safari-pinned-tab.svg" color="#ff2d20"> <link rel="shortcut icon" href="/img/favicon/favicon.ico"> <meta name="msapplication-TileColor" content="#ff2d20"> <meta name="msapplication-config" content="/img/favicon/browserconfig.xml"> <meta name="theme-color" content="#ffffff"> <meta name="color-scheme" content="light"> <!-- Fonts --> <link rel="stylesheet" href="https://use.typekit.net/ins2wgm.css"> <!-- Scripts & Styles --> <link rel="stylesheet" href="https://bootcamp.laravel.com/build/assets/app.1fe37668.css" /><script type="module" src="https://bootcamp.laravel.com/build/assets/app.f1116ac0.js"></script> <!-- Fathom - beautiful, simple website analytics --> <script src="https://cdn.usefathom.com/script.js" data-site="KRRQTWHM" defer></script> <!-- / Fathom --> <script> window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { if (localStorage.theme === 'system') { if (e.matches) { document.documentElement.classList.add('dark'); } else { document.documentElement.classList.remove('dark'); } } }); function updateTheme() { if (!('theme' in localStorage)) { localStorage.theme = 'system'; } switch (localStorage.theme) { case 'system': if (window.matchMedia('(prefers-color-scheme: dark)').matches) { document.documentElement.classList.add('dark'); } else { document.documentElement.classList.remove('dark'); } document.documentElement.setAttribute('color-theme', 'system'); break; case 'dark': document.documentElement.classList.add('dark'); document.documentElement.setAttribute('color-theme', 'dark'); break; case 'light': document.documentElement.classList.remove('dark'); document.documentElement.setAttribute('color-theme', 'light'); break; } } updateTheme(); </script> </head> <body x-data="{ navIsOpen: false }" class="font-sans text-gray-900 antialiased" > <a id="skip-to-content-link" href="#main-content" class="absolute bg-gray-100 px-4 py-2 top-3 left-3 text-gray-700 shadow-xl" > Skip to content </a> <div class="min-h-screen dark:bg-dark-700"> <div class="relative lg:flex lg:items-start"> <aside id="sidebar" class="min-h-screen hidden fixed top-0 bottom-0 left-0 z-20 h-full w-16 bg-gradient-to-b from-gray-100 to-white transition-all duration-300 overflow-hidden lg:sticky lg:w-80 lg:shrink-0 lg:flex lg:flex-col lg:justify-end lg:items-end 2xl:max-w-lg 2xl:w-full dark:from-dark-800 dark:to-dark-700" > <div class="relative min-h-0 flex-1 flex flex-col xl:w-80"> <a href="/" class="flex items-center py-8 px-4 lg:px-8 xl:px-16"> <img class="w-8 h-8 shrink-0 transition-all duration-300 lg:w-12 lg:h-12" :class="{ 'w-12 h-12': navIsOpen }" src="/img/logomark.min.svg" alt="Laravel" width="50" height="52" > <span class="hidden lg:block ml-4 text-red-500 text-3xl font-medium">Bootcamp</span> </a> <div class="overflow-y-auto overflow-x-hidden px-4 lg:overflow-hidden lg:px-8 xl:px-16"> <nav id="indexed-nav" class="hidden lg:block lg:mt-4"> <div class="docs_sidebar"> <ul> <li> <h2><a id="introduction" href="#introduction" class="heading-permalink" aria-hidden="true" title="Permalink">#</a><a href="/introduction">Introduction</a></h2> </li> <li> <h2><a id="build-chirper-with-blade" href="#build-chirper-with-blade" class="heading-permalink" aria-hidden="true" title="Permalink">#</a>Build Chirper with Blade</h2> <ul> <li> <a href="/blade/installation">Installation</a> </li> <li> <a href="/blade/creating-chirps">Creating Chirps</a> </li> <li> <a href="/blade/showing-chirps">Showing Chirps</a> </li> <li> <a href="/blade/editing-chirps">Editing Chirps</a> </li> <li> <a href="/blade/deleting-chirps">Deleting Chirps</a> </li> <li> <a href="/blade/notifications-and-events">Notifications &amp; Events</a> </li> </ul> </li> <li> <h2><a id="build-chirper-with-livewire" href="#build-chirper-with-livewire" class="heading-permalink" aria-hidden="true" title="Permalink">#</a>Build Chirper with Livewire</h2> <ul> <li> <a href="/livewire/installation">Installation</a> </li> <li> <a href="/livewire/creating-chirps">Creating Chirps</a> </li> <li> <a href="/livewire/showing-chirps">Showing Chirps</a> </li> <li> <a href="/livewire/editing-chirps">Editing Chirps</a> </li> <li> <a href="/livewire/deleting-chirps">Deleting Chirps</a> </li> <li> <a href="/livewire/notifications-and-events">Notifications &amp; Events</a> </li> </ul> </li> <li> <h2><a id="build-chirper-with-inertia" href="#build-chirper-with-inertia" class="heading-permalink" aria-hidden="true" title="Permalink">#</a>Build Chirper with Inertia</h2> <ul> <li> <a href="/inertia/installation">Installation</a> </li> <li> <a href="/inertia/creating-chirps">Creating Chirps</a> </li> <li> <a href="/inertia/showing-chirps">Showing Chirps</a> </li> <li> <a href="/inertia/editing-chirps">Editing Chirps</a> </li> <li> <a href="/inertia/deleting-chirps">Deleting Chirps</a> </li> <li> <a href="/inertia/notifications-and-events">Notifications &amp; Events</a> </li> </ul> </li> <li> <h2><a id="deploying" href="#deploying" class="heading-permalink" aria-hidden="true" title="Permalink">#</a><a href="/deploying">Deploying</a></h2> </li> <li> <h2><a id="conclusion" href="#conclusion" class="heading-permalink" aria-hidden="true" title="Permalink">#</a><a href="/conclusion">Conclusion</a></h2> </li> </ul> </div> </nav> </div> <div class="flex-grow flex flex-col justify-end"> <div class="hidden 2xl:block mb-12 pl-16"> <svg x-data="{ initializeAnimation: false, init() { setTimeout(() => { this.initializeAnimation = true; }, 0); }, }" :class="initializeAnimation ? 'animate-cube' : ''" class="text-red-600 ml-8" width="46" height="53" viewBox="0 0 46 53" fill="none" xmlns="http://www.w3.org/2000/svg" > <path d="m23.102 1 22.1 12.704v25.404M23.101 1l-22.1 12.704v25.404" stroke="currentColor" stroke-width="1.435" stroke-linejoin="bevel"/><path d="m45.202 39.105-22.1 12.702L1 39.105" stroke="currentColor" stroke-width="1.435" stroke-linejoin="bevel"/><path transform="matrix(.86698 .49834 .00003 1 1 13.699)" stroke="currentColor" stroke-width="1.435" stroke-linejoin="bevel" d="M0 0h25.491v25.405H0z"/><path transform="matrix(.86698 -.49834 -.00003 1 23.102 26.402)" stroke="currentColor" stroke-width="1.435" stroke-linejoin="bevel" d="M0 0h25.491v25.405H0z"/><path transform="matrix(.86701 -.49829 .86701 .49829 1 13.702)" stroke="currentColor" stroke-width="1.435" stroke-linejoin="bevel" d="M0 0h25.491v25.491H0z"/> </svg> <svg x-data="{ initializeAnimation: false, init() { setTimeout(() => { this.initializeAnimation = true; }, 2000); }, }" :class="initializeAnimation ? 'animate-cube' : ''" class="text-red-600 mt-6 ml-32" width="46" height="53" viewBox="0 0 46 53" fill="none" xmlns="http://www.w3.org/2000/svg" > <path d="m23.102 1 22.1 12.704v25.404M23.101 1l-22.1 12.704v25.404" stroke="currentColor" stroke-width="1.435" stroke-linejoin="bevel"/><path d="m45.202 39.105-22.1 12.702L1 39.105" stroke="currentColor" stroke-width="1.435" stroke-linejoin="bevel"/><path transform="matrix(.86698 .49834 .00003 1 1 13.699)" stroke="currentColor" stroke-width="1.435" stroke-linejoin="bevel" d="M0 0h25.491v25.405H0z"/><path transform="matrix(.86698 -.49834 -.00003 1 23.102 26.402)" stroke="currentColor" stroke-width="1.435" stroke-linejoin="bevel" d="M0 0h25.491v25.405H0z"/><path transform="matrix(.86701 -.49829 .86701 .49829 1 13.702)" stroke="currentColor" stroke-width="1.435" stroke-linejoin="bevel" d="M0 0h25.491v25.491H0z"/> </svg> <svg x-data="{ initializeAnimation: false, init() { setTimeout(() => { this.initializeAnimation = true; }, 1000); }, }" :class="initializeAnimation ? 'animate-cube' : ''" class="text-red-600 mt-12" width="46" height="53" viewBox="0 0 46 53" fill="none" xmlns="http://www.w3.org/2000/svg" > <path d="m23.102 1 22.1 12.704v25.404M23.101 1l-22.1 12.704v25.404" stroke="currentColor" stroke-width="1.435" stroke-linejoin="bevel"/><path d="m45.202 39.105-22.1 12.702L1 39.105" stroke="currentColor" stroke-width="1.435" stroke-linejoin="bevel"/><path transform="matrix(.86698 .49834 .00003 1 1 13.699)" stroke="currentColor" stroke-width="1.435" stroke-linejoin="bevel" d="M0 0h25.491v25.405H0z"/><path transform="matrix(.86698 -.49834 -.00003 1 23.102 26.402)" stroke="currentColor" stroke-width="1.435" stroke-linejoin="bevel" d="M0 0h25.491v25.405H0z"/><path transform="matrix(.86701 -.49829 .86701 .49829 1 13.702)" stroke="currentColor" stroke-width="1.435" stroke-linejoin="bevel" d="M0 0h25.491v25.491H0z"/> </svg> </div> </div> </div> </aside> <header id="header" class="lg:hidden" @keydown.window.escape="navIsOpen = false" @click.away="navIsOpen = false" > <div class="relative mx-auto w-full py-10 bg-white transition duration-200 dark:bg-dark-700"> <div class="mx-auto px-8 sm:px-16 flex items-center justify-between"> <a href="/" class="flex items-center"> <img class="" src="/img/logomark.min.svg" alt="Laravel"> <span class="hidden sm:block ml-5 text-red-500 text-3xl font-medium">Bootcamp</span> </a> <div class="flex-1 flex items-center justify-end"> <button id="header__sun" onclick="toSystemMode()" title="Switch to system theme" class="relative w-10 h-10 focus:outline-none focus:shadow-outline text-gray-500"> <svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-sun" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> <circle cx="12" cy="12" r="4"></circle> <path d="M3 12h1m8 -9v1m8 8h1m-9 8v1m-6.4 -15.4l.7 .7m12.1 -.7l-.7 .7m0 11.4l.7 .7m-12.1 -.7l-.7 .7"></path> </svg> </button> <button id="header__moon" onclick="toLightMode()" title="Switch to light mode" class="relative w-10 h-10 focus:outline-none focus:shadow-outline text-gray-500"> <svg style="width:24px;height:24px" viewBox="0 0 24 24"> <path fill="currentColor" d="M17.75,4.09L15.22,6.03L16.13,9.09L13.5,7.28L10.87,9.09L11.78,6.03L9.25,4.09L12.44,4L13.5,1L14.56,4L17.75,4.09M21.25,11L19.61,12.25L20.2,14.23L18.5,13.06L16.8,14.23L17.39,12.25L15.75,11L17.81,10.95L18.5,9L19.19,10.95L21.25,11M18.97,15.95C19.8,15.87 20.69,17.05 20.16,17.8C19.84,18.25 19.5,18.67 19.08,19.07C15.17,23 8.84,23 4.94,19.07C1.03,15.17 1.03,8.83 4.94,4.93C5.34,4.53 5.76,4.17 6.21,3.85C6.96,3.32 8.14,4.21 8.06,5.04C7.79,7.9 8.75,10.87 10.95,13.06C13.14,15.26 16.1,16.22 18.97,15.95M17.33,17.97C14.5,17.81 11.7,16.64 9.53,14.5C7.36,12.31 6.2,9.5 6.04,6.68C3.23,9.82 3.34,14.64 6.35,17.66C9.37,20.67 14.19,20.78 17.33,17.97Z" /> </svg> </button> <button id="header__indeterminate" onclick="toDarkMode()" title="Switch to dark mode" class="relative w-10 h-10 focus:outline-none focus:shadow-outline text-gray-500"> <svg style="width:24px;height:24px" viewBox="0 0 24 24"> <path fill="currentColor" d="M12 2A10 10 0 0 0 2 12A10 10 0 0 0 12 22A10 10 0 0 0 22 12A10 10 0 0 0 12 2M12 4A8 8 0 0 1 20 12A8 8 0 0 1 12 20V4Z" /> </svg> </button> <button class="ml-2 relative w-10 h-10 p-2 text-red-600 lg:hidden focus:outline-none focus:shadow-outline" aria-label="Menu" @click.prevent="navIsOpen = !navIsOpen"> <svg x-show="! navIsOpen" x-transition.opacity class="absolute inset-0 mt-2 ml-2 w-6 h-6" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round"><line x1="3" y1="12" x2="21" y2="12"></line><line x1="3" y1="6" x2="21" y2="6"></line><line x1="3" y1="18" x2="21" y2="18"></line></svg> <svg x-show="navIsOpen" x-transition.opacity x-cloak class="absolute inset-0 mt-2 ml-2 w-6 h-6" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg> </button> </div> </div> <span :class="{ 'shadow-sm': navIsOpen }" class="absolute inset-0 z-20 pointer-events-none"></span> </div> <div x-show="navIsOpen" x-transition:enter="duration-150" x-transition:leave="duration-100 ease-in" x-cloak > <nav x-show="navIsOpen" x-cloak class="absolute w-full transform origin-top shadow-sm z-10" x-transition:enter="duration-150 ease-out" x-transition:enter-start="opacity-0 -translate-y-8 scale-75" x-transition:enter-end="opacity-100 scale-100" x-transition:leave="duration-100 ease-in" x-transition:leave-start="opacity-100 scale-100" x-transition:leave-end="opacity-0 -translate-y-8 scale-75" > <div class="relative p-8 bg-white docs_sidebar dark:bg-dark-600"> <ul> <li> <h2><a id="introduction" href="#introduction" class="heading-permalink" aria-hidden="true" title="Permalink">#</a><a href="/introduction">Introduction</a></h2> </li> <li> <h2><a id="build-chirper-with-blade" href="#build-chirper-with-blade" class="heading-permalink" aria-hidden="true" title="Permalink">#</a>Build Chirper with Blade</h2> <ul> <li> <a href="/blade/installation">Installation</a> </li> <li> <a href="/blade/creating-chirps">Creating Chirps</a> </li> <li> <a href="/blade/showing-chirps">Showing Chirps</a> </li> <li> <a href="/blade/editing-chirps">Editing Chirps</a> </li> <li> <a href="/blade/deleting-chirps">Deleting Chirps</a> </li> <li> <a href="/blade/notifications-and-events">Notifications &amp; Events</a> </li> </ul> </li> <li> <h2><a id="build-chirper-with-livewire" href="#build-chirper-with-livewire" class="heading-permalink" aria-hidden="true" title="Permalink">#</a>Build Chirper with Livewire</h2> <ul> <li> <a href="/livewire/installation">Installation</a> </li> <li> <a href="/livewire/creating-chirps">Creating Chirps</a> </li> <li> <a href="/livewire/showing-chirps">Showing Chirps</a> </li> <li> <a href="/livewire/editing-chirps">Editing Chirps</a> </li> <li> <a href="/livewire/deleting-chirps">Deleting Chirps</a> </li> <li> <a href="/livewire/notifications-and-events">Notifications &amp; Events</a> </li> </ul> </li> <li> <h2><a id="build-chirper-with-inertia" href="#build-chirper-with-inertia" class="heading-permalink" aria-hidden="true" title="Permalink">#</a>Build Chirper with Inertia</h2> <ul> <li> <a href="/inertia/installation">Installation</a> </li> <li> <a href="/inertia/creating-chirps">Creating Chirps</a> </li> <li> <a href="/inertia/showing-chirps">Showing Chirps</a> </li> <li> <a href="/inertia/editing-chirps">Editing Chirps</a> </li> <li> <a href="/inertia/deleting-chirps">Deleting Chirps</a> </li> <li> <a href="/inertia/notifications-and-events">Notifications &amp; Events</a> </li> </ul> </li> <li> <h2><a id="deploying" href="#deploying" class="heading-permalink" aria-hidden="true" title="Permalink">#</a><a href="/deploying">Deploying</a></h2> </li> <li> <h2><a id="conclusion" href="#conclusion" class="heading-permalink" aria-hidden="true" title="Permalink">#</a><a href="/conclusion">Conclusion</a></h2> </li> </ul> </div> </nav> </div> </header> <section class="flex-1 dark:bg-dark-700"> <span class="hidden dark:hidden fixed -bottom-[350px] ml-[300px] bg-radial-gradient opacity-[.15] pointer-events-none lg:inline-flex w-[800px] h-[600px]"></span> <div class="px-8 sm:px-16 lg:px-24"> <div class="max-w-screen-lg flex flex-col items-end transition-colors dark:border-gray-700 lg:mt-8 lg:flex-row-reverse"> <div class="fixed top-8 hidden lg:flex items-center justify-center"> <button id="header__sun" onclick="toSystemMode()" title="Switch to system theme" class="relative w-10 h-10 focus:outline-none focus:shadow-outline text-gray-500"> <svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-sun" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> <circle cx="12" cy="12" r="4"></circle> <path d="M3 12h1m8 -9v1m8 8h1m-9 8v1m-6.4 -15.4l.7 .7m12.1 -.7l-.7 .7m0 11.4l.7 .7m-12.1 -.7l-.7 .7"></path> </svg> </button> <button id="header__moon" onclick="toLightMode()" title="Switch to light mode" class="relative w-10 h-10 focus:outline-none focus:shadow-outline text-gray-500"> <svg style="width:24px;height:24px" viewBox="0 0 24 24"> <path fill="currentColor" d="M17.75,4.09L15.22,6.03L16.13,9.09L13.5,7.28L10.87,9.09L11.78,6.03L9.25,4.09L12.44,4L13.5,1L14.56,4L17.75,4.09M21.25,11L19.61,12.25L20.2,14.23L18.5,13.06L16.8,14.23L17.39,12.25L15.75,11L17.81,10.95L18.5,9L19.19,10.95L21.25,11M18.97,15.95C19.8,15.87 20.69,17.05 20.16,17.8C19.84,18.25 19.5,18.67 19.08,19.07C15.17,23 8.84,23 4.94,19.07C1.03,15.17 1.03,8.83 4.94,4.93C5.34,4.53 5.76,4.17 6.21,3.85C6.96,3.32 8.14,4.21 8.06,5.04C7.79,7.9 8.75,10.87 10.95,13.06C13.14,15.26 16.1,16.22 18.97,15.95M17.33,17.97C14.5,17.81 11.7,16.64 9.53,14.5C7.36,12.31 6.2,9.5 6.04,6.68C3.23,9.82 3.34,14.64 6.35,17.66C9.37,20.67 14.19,20.78 17.33,17.97Z" /> </svg> </button> <button id="header__indeterminate" onclick="toDarkMode()" title="Switch to dark mode" class="relative w-10 h-10 focus:outline-none focus:shadow-outline text-gray-500"> <svg style="width:24px;height:24px" viewBox="0 0 24 24"> <path fill="currentColor" d="M12 2A10 10 0 0 0 2 12A10 10 0 0 0 12 22A10 10 0 0 0 22 12A10 10 0 0 0 12 2M12 4A8 8 0 0 1 20 12A8 8 0 0 1 12 20V4Z" /> </svg> </button> </div> </div> <section class="pt-8 pb-8 md:pt-16 md:pb-16 flex"> <section class="docs_main flex-1 max-w-full"> <div id="main-content"> <div class="prose dark:prose-invert relative"> <aside class="table-of-contents-sidebar-wrapper not-prose"><aside class="table-of-contents-sidebar not-prose"><h2>On this page</h2><ul class="table-of-contents"> <li> <a href="#routing">Routing</a> </li> <li> <a href="#updating-our-component">Updating our component</a> </li> <li> <a href="#updating-our-controller">Updating our controller</a> </li> <li> <a href="#authorization">Authorization</a> </li> <li> <a href="#testing-it-out">Testing it out</a> </li> </ul></aside></aside> <h1><b>05.</b> Editing Chirps</h1> <p>Let's add a feature that's missing from other popular bird-themed microblogging platforms — the ability to edit Chirps!</p> <h2><a id="routing" href="#routing" class="heading-permalink" aria-hidden="true" title="Permalink">#</a>Routing</h2> <p>First we will update our routes file to enable the <code>chirps.update</code> route for our resource controller:</p> <div class="code-container"> <div class="code-container-filename">routes/web.php</div> <pre><code data-theme="olaolu-palenight" data-lang="php" class='torchlight has-add-lines has-remove-lines has-diff-lines has-summaries' style='background-color: #292D3E; --theme-selection-background: #7580B850;'><!-- Syntax highlighted by torchlight.dev --><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-empty' style='user-select: none; color: #4c5374'></span><span style="color: #D3423E;">&lt;?php</span></div><details><summary style='cursor: pointer; display: block'><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-start' style='user-select: none; color: #4c5374'></span>&nbsp;<span class='summary-hide-when-open' style='color:#4c5374'>...</span></div></summary><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #C792EA;">use</span><span style="color: #BFC7D5;"> App\Http\Controllers\</span><span style="color: #FFCB8B;">ChirpController</span><span style="color: #BFC7D5;">;</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #C792EA;">use</span><span style="color: #BFC7D5;"> App\Http\Controllers\</span><span style="color: #FFCB8B;">ProfileController</span><span style="color: #BFC7D5;">;</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #C792EA;">use</span><span style="color: #BFC7D5;"> Illuminate\Foundation\</span><span style="color: #FFCB8B;">Application</span><span style="color: #BFC7D5;">;</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #C792EA;">use</span><span style="color: #BFC7D5;"> Illuminate\Support\Facades\</span><span style="color: #FFCB8B;">Route</span><span style="color: #BFC7D5;">;</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #C792EA;">use</span><span style="color: #BFC7D5;"> Inertia\</span><span style="color: #FFCB8B;">Inertia</span><span style="color: #BFC7D5;">;</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span>&nbsp;</div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #FFCB8B;">Route</span><span style="color: #89DDFF;">::</span><span style="color: #82AAFF;">get</span><span style="color: #BFC7D5;">(</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #C3E88D;">/</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #BFC7D5;">, </span><span style="color: #C792EA;">function</span><span style="color: #BFC7D5;"> </span><span style="color: #D9F5DD;">()</span><span style="color: #BFC7D5;"> {</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> </span><span style="color: #C792EA;">return</span><span style="color: #BFC7D5;"> </span><span style="color: #FFCB8B;">Inertia</span><span style="color: #89DDFF;">::</span><span style="color: #82AAFF;">render</span><span style="color: #BFC7D5;">(</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #C3E88D;">Welcome</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #BFC7D5;">, [</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> </span><span style="color: #D9F5DD;">&#39;</span><span style="color: #C3E88D;">canLogin</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #BFC7D5;"> </span><span style="color: #89DDFF;">=&gt;</span><span style="color: #BFC7D5;"> </span><span style="color: #FFCB8B;">Route</span><span style="color: #89DDFF;">::</span><span style="color: #82AAFF;">has</span><span style="color: #BFC7D5;">(</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #C3E88D;">login</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #BFC7D5;">),</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> </span><span style="color: #D9F5DD;">&#39;</span><span style="color: #C3E88D;">canRegister</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #BFC7D5;"> </span><span style="color: #89DDFF;">=&gt;</span><span style="color: #BFC7D5;"> </span><span style="color: #FFCB8B;">Route</span><span style="color: #89DDFF;">::</span><span style="color: #82AAFF;">has</span><span style="color: #BFC7D5;">(</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #C3E88D;">register</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #BFC7D5;">),</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> </span><span style="color: #D9F5DD;">&#39;</span><span style="color: #C3E88D;">laravelVersion</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #BFC7D5;"> </span><span style="color: #89DDFF;">=&gt;</span><span style="color: #BFC7D5;"> </span><span style="color: #FFCB8B;">Application</span><span style="color: #89DDFF;">::</span><span style="color: #82AAFF;">VERSION</span><span style="color: #BFC7D5;">,</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> </span><span style="color: #D9F5DD;">&#39;</span><span style="color: #C3E88D;">phpVersion</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #BFC7D5;"> </span><span style="color: #89DDFF;">=&gt;</span><span style="color: #BFC7D5;"> </span><span style="color: #89DDFF;">PHP_VERSION</span><span style="color: #BFC7D5;">,</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> ]);</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;">});</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span>&nbsp;</div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #FFCB8B;">Route</span><span style="color: #89DDFF;">::</span><span style="color: #82AAFF;">get</span><span style="color: #BFC7D5;">(</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #C3E88D;">/dashboard</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #BFC7D5;">, </span><span style="color: #C792EA;">function</span><span style="color: #BFC7D5;"> </span><span style="color: #D9F5DD;">()</span><span style="color: #BFC7D5;"> {</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> </span><span style="color: #C792EA;">return</span><span style="color: #BFC7D5;"> </span><span style="color: #FFCB8B;">Inertia</span><span style="color: #89DDFF;">::</span><span style="color: #82AAFF;">render</span><span style="color: #BFC7D5;">(</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #C3E88D;">Dashboard</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #BFC7D5;">);</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;">})</span><span style="color: #89DDFF;">-&gt;</span><span style="color: #82AAFF;">middleware</span><span style="color: #BFC7D5;">([</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #C3E88D;">auth</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #BFC7D5;">, </span><span style="color: #D9F5DD;">&#39;</span><span style="color: #C3E88D;">verified</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #BFC7D5;">])</span><span style="color: #89DDFF;">-&gt;</span><span style="color: #82AAFF;">name</span><span style="color: #BFC7D5;">(</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #C3E88D;">dashboard</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #BFC7D5;">);</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span>&nbsp;</div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #FFCB8B;">Route</span><span style="color: #89DDFF;">::</span><span style="color: #82AAFF;">middleware</span><span style="color: #BFC7D5;">(</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #C3E88D;">auth</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #BFC7D5;">)</span><span style="color: #89DDFF;">-&gt;</span><span style="color: #82AAFF;">group</span><span style="color: #BFC7D5;">(</span><span style="color: #C792EA;">function</span><span style="color: #BFC7D5;"> </span><span style="color: #D9F5DD;">()</span><span style="color: #BFC7D5;"> {</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> </span><span style="color: #FFCB8B;">Route</span><span style="color: #89DDFF;">::</span><span style="color: #82AAFF;">get</span><span style="color: #BFC7D5;">(</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #C3E88D;">/profile</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #BFC7D5;">, [</span><span style="color: #FFCB8B;">ProfileController</span><span style="color: #89DDFF;">::</span><span style="color: #C792EA;">class</span><span style="color: #BFC7D5;">, </span><span style="color: #D9F5DD;">&#39;</span><span style="color: #C3E88D;">edit</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #BFC7D5;">])</span><span style="color: #89DDFF;">-&gt;</span><span style="color: #82AAFF;">name</span><span style="color: #BFC7D5;">(</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #C3E88D;">profile.edit</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #BFC7D5;">);</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> </span><span style="color: #FFCB8B;">Route</span><span style="color: #89DDFF;">::</span><span style="color: #82AAFF;">patch</span><span style="color: #BFC7D5;">(</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #C3E88D;">/profile</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #BFC7D5;">, [</span><span style="color: #FFCB8B;">ProfileController</span><span style="color: #89DDFF;">::</span><span style="color: #C792EA;">class</span><span style="color: #BFC7D5;">, </span><span style="color: #D9F5DD;">&#39;</span><span style="color: #C3E88D;">update</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #BFC7D5;">])</span><span style="color: #89DDFF;">-&gt;</span><span style="color: #82AAFF;">name</span><span style="color: #BFC7D5;">(</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #C3E88D;">profile.update</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #BFC7D5;">);</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> </span><span style="color: #FFCB8B;">Route</span><span style="color: #89DDFF;">::</span><span style="color: #82AAFF;">delete</span><span style="color: #BFC7D5;">(</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #C3E88D;">/profile</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #BFC7D5;">, [</span><span style="color: #FFCB8B;">ProfileController</span><span style="color: #89DDFF;">::</span><span style="color: #C792EA;">class</span><span style="color: #BFC7D5;">, </span><span style="color: #D9F5DD;">&#39;</span><span style="color: #C3E88D;">destroy</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #BFC7D5;">])</span><span style="color: #89DDFF;">-&gt;</span><span style="color: #82AAFF;">name</span><span style="color: #BFC7D5;">(</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #C3E88D;">profile.destroy</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #BFC7D5;">);</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;">});</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-end' style='user-select: none; color: #4c5374'></span>&nbsp;</div></details><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-empty' style='user-select: none; color: #4c5374'></span><span style="color: #FFCB8B;">Route</span><span style="color: #89DDFF;">::</span><span style="color: #82AAFF;">resource</span><span style="color: #BFC7D5;">(</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #C3E88D;">chirps</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #BFC7D5;">, </span><span style="color: #FFCB8B;">ChirpController</span><span style="color: #89DDFF;">::</span><span style="color: #C792EA;">class</span><span style="color: #BFC7D5;">)</span></div><div class='line line-remove line-has-background' style='background-color: #ef535033'><span style="color:#f07178; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">-</span><span class='summary-caret summary-caret-empty' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> </span><span style="color: #89DDFF;">-&gt;</span><span style="color: #82AAFF;">only</span><span style="color: #BFC7D5;">([</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #C3E88D;">index</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #BFC7D5;">, </span><span style="color: #D9F5DD;">&#39;</span><span style="color: #C3E88D;">store</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #BFC7D5;">])</span></div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span class='summary-caret summary-caret-empty' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> </span><span style="color: #89DDFF;">-&gt;</span><span style="color: #82AAFF;">only</span><span style="color: #BFC7D5;">([</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #C3E88D;">index</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #BFC7D5;">, </span><span style="color: #D9F5DD;">&#39;</span><span style="color: #C3E88D;">store</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #BFC7D5;">, </span><span style="color: #D9F5DD;">&#39;</span><span style="color: #C3E88D;">update</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #BFC7D5;">])</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-empty' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> </span><span style="color: #89DDFF;">-&gt;</span><span style="color: #82AAFF;">middleware</span><span style="color: #BFC7D5;">([</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #C3E88D;">auth</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #BFC7D5;">, </span><span style="color: #D9F5DD;">&#39;</span><span style="color: #C3E88D;">verified</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #BFC7D5;">]);</span></div><details><summary style='cursor: pointer; display: block'><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-start' style='user-select: none; color: #4c5374'></span>&nbsp;<span class='summary-hide-when-open' style='color:#4c5374'>...</span></div></summary><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #C792EA;">require</span><span style="color: #BFC7D5;"> </span><span style="color: #82AAFF;">__DIR__</span><span style="color: #89DDFF;">.</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #C3E88D;">/auth.php</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #BFC7D5;">;</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-end' style='user-select: none; color: #4c5374'></span>&nbsp;</div></details></code></pre> </div> <p>Our route table for this controller now looks like this:</p> <table> <thead> <tr> <th>Verb</th> <th>URI</th> <th>Action</th> <th>Route Name</th> </tr> </thead> <tbody> <tr> <td>GET</td> <td><code>/chirps</code></td> <td>index</td> <td>chirps.index</td> </tr> <tr> <td>POST</td> <td><code>/chirps</code></td> <td>store</td> <td>chirps.store</td> </tr> <tr> <td>PUT/PATCH</td> <td><code>/chirps/{chirp}</code></td> <td>update</td> <td>chirps.update</td> </tr> </tbody> </table> <h2><a id="updating-our-component" href="#updating-our-component" class="heading-permalink" aria-hidden="true" title="Permalink">#</a>Updating our component</h2> <p>Next, let's update our <code>Chirp</code> component to have an edit form for existing Chirps.</p> <p>We're going to use the <code>Dropdown</code> component that comes with Breeze, which we'll only display to the Chirp author. We'll also display an indication if a Chirp has been edited by comparing the Chirp's <code>created_at</code> date with its <code>updated_at</code> date:</p> <div class="tabbed-code" data-group="f86d679141246e9825a8f6c067a5f5a8"> <div class="tabbed-code-nav"> <button class="tabbed-code-nav-button active" data-tab="Vue" onClick="setTab('Vue', 'f86d679141246e9825a8f6c067a5f5a8')">Vue</button> <button class="tabbed-code-nav-button" data-tab="React" onClick="setTab('React', 'f86d679141246e9825a8f6c067a5f5a8')">React</button> </div> <div class="tabbed-code-body"> <div class="code-container active" data-tab="Vue"> <div class="code-container-filename">resources/js/Components/Chirp.vue</div> <pre><code data-theme="olaolu-palenight" data-lang="vue" class='torchlight has-add-lines has-remove-lines has-diff-lines' style='background-color: #292D3E; --theme-selection-background: #7580B850;'><!-- Syntax highlighted by torchlight.dev --><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span style="color: #89DDFF;">&lt;</span><span style="color: #FF5572;">script</span><span style="color: #BFC7D5;"> </span><span style="color: #FFCB6B;">setup</span><span style="color: #89DDFF;">&gt;</span></div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span style="color: #C792EA;">import</span><span style="color: #BFC7D5;"> Dropdown </span><span style="color: #C792EA;">from</span><span style="color: #BFC7D5;"> </span><span style="color: #D9F5DD;">&#39;</span><span style="color: #C3E88D;">@/Components/Dropdown.vue</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #BFC7D5;">;</span></div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span style="color: #C792EA;">import</span><span style="color: #BFC7D5;"> InputError </span><span style="color: #C792EA;">from</span><span style="color: #BFC7D5;"> </span><span style="color: #D9F5DD;">&#39;</span><span style="color: #C3E88D;">@/Components/InputError.vue</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #BFC7D5;">;</span></div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span style="color: #C792EA;">import</span><span style="color: #BFC7D5;"> PrimaryButton </span><span style="color: #C792EA;">from</span><span style="color: #BFC7D5;"> </span><span style="color: #D9F5DD;">&#39;</span><span style="color: #C3E88D;">@/Components/PrimaryButton.vue</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #BFC7D5;">;</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span style="color: #C792EA;">import</span><span style="color: #BFC7D5;"> dayjs </span><span style="color: #C792EA;">from</span><span style="color: #BFC7D5;"> </span><span style="color: #D9F5DD;">&#39;</span><span style="color: #C3E88D;">dayjs</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #BFC7D5;">;</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span style="color: #C792EA;">import</span><span style="color: #BFC7D5;"> relativeTime </span><span style="color: #C792EA;">from</span><span style="color: #BFC7D5;"> </span><span style="color: #D9F5DD;">&#39;</span><span style="color: #C3E88D;">dayjs/plugin/relativeTime</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #BFC7D5;">;</span></div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span style="color: #C792EA;">import</span><span style="color: #BFC7D5;"> { useForm } </span><span style="color: #C792EA;">from</span><span style="color: #BFC7D5;"> </span><span style="color: #D9F5DD;">&#39;</span><span style="color: #C3E88D;">@inertiajs/vue3</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #BFC7D5;">;</span></div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span style="color: #C792EA;">import</span><span style="color: #BFC7D5;"> { ref } </span><span style="color: #C792EA;">from</span><span style="color: #BFC7D5;"> </span><span style="color: #D9F5DD;">&#39;</span><span style="color: #C3E88D;">vue</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #BFC7D5;">;</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span>&nbsp;</div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span style="color: #BFC7D5;">dayjs</span><span style="color: #C792EA;">.</span><span style="color: #82AAFF;">extend</span><span style="color: #BFC7D5;">(relativeTime);</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span>&nbsp;</div><div class='line line-remove line-has-background' style='background-color: #ef535033'><span style="color:#f07178; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">-</span><span style="color: #82AAFF;">defineProps</span><span style="color: #BFC7D5;">([</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #C3E88D;">chirp</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #BFC7D5;">]);</span></div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span style="color: #C792EA;">const</span><span style="color: #BFC7D5;"> </span><span style="color: #82AAFF;">props</span><span style="color: #BFC7D5;"> </span><span style="color: #C792EA;">=</span><span style="color: #BFC7D5;"> </span><span style="color: #82AAFF;">defineProps</span><span style="color: #BFC7D5;">([</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #C3E88D;">chirp</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #BFC7D5;">]);</span></div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span>&nbsp;</div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span style="color: #C792EA;">const</span><span style="color: #BFC7D5;"> </span><span style="color: #82AAFF;">form</span><span style="color: #BFC7D5;"> </span><span style="color: #C792EA;">=</span><span style="color: #BFC7D5;"> </span><span style="color: #82AAFF;">useForm</span><span style="color: #BFC7D5;">({</span></div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span style="color: #BFC7D5;"> message: props</span><span style="color: #C792EA;">.</span><span style="color: #89DDFF;">chirp</span><span style="color: #C792EA;">.</span><span style="color: #89DDFF;">message</span><span style="color: #BFC7D5;">,</span></div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span style="color: #BFC7D5;">});</span></div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span>&nbsp;</div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span style="color: #C792EA;">const</span><span style="color: #BFC7D5;"> </span><span style="color: #82AAFF;">editing</span><span style="color: #BFC7D5;"> </span><span style="color: #C792EA;">=</span><span style="color: #BFC7D5;"> </span><span style="color: #82AAFF;">ref</span><span style="color: #BFC7D5;">(</span><span style="color: #FF5874;">false</span><span style="color: #BFC7D5;">);</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span style="color: #89DDFF;">&lt;/</span><span style="color: #FF5572;">script</span><span style="color: #89DDFF;">&gt;</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span>&nbsp;</div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span style="color: #89DDFF;">&lt;</span><span style="color: #FF5572;">template</span><span style="color: #89DDFF;">&gt;</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span style="color: #BFC7D5;"> </span><span style="color: #89DDFF;">&lt;</span><span style="color: #FF5572;">div</span><span style="color: #89DDFF;"> </span><span style="color: #FFCB6B;">class</span><span style="color: #89DDFF;">=</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #C3E88D;">p-6 flex space-x-2</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #89DDFF;">&gt;</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span style="color: #BFC7D5;"> </span><span style="color: #89DDFF;">&lt;</span><span style="color: #FF5572;">svg</span><span style="color: #89DDFF;"> </span><span style="color: #FFCB6B;">xmlns</span><span style="color: #89DDFF;">=</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #C3E88D;">http://www.w3.org/2000/svg</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #89DDFF;"> </span><span style="color: #FFCB6B;">class</span><span style="color: #89DDFF;">=</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #C3E88D;">h-6 w-6 text-gray-600 -scale-x-100</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #89DDFF;"> </span><span style="color: #FFCB6B;">fill</span><span style="color: #89DDFF;">=</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #C3E88D;">none</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #89DDFF;"> </span><span style="color: #FFCB6B;">viewBox</span><span style="color: #89DDFF;">=</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #C3E88D;">0 0 24 24</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #89DDFF;"> </span><span style="color: #FFCB6B;">stroke</span><span style="color: #89DDFF;">=</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #C3E88D;">currentColor</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #89DDFF;"> </span><span style="color: #FFCB6B;">stroke-width</span><span style="color: #89DDFF;">=</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #C3E88D;">2</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #89DDFF;">&gt;</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span style="color: #BFC7D5;"> </span><span style="color: #89DDFF;">&lt;</span><span style="color: #FF5572;">path</span><span style="color: #89DDFF;"> </span><span style="color: #FFCB6B;">stroke-linecap</span><span style="color: #89DDFF;">=</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #C3E88D;">round</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #89DDFF;"> </span><span style="color: #FFCB6B;">stroke-linejoin</span><span style="color: #89DDFF;">=</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #C3E88D;">round</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #89DDFF;"> </span><span style="color: #FFCB6B;">d</span><span style="color: #89DDFF;">=</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #C3E88D;">M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #89DDFF;"> /&gt;</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span style="color: #BFC7D5;"> </span><span style="color: #89DDFF;">&lt;/</span><span style="color: #FF5572;">svg</span><span style="color: #89DDFF;">&gt;</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span style="color: #BFC7D5;"> </span><span style="color: #89DDFF;">&lt;</span><span style="color: #FF5572;">div</span><span style="color: #89DDFF;"> </span><span style="color: #FFCB6B;">class</span><span style="color: #89DDFF;">=</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #C3E88D;">flex-1</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #89DDFF;">&gt;</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span style="color: #BFC7D5;"> </span><span style="color: #89DDFF;">&lt;</span><span style="color: #FF5572;">div</span><span style="color: #89DDFF;"> </span><span style="color: #FFCB6B;">class</span><span style="color: #89DDFF;">=</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #C3E88D;">flex justify-between items-center</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #89DDFF;">&gt;</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span style="color: #BFC7D5;"> </span><span style="color: #89DDFF;">&lt;</span><span style="color: #FF5572;">div</span><span style="color: #89DDFF;">&gt;</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span style="color: #BFC7D5;"> </span><span style="color: #89DDFF;">&lt;</span><span style="color: #FF5572;">span</span><span style="color: #89DDFF;"> </span><span style="color: #FFCB6B;">class</span><span style="color: #89DDFF;">=</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #C3E88D;">text-gray-800</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #89DDFF;">&gt;</span><span style="color: #BFC7D5;">{{ chirp</span><span style="color: #C792EA;">.</span><span style="color: #89DDFF;">user</span><span style="color: #C792EA;">.</span><span style="color: #89DDFF;">name</span><span style="color: #BFC7D5;"> }}</span><span style="color: #89DDFF;">&lt;/</span><span style="color: #FF5572;">span</span><span style="color: #89DDFF;">&gt;</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span style="color: #BFC7D5;"> </span><span style="color: #89DDFF;">&lt;</span><span style="color: #FF5572;">small</span><span style="color: #89DDFF;"> </span><span style="color: #FFCB6B;">class</span><span style="color: #89DDFF;">=</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #C3E88D;">ml-2 text-sm text-gray-600</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #89DDFF;">&gt;</span><span style="color: #BFC7D5;">{{ </span><span style="color: #82AAFF;">dayjs</span><span style="color: #BFC7D5;">(chirp</span><span style="color: #C792EA;">.</span><span style="color: #89DDFF;">created_at</span><span style="color: #BFC7D5;">)</span><span style="color: #C792EA;">.</span><span style="color: #82AAFF;">fromNow</span><span style="color: #BFC7D5;">() }}</span><span style="color: #89DDFF;">&lt;/</span><span style="color: #FF5572;">small</span><span style="color: #89DDFF;">&gt;</span></div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span style="color: #BFC7D5;"> </span><span style="color: #89DDFF;">&lt;</span><span style="color: #FF5572;">small</span><span style="color: #89DDFF;"> </span><span style="color: #FFCB6B;">v-if</span><span style="color: #89DDFF;">=</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #BFC7D5;">chirp</span><span style="color: #C792EA;">.</span><span style="color: #89DDFF;">created_at </span><span style="color: #C792EA;">!==</span><span style="color: #89DDFF;"> </span><span style="color: #BFC7D5;">chirp</span><span style="color: #C792EA;">.</span><span style="color: #89DDFF;">updated_at</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #89DDFF;"> </span><span style="color: #FFCB6B;">class</span><span style="color: #89DDFF;">=</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #C3E88D;">text-sm text-gray-600</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #89DDFF;">&gt;</span><span style="color: #BFC7D5;"> </span><span style="color: #82AAFF;">&amp;middot;</span><span style="color: #BFC7D5;"> edited</span><span style="color: #89DDFF;">&lt;/</span><span style="color: #FF5572;">small</span><span style="color: #89DDFF;">&gt;</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span style="color: #BFC7D5;"> </span><span style="color: #89DDFF;">&lt;/</span><span style="color: #FF5572;">div</span><span style="color: #89DDFF;">&gt;</span></div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span style="color: #BFC7D5;"> </span><span style="color: #89DDFF;">&lt;</span><span style="color: #FFCB6B;">Dropdown</span><span style="color: #89DDFF;"> </span><span style="color: #FFCB6B;">v-if</span><span style="color: #89DDFF;">=</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #BFC7D5;">chirp</span><span style="color: #C792EA;">.</span><span style="color: #89DDFF;">user</span><span style="color: #C792EA;">.</span><span style="color: #89DDFF;">id </span><span style="color: #C792EA;">===</span><span style="color: #89DDFF;"> </span><span style="color: #BFC7D5;">$page</span><span style="color: #C792EA;">.</span><span style="color: #89DDFF;">props</span><span style="color: #C792EA;">.</span><span style="color: #89DDFF;">auth</span><span style="color: #C792EA;">.</span><span style="color: #89DDFF;">user</span><span style="color: #C792EA;">.</span><span style="color: #89DDFF;">id</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #89DDFF;">&gt;</span></div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span style="color: #BFC7D5;"> </span><span style="color: #89DDFF;">&lt;</span><span style="color: #FF5572;">template</span><span style="color: #89DDFF;"> #</span><span style="color: #FFCB6B;">trigger</span><span style="color: #89DDFF;">&gt;</span></div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span style="color: #BFC7D5;"> </span><span style="color: #89DDFF;">&lt;</span><span style="color: #FF5572;">button</span><span style="color: #89DDFF;">&gt;</span></div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span style="color: #BFC7D5;"> </span><span style="color: #89DDFF;">&lt;</span><span style="color: #FF5572;">svg</span><span style="color: #89DDFF;"> </span><span style="color: #FFCB6B;">xmlns</span><span style="color: #89DDFF;">=</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #C3E88D;">http://www.w3.org/2000/svg</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #89DDFF;"> </span><span style="color: #FFCB6B;">class</span><span style="color: #89DDFF;">=</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #C3E88D;">h-4 w-4 text-gray-400</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #89DDFF;"> </span><span style="color: #FFCB6B;">viewBox</span><span style="color: #89DDFF;">=</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #C3E88D;">0 0 20 20</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #89DDFF;"> </span><span style="color: #FFCB6B;">fill</span><span style="color: #89DDFF;">=</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #C3E88D;">currentColor</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #89DDFF;">&gt;</span></div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span style="color: #BFC7D5;"> </span><span style="color: #89DDFF;">&lt;</span><span style="color: #FF5572;">path</span><span style="color: #89DDFF;"> </span><span style="color: #FFCB6B;">d</span><span style="color: #89DDFF;">=</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #C3E88D;">M6 10a2 2 0 11-4 0 2 2 0 014 0zM12 10a2 2 0 11-4 0 2 2 0 014 0zM16 12a2 2 0 100-4 2 2 0 000 4z</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #89DDFF;"> /&gt;</span></div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span style="color: #BFC7D5;"> </span><span style="color: #89DDFF;">&lt;/</span><span style="color: #FF5572;">svg</span><span style="color: #89DDFF;">&gt;</span></div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span style="color: #BFC7D5;"> </span><span style="color: #89DDFF;">&lt;/</span><span style="color: #FF5572;">button</span><span style="color: #89DDFF;">&gt;</span></div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span style="color: #BFC7D5;"> </span><span style="color: #89DDFF;">&lt;/</span><span style="color: #FF5572;">template</span><span style="color: #89DDFF;">&gt;</span></div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span style="color: #BFC7D5;"> </span><span style="color: #89DDFF;">&lt;</span><span style="color: #FF5572;">template</span><span style="color: #89DDFF;"> #</span><span style="color: #FFCB6B;">content</span><span style="color: #89DDFF;">&gt;</span></div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span style="color: #BFC7D5;"> </span><span style="color: #89DDFF;">&lt;</span><span style="color: #FF5572;">button</span><span style="color: #89DDFF;"> </span><span style="color: #FFCB6B;">class</span><span style="color: #89DDFF;">=</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #C3E88D;">block w-full px-4 py-2 text-left text-sm leading-5 text-gray-700 hover:bg-gray-100 focus:bg-gray-100 transition duration-150 ease-in-out</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #89DDFF;"> @</span><span style="color: #FFCB6B;">click</span><span style="color: #89DDFF;">=</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #BFC7D5;">editing</span><span style="color: #89DDFF;"> </span><span style="color: #C792EA;">=</span><span style="color: #89DDFF;"> </span><span style="color: #FF5874;">true</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #89DDFF;">&gt;</span></div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span style="color: #BFC7D5;"> Edit</span></div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span style="color: #BFC7D5;"> </span><span style="color: #89DDFF;">&lt;/</span><span style="color: #FF5572;">button</span><span style="color: #89DDFF;">&gt;</span></div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span style="color: #BFC7D5;"> </span><span style="color: #89DDFF;">&lt;/</span><span style="color: #FF5572;">template</span><span style="color: #89DDFF;">&gt;</span></div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span style="color: #BFC7D5;"> </span><span style="color: #89DDFF;">&lt;/</span><span style="color: #FFCB6B;">Dropdown</span><span style="color: #89DDFF;">&gt;</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span style="color: #BFC7D5;"> </span><span style="color: #89DDFF;">&lt;/</span><span style="color: #FF5572;">div</span><span style="color: #89DDFF;">&gt;</span></div><div class='line line-remove line-has-background' style='background-color: #ef535033'><span style="color:#f07178; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">-</span><span style="color: #BFC7D5;"> </span><span style="color: #89DDFF;">&lt;</span><span style="color: #FF5572;">p</span><span style="color: #89DDFF;"> </span><span style="color: #FFCB6B;">class</span><span style="color: #89DDFF;">=</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #C3E88D;">mt-4 text-lg text-gray-900</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #89DDFF;">&gt;</span><span style="color: #BFC7D5;">{{ chirp</span><span style="color: #C792EA;">.</span><span style="color: #89DDFF;">message</span><span style="color: #BFC7D5;"> }}</span><span style="color: #89DDFF;">&lt;/</span><span style="color: #FF5572;">p</span><span style="color: #89DDFF;">&gt;</span></div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span style="color: #BFC7D5;"> </span><span style="color: #89DDFF;">&lt;</span><span style="color: #FF5572;">form</span><span style="color: #89DDFF;"> </span><span style="color: #FFCB6B;">v-if</span><span style="color: #89DDFF;">=</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #BFC7D5;">editing</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #89DDFF;"> @</span><span style="color: #FFCB6B;">submit</span><span style="color: #89DDFF;">.</span><span style="color: #FFCB6B;">prevent</span><span style="color: #89DDFF;">=</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #BFC7D5;">form</span><span style="color: #C792EA;">.</span><span style="color: #82AAFF;">put</span><span style="color: #BFC7D5;">(</span><span style="color: #82AAFF;">route</span><span style="color: #BFC7D5;">(</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #C3E88D;">chirps.update</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #89DDFF;">, </span><span style="color: #BFC7D5;">chirp</span><span style="color: #C792EA;">.</span><span style="color: #89DDFF;">id</span><span style="color: #BFC7D5;">)</span><span style="color: #89DDFF;">, { </span><span style="color: #82AAFF;">onSuccess</span><span style="color: #BFC7D5;">:</span><span style="color: #89DDFF;"> </span><span style="color: #D9F5DD;">()</span><span style="color: #89DDFF;"> </span><span style="color: #C792EA;">=&gt;</span><span style="color: #89DDFF;"> </span><span style="color: #BFC7D5;">editing</span><span style="color: #89DDFF;"> </span><span style="color: #C792EA;">=</span><span style="color: #89DDFF;"> </span><span style="color: #FF5874;">false</span><span style="color: #89DDFF;"> }</span><span style="color: #BFC7D5;">)</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #89DDFF;">&gt;</span></div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span style="color: #BFC7D5;"> </span><span style="color: #89DDFF;">&lt;</span><span style="color: #FF5572;">textarea</span><span style="color: #89DDFF;"> </span><span style="color: #FFCB6B;">v-model</span><span style="color: #89DDFF;">=</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #BFC7D5;">form</span><span style="color: #C792EA;">.</span><span style="color: #89DDFF;">message</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #89DDFF;"> </span><span style="color: #FFCB6B;">class</span><span style="color: #89DDFF;">=</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #C3E88D;">mt-4 w-full text-gray-900 border-gray-300 focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50 rounded-md shadow-sm</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #89DDFF;">&gt;&lt;/</span><span style="color: #FF5572;">textarea</span><span style="color: #89DDFF;">&gt;</span></div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span style="color: #BFC7D5;"> </span><span style="color: #89DDFF;">&lt;</span><span style="color: #FFCB6B;">InputError</span><span style="color: #89DDFF;"> :</span><span style="color: #FFCB6B;">message</span><span style="color: #89DDFF;">=</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #BFC7D5;">form</span><span style="color: #C792EA;">.</span><span style="color: #89DDFF;">errors</span><span style="color: #C792EA;">.</span><span style="color: #89DDFF;">message</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #89DDFF;"> </span><span style="color: #FFCB6B;">class</span><span style="color: #89DDFF;">=</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #C3E88D;">mt-2</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #89DDFF;"> /&gt;</span></div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span style="color: #BFC7D5;"> </span><span style="color: #89DDFF;">&lt;</span><span style="color: #FF5572;">div</span><span style="color: #89DDFF;"> </span><span style="color: #FFCB6B;">class</span><span style="color: #89DDFF;">=</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #C3E88D;">space-x-2</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #89DDFF;">&gt;</span></div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span style="color: #BFC7D5;"> </span><span style="color: #89DDFF;">&lt;</span><span style="color: #FFCB6B;">PrimaryButton</span><span style="color: #89DDFF;"> </span><span style="color: #FFCB6B;">class</span><span style="color: #89DDFF;">=</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #C3E88D;">mt-4</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #89DDFF;">&gt;</span><span style="color: #BFC7D5;">Save</span><span style="color: #89DDFF;">&lt;/</span><span style="color: #FFCB6B;">PrimaryButton</span><span style="color: #89DDFF;">&gt;</span></div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span style="color: #BFC7D5;"> </span><span style="color: #89DDFF;">&lt;</span><span style="color: #FF5572;">button</span><span style="color: #89DDFF;"> </span><span style="color: #FFCB6B;">class</span><span style="color: #89DDFF;">=</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #C3E88D;">mt-4</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #89DDFF;"> @</span><span style="color: #FFCB6B;">click</span><span style="color: #89DDFF;">=</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #BFC7D5;">editing</span><span style="color: #89DDFF;"> </span><span style="color: #C792EA;">=</span><span style="color: #89DDFF;"> </span><span style="color: #FF5874;">false</span><span style="color: #89DDFF;">; </span><span style="color: #BFC7D5;">form</span><span style="color: #C792EA;">.</span><span style="color: #82AAFF;">reset</span><span style="color: #BFC7D5;">()</span><span style="color: #89DDFF;">; </span><span style="color: #BFC7D5;">form</span><span style="color: #C792EA;">.</span><span style="color: #82AAFF;">clearErrors</span><span style="color: #BFC7D5;">()</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #89DDFF;">&gt;</span><span style="color: #BFC7D5;">Cancel</span><span style="color: #89DDFF;">&lt;/</span><span style="color: #FF5572;">button</span><span style="color: #89DDFF;">&gt;</span></div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span style="color: #BFC7D5;"> </span><span style="color: #89DDFF;">&lt;/</span><span style="color: #FF5572;">div</span><span style="color: #89DDFF;">&gt;</span></div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span style="color: #BFC7D5;"> </span><span style="color: #89DDFF;">&lt;/</span><span style="color: #FF5572;">form</span><span style="color: #89DDFF;">&gt;</span></div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span style="color: #BFC7D5;"> </span><span style="color: #89DDFF;">&lt;</span><span style="color: #FF5572;">p</span><span style="color: #89DDFF;"> </span><span style="color: #FFCB6B;">v-else</span><span style="color: #89DDFF;"> </span><span style="color: #FFCB6B;">class</span><span style="color: #89DDFF;">=</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #C3E88D;">mt-4 text-lg text-gray-900</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #89DDFF;">&gt;</span><span style="color: #BFC7D5;">{{ chirp</span><span style="color: #C792EA;">.</span><span style="color: #89DDFF;">message</span><span style="color: #BFC7D5;"> }}</span><span style="color: #89DDFF;">&lt;/</span><span style="color: #FF5572;">p</span><span style="color: #89DDFF;">&gt;</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span style="color: #BFC7D5;"> </span><span style="color: #89DDFF;">&lt;/</span><span style="color: #FF5572;">div</span><span style="color: #89DDFF;">&gt;</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span style="color: #BFC7D5;"> </span><span style="color: #89DDFF;">&lt;/</span><span style="color: #FF5572;">div</span><span style="color: #89DDFF;">&gt;</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span style="color: #89DDFF;">&lt;/</span><span style="color: #FF5572;">template</span><span style="color: #89DDFF;">&gt;</span></div></code></pre> </div> <div class="code-container" data-tab="React"> <div class="code-container-filename">resources/js/Components/Chirp.jsx</div> <pre><code data-theme="olaolu-palenight" data-lang="javascript" class='torchlight has-add-lines has-remove-lines has-diff-lines' style='background-color: #292D3E; --theme-selection-background: #7580B850;'><!-- Syntax highlighted by torchlight.dev --><div class='line line-remove line-has-background' style='background-color: #ef535033'><span style="color:#f07178; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">-</span><span style="color: #C792EA;">import</span><span style="color: #BFC7D5;"> React </span><span style="color: #C792EA;">from</span><span style="color: #BFC7D5;"> </span><span style="color: #D9F5DD;">&#39;</span><span style="color: #C3E88D;">react</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #BFC7D5;">;</span></div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span style="color: #C792EA;">import</span><span style="color: #BFC7D5;"> React, { useState } </span><span style="color: #C792EA;">from</span><span style="color: #BFC7D5;"> </span><span style="color: #D9F5DD;">&#39;</span><span style="color: #C3E88D;">react</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #BFC7D5;">;</span></div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span style="color: #C792EA;">import</span><span style="color: #BFC7D5;"> Dropdown </span><span style="color: #C792EA;">from</span><span style="color: #BFC7D5;"> </span><span style="color: #D9F5DD;">&#39;</span><span style="color: #C3E88D;">@/Components/Dropdown</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #BFC7D5;">;</span></div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span style="color: #C792EA;">import</span><span style="color: #BFC7D5;"> InputError </span><span style="color: #C792EA;">from</span><span style="color: #BFC7D5;"> </span><span style="color: #D9F5DD;">&#39;</span><span style="color: #C3E88D;">@/Components/InputError</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #BFC7D5;">;</span></div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span style="color: #C792EA;">import</span><span style="color: #BFC7D5;"> PrimaryButton </span><span style="color: #C792EA;">from</span><span style="color: #BFC7D5;"> </span><span style="color: #D9F5DD;">&#39;</span><span style="color: #C3E88D;">@/Components/PrimaryButton</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #BFC7D5;">;</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span style="color: #C792EA;">import</span><span style="color: #BFC7D5;"> dayjs </span><span style="color: #C792EA;">from</span><span style="color: #BFC7D5;"> </span><span style="color: #D9F5DD;">&#39;</span><span style="color: #C3E88D;">dayjs</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #BFC7D5;">;</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span style="color: #C792EA;">import</span><span style="color: #BFC7D5;"> relativeTime </span><span style="color: #C792EA;">from</span><span style="color: #BFC7D5;"> </span><span style="color: #D9F5DD;">&#39;</span><span style="color: #C3E88D;">dayjs/plugin/relativeTime</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #BFC7D5;">;</span></div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span style="color: #C792EA;">import</span><span style="color: #BFC7D5;"> { useForm, usePage } </span><span style="color: #C792EA;">from</span><span style="color: #BFC7D5;"> </span><span style="color: #D9F5DD;">&#39;</span><span style="color: #C3E88D;">@inertiajs/react</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #BFC7D5;">;</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span>&nbsp;</div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span style="color: #BFC7D5;">dayjs</span><span style="color: #C792EA;">.</span><span style="color: #82AAFF;">extend</span><span style="color: #BFC7D5;">(relativeTime);</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span>&nbsp;</div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span style="color: #C792EA;">export</span><span style="color: #BFC7D5;"> </span><span style="color: #C792EA;">default</span><span style="color: #BFC7D5;"> </span><span style="color: #C792EA;">function</span><span style="color: #BFC7D5;"> </span><span style="color: #82AAFF;">Chirp</span><span style="color: #D9F5DD;">(</span><span style="color: #BFC7D5;">{ </span><span style="color: #7986E7;">chirp</span><span style="color: #BFC7D5;"> }</span><span style="color: #D9F5DD;">)</span><span style="color: #BFC7D5;"> {</span></div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span style="color: #BFC7D5;"> </span><span style="color: #C792EA;">const</span><span style="color: #BFC7D5;"> { </span><span style="color: #82AAFF;">auth</span><span style="color: #BFC7D5;"> } </span><span style="color: #C792EA;">=</span><span style="color: #BFC7D5;"> </span><span style="color: #82AAFF;">usePage</span><span style="color: #BFC7D5;">()</span><span style="color: #C792EA;">.</span><span style="color: #89DDFF;">props</span><span style="color: #BFC7D5;">;</span></div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span>&nbsp;</div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span style="color: #BFC7D5;"> </span><span style="color: #C792EA;">const</span><span style="color: #BFC7D5;"> [</span><span style="color: #82AAFF;">editing</span><span style="color: #EEFFFF;">,</span><span style="color: #BFC7D5;"> </span><span style="color: #82AAFF;">setEditing</span><span style="color: #BFC7D5;">] </span><span style="color: #C792EA;">=</span><span style="color: #BFC7D5;"> </span><span style="color: #82AAFF;">useState</span><span style="color: #BFC7D5;">(</span><span style="color: #FF5874;">false</span><span style="color: #BFC7D5;">);</span></div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span>&nbsp;</div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span style="color: #BFC7D5;"> </span><span style="color: #C792EA;">const</span><span style="color: #BFC7D5;"> { </span><span style="color: #82AAFF;">data</span><span style="color: #EEFFFF;">,</span><span style="color: #BFC7D5;"> </span><span style="color: #82AAFF;">setData</span><span style="color: #EEFFFF;">,</span><span style="color: #BFC7D5;"> </span><span style="color: #82AAFF;">patch</span><span style="color: #EEFFFF;">,</span><span style="color: #BFC7D5;"> </span><span style="color: #82AAFF;">clearErrors</span><span style="color: #EEFFFF;">,</span><span style="color: #BFC7D5;"> </span><span style="color: #82AAFF;">reset</span><span style="color: #EEFFFF;">,</span><span style="color: #BFC7D5;"> </span><span style="color: #82AAFF;">errors</span><span style="color: #BFC7D5;"> } </span><span style="color: #C792EA;">=</span><span style="color: #BFC7D5;"> </span><span style="color: #82AAFF;">useForm</span><span style="color: #BFC7D5;">({</span></div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span style="color: #BFC7D5;"> message: chirp</span><span style="color: #C792EA;">.</span><span style="color: #89DDFF;">message</span><span style="color: #EEFFFF;">,</span></div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span style="color: #BFC7D5;"> });</span></div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span>&nbsp;</div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span style="color: #BFC7D5;"> </span><span style="color: #C792EA;">const</span><span style="color: #BFC7D5;"> </span><span style="color: #82AAFF;">submit</span><span style="color: #BFC7D5;"> </span><span style="color: #C792EA;">=</span><span style="color: #BFC7D5;"> </span><span style="color: #D9F5DD;">(</span><span style="color: #7986E7;">e</span><span style="color: #D9F5DD;">)</span><span style="color: #BFC7D5;"> </span><span style="color: #C792EA;">=&gt;</span><span style="color: #BFC7D5;"> {</span></div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span style="color: #BFC7D5;"> e</span><span style="color: #C792EA;">.</span><span style="color: #82AAFF;">preventDefault</span><span style="color: #BFC7D5;">();</span></div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span style="color: #BFC7D5;"> </span><span style="color: #82AAFF;">patch</span><span style="color: #BFC7D5;">(</span><span style="color: #82AAFF;">route</span><span style="color: #BFC7D5;">(</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #C3E88D;">chirps.update</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #EEFFFF;">,</span><span style="color: #BFC7D5;"> chirp</span><span style="color: #C792EA;">.</span><span style="color: #89DDFF;">id</span><span style="color: #BFC7D5;">)</span><span style="color: #EEFFFF;">,</span><span style="color: #BFC7D5;"> { </span><span style="color: #82AAFF;">onSuccess</span><span style="color: #BFC7D5;">: </span><span style="color: #D9F5DD;">()</span><span style="color: #BFC7D5;"> </span><span style="color: #C792EA;">=&gt;</span><span style="color: #BFC7D5;"> </span><span style="color: #82AAFF;">setEditing</span><span style="color: #BFC7D5;">(</span><span style="color: #FF5874;">false</span><span style="color: #BFC7D5;">) });</span></div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span style="color: #BFC7D5;"> };</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span>&nbsp;</div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span style="color: #BFC7D5;"> </span><span style="color: #C792EA;">return</span><span style="color: #BFC7D5;"> (</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span style="color: #BFC7D5;"> </span><span style="color: #89DDFF;">&lt;</span><span style="color: #FF5572;">div</span><span style="color: #89DDFF;"> </span><span style="color: #FFCB6B;">className</span><span style="color: #C792EA;">=</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #C3E88D;">p-6 flex space-x-2</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #89DDFF;">&gt;</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span style="color: #BFC7D5;"> </span><span style="color: #89DDFF;">&lt;</span><span style="color: #FF5572;">svg</span><span style="color: #89DDFF;"> </span><span style="color: #FFCB6B;">xmlns</span><span style="color: #C792EA;">=</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #C3E88D;">http://www.w3.org/2000/svg</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #89DDFF;"> </span><span style="color: #FFCB6B;">className</span><span style="color: #C792EA;">=</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #C3E88D;">h-6 w-6 text-gray-600 -scale-x-100</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #89DDFF;"> </span><span style="color: #FFCB6B;">fill</span><span style="color: #C792EA;">=</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #C3E88D;">none</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #89DDFF;"> </span><span style="color: #FFCB6B;">viewBox</span><span style="color: #C792EA;">=</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #C3E88D;">0 0 24 24</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #89DDFF;"> </span><span style="color: #FFCB6B;">stroke</span><span style="color: #C792EA;">=</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #C3E88D;">currentColor</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #89DDFF;"> </span><span style="color: #FFCB6B;">strokeWidth</span><span style="color: #C792EA;">=</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #C3E88D;">2</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #89DDFF;">&gt;</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span style="color: #BFC7D5;"> </span><span style="color: #89DDFF;">&lt;</span><span style="color: #FF5572;">path</span><span style="color: #89DDFF;"> </span><span style="color: #FFCB6B;">strokeLinecap</span><span style="color: #C792EA;">=</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #C3E88D;">round</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #89DDFF;"> </span><span style="color: #FFCB6B;">strokeLinejoin</span><span style="color: #C792EA;">=</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #C3E88D;">round</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #89DDFF;"> </span><span style="color: #FFCB6B;">d</span><span style="color: #C792EA;">=</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #C3E88D;">M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #89DDFF;"> /&gt;</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span style="color: #BFC7D5;"> </span><span style="color: #89DDFF;">&lt;/</span><span style="color: #FF5572;">svg</span><span style="color: #89DDFF;">&gt;</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span style="color: #BFC7D5;"> </span><span style="color: #89DDFF;">&lt;</span><span style="color: #FF5572;">div</span><span style="color: #89DDFF;"> </span><span style="color: #FFCB6B;">className</span><span style="color: #C792EA;">=</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #C3E88D;">flex-1</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #89DDFF;">&gt;</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span style="color: #BFC7D5;"> </span><span style="color: #89DDFF;">&lt;</span><span style="color: #FF5572;">div</span><span style="color: #89DDFF;"> </span><span style="color: #FFCB6B;">className</span><span style="color: #C792EA;">=</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #C3E88D;">flex justify-between items-center</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #89DDFF;">&gt;</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span style="color: #BFC7D5;"> </span><span style="color: #89DDFF;">&lt;</span><span style="color: #FF5572;">div</span><span style="color: #89DDFF;">&gt;</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span style="color: #BFC7D5;"> </span><span style="color: #89DDFF;">&lt;</span><span style="color: #FF5572;">span</span><span style="color: #89DDFF;"> </span><span style="color: #FFCB6B;">className</span><span style="color: #C792EA;">=</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #C3E88D;">text-gray-800</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #89DDFF;">&gt;</span><span style="color: #D3423E;">{</span><span style="color: #BFC7D5;">chirp</span><span style="color: #C792EA;">.</span><span style="color: #89DDFF;">user</span><span style="color: #C792EA;">.</span><span style="color: #89DDFF;">name</span><span style="color: #D3423E;">}</span><span style="color: #89DDFF;">&lt;/</span><span style="color: #FF5572;">span</span><span style="color: #89DDFF;">&gt;</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span style="color: #BFC7D5;"> </span><span style="color: #89DDFF;">&lt;</span><span style="color: #FF5572;">small</span><span style="color: #89DDFF;"> </span><span style="color: #FFCB6B;">className</span><span style="color: #C792EA;">=</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #C3E88D;">ml-2 text-sm text-gray-600</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #89DDFF;">&gt;</span><span style="color: #D3423E;">{</span><span style="color: #82AAFF;">dayjs</span><span style="color: #BFC7D5;">(chirp</span><span style="color: #C792EA;">.</span><span style="color: #89DDFF;">created_at</span><span style="color: #BFC7D5;">)</span><span style="color: #C792EA;">.</span><span style="color: #82AAFF;">fromNow</span><span style="color: #BFC7D5;">()</span><span style="color: #D3423E;">}</span><span style="color: #89DDFF;">&lt;/</span><span style="color: #FF5572;">small</span><span style="color: #89DDFF;">&gt;</span></div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span style="color: #BFC7D5;"> </span><span style="color: #D3423E;">{</span><span style="color: #BFC7D5;"> chirp</span><span style="color: #C792EA;">.</span><span style="color: #89DDFF;">created_at</span><span style="color: #BFC7D5;"> </span><span style="color: #C792EA;">!==</span><span style="color: #BFC7D5;"> chirp</span><span style="color: #C792EA;">.</span><span style="color: #89DDFF;">updated_at</span><span style="color: #BFC7D5;"> </span><span style="color: #C792EA;">&amp;&amp;</span><span style="color: #BFC7D5;"> </span><span style="color: #89DDFF;">&lt;</span><span style="color: #FF5572;">small</span><span style="color: #89DDFF;"> </span><span style="color: #FFCB6B;">className</span><span style="color: #C792EA;">=</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #C3E88D;">text-sm text-gray-600</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #89DDFF;">&gt;</span><span style="color: #BFC7D5;"> </span><span style="color: #82AAFF;">&amp;middot;</span><span style="color: #BFC7D5;"> edited</span><span style="color: #89DDFF;">&lt;/</span><span style="color: #FF5572;">small</span><span style="color: #89DDFF;">&gt;</span><span style="color: #D3423E;">}</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span style="color: #BFC7D5;"> </span><span style="color: #89DDFF;">&lt;/</span><span style="color: #FF5572;">div</span><span style="color: #89DDFF;">&gt;</span></div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span style="color: #BFC7D5;"> </span><span style="color: #D3423E;">{</span><span style="color: #BFC7D5;">chirp</span><span style="color: #C792EA;">.</span><span style="color: #89DDFF;">user</span><span style="color: #C792EA;">.</span><span style="color: #89DDFF;">id</span><span style="color: #BFC7D5;"> </span><span style="color: #C792EA;">===</span><span style="color: #BFC7D5;"> auth</span><span style="color: #C792EA;">.</span><span style="color: #89DDFF;">user</span><span style="color: #C792EA;">.</span><span style="color: #89DDFF;">id</span><span style="color: #BFC7D5;"> </span><span style="color: #C792EA;">&amp;&amp;</span></div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span style="color: #BFC7D5;"> </span><span style="color: #89DDFF;">&lt;</span><span style="color: #FF5572;">Dropdown</span><span style="color: #89DDFF;">&gt;</span></div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span style="color: #BFC7D5;"> </span><span style="color: #89DDFF;">&lt;</span><span style="color: #FF5572;">Dropdown.Trigger</span><span style="color: #89DDFF;">&gt;</span></div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span style="color: #BFC7D5;"> </span><span style="color: #89DDFF;">&lt;</span><span style="color: #FF5572;">button</span><span style="color: #89DDFF;">&gt;</span></div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span style="color: #BFC7D5;"> </span><span style="color: #89DDFF;">&lt;</span><span style="color: #FF5572;">svg</span><span style="color: #89DDFF;"> </span><span style="color: #FFCB6B;">xmlns</span><span style="color: #C792EA;">=</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #C3E88D;">http://www.w3.org/2000/svg</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #89DDFF;"> </span><span style="color: #FFCB6B;">className</span><span style="color: #C792EA;">=</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #C3E88D;">h-4 w-4 text-gray-400</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #89DDFF;"> </span><span style="color: #FFCB6B;">viewBox</span><span style="color: #C792EA;">=</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #C3E88D;">0 0 20 20</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #89DDFF;"> </span><span style="color: #FFCB6B;">fill</span><span style="color: #C792EA;">=</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #C3E88D;">currentColor</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #89DDFF;">&gt;</span></div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span style="color: #BFC7D5;"> </span><span style="color: #89DDFF;">&lt;</span><span style="color: #FF5572;">path</span><span style="color: #89DDFF;"> </span><span style="color: #FFCB6B;">d</span><span style="color: #C792EA;">=</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #C3E88D;">M6 10a2 2 0 11-4 0 2 2 0 014 0zM12 10a2 2 0 11-4 0 2 2 0 014 0zM16 12a2 2 0 100-4 2 2 0 000 4z</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #89DDFF;"> /&gt;</span></div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span style="color: #BFC7D5;"> </span><span style="color: #89DDFF;">&lt;/</span><span style="color: #FF5572;">svg</span><span style="color: #89DDFF;">&gt;</span></div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span style="color: #BFC7D5;"> </span><span style="color: #89DDFF;">&lt;/</span><span style="color: #FF5572;">button</span><span style="color: #89DDFF;">&gt;</span></div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span style="color: #BFC7D5;"> </span><span style="color: #89DDFF;">&lt;/</span><span style="color: #FF5572;">Dropdown.Trigger</span><span style="color: #89DDFF;">&gt;</span></div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span style="color: #BFC7D5;"> </span><span style="color: #89DDFF;">&lt;</span><span style="color: #FF5572;">Dropdown.Content</span><span style="color: #89DDFF;">&gt;</span></div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span style="color: #BFC7D5;"> </span><span style="color: #89DDFF;">&lt;</span><span style="color: #FF5572;">button</span><span style="color: #89DDFF;"> </span><span style="color: #FFCB6B;">className</span><span style="color: #C792EA;">=</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #C3E88D;">block w-full px-4 py-2 text-left text-sm leading-5 text-gray-700 hover:bg-gray-100 focus:bg-gray-100 transition duration-150 ease-in-out</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #89DDFF;"> </span><span style="color: #FFCB6B;">onClick</span><span style="color: #C792EA;">=</span><span style="color: #D3423E;">{</span><span style="color: #D9F5DD;">()</span><span style="color: #89DDFF;"> </span><span style="color: #C792EA;">=&gt;</span><span style="color: #89DDFF;"> </span><span style="color: #82AAFF;">setEditing</span><span style="color: #BFC7D5;">(</span><span style="color: #FF5874;">true</span><span style="color: #BFC7D5;">)</span><span style="color: #D3423E;">}</span><span style="color: #89DDFF;">&gt;</span></div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span style="color: #BFC7D5;"> Edit</span></div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span style="color: #BFC7D5;"> </span><span style="color: #89DDFF;">&lt;/</span><span style="color: #FF5572;">button</span><span style="color: #89DDFF;">&gt;</span></div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span style="color: #BFC7D5;"> </span><span style="color: #89DDFF;">&lt;/</span><span style="color: #FF5572;">Dropdown.Content</span><span style="color: #89DDFF;">&gt;</span></div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span style="color: #BFC7D5;"> </span><span style="color: #89DDFF;">&lt;/</span><span style="color: #FF5572;">Dropdown</span><span style="color: #89DDFF;">&gt;</span></div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span style="color: #BFC7D5;"> </span><span style="color: #D3423E;">}</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span style="color: #BFC7D5;"> </span><span style="color: #89DDFF;">&lt;/</span><span style="color: #FF5572;">div</span><span style="color: #89DDFF;">&gt;</span></div><div class='line line-remove line-has-background' style='background-color: #ef535033'><span style="color:#f07178; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">-</span><span style="color: #BFC7D5;"> </span><span style="color: #89DDFF;">&lt;</span><span style="color: #FF5572;">p</span><span style="color: #89DDFF;"> </span><span style="color: #FFCB6B;">className</span><span style="color: #C792EA;">=</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #C3E88D;">mt-4 text-lg text-gray-900</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #89DDFF;">&gt;</span><span style="color: #D3423E;">{</span><span style="color: #BFC7D5;">chirp</span><span style="color: #C792EA;">.</span><span style="color: #89DDFF;">message</span><span style="color: #D3423E;">}</span><span style="color: #89DDFF;">&lt;/</span><span style="color: #FF5572;">p</span><span style="color: #89DDFF;">&gt;</span></div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span style="color: #BFC7D5;"> </span><span style="color: #D3423E;">{</span><span style="color: #BFC7D5;">editing</span></div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span style="color: #BFC7D5;"> </span><span style="color: #89DDFF;">?</span><span style="color: #BFC7D5;"> </span><span style="color: #89DDFF;">&lt;</span><span style="color: #FF5572;">form</span><span style="color: #89DDFF;"> </span><span style="color: #FFCB6B;">onSubmit</span><span style="color: #C792EA;">=</span><span style="color: #D3423E;">{</span><span style="color: #BFC7D5;">submit</span><span style="color: #D3423E;">}</span><span style="color: #89DDFF;">&gt;</span></div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span style="color: #BFC7D5;"> </span><span style="color: #89DDFF;">&lt;</span><span style="color: #FF5572;">textarea</span><span style="color: #89DDFF;"> </span><span style="color: #FFCB6B;">value</span><span style="color: #C792EA;">=</span><span style="color: #D3423E;">{</span><span style="color: #BFC7D5;">data</span><span style="color: #C792EA;">.</span><span style="color: #89DDFF;">message</span><span style="color: #D3423E;">}</span><span style="color: #89DDFF;"> </span><span style="color: #FFCB6B;">onChange</span><span style="color: #C792EA;">=</span><span style="color: #D3423E;">{</span><span style="color: #7986E7;">e</span><span style="color: #89DDFF;"> </span><span style="color: #C792EA;">=&gt;</span><span style="color: #89DDFF;"> </span><span style="color: #82AAFF;">setData</span><span style="color: #BFC7D5;">(</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #C3E88D;">message</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #EEFFFF;">,</span><span style="color: #89DDFF;"> </span><span style="color: #BFC7D5;">e</span><span style="color: #C792EA;">.</span><span style="color: #89DDFF;">target</span><span style="color: #C792EA;">.</span><span style="color: #89DDFF;">value</span><span style="color: #BFC7D5;">)</span><span style="color: #D3423E;">}</span><span style="color: #89DDFF;"> </span><span style="color: #FFCB6B;">className</span><span style="color: #C792EA;">=</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #C3E88D;">mt-4 w-full text-gray-900 border-gray-300 focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50 rounded-md shadow-sm</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #89DDFF;">&gt;&lt;/</span><span style="color: #FF5572;">textarea</span><span style="color: #89DDFF;">&gt;</span></div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span style="color: #BFC7D5;"> </span><span style="color: #89DDFF;">&lt;</span><span style="color: #FF5572;">InputError</span><span style="color: #89DDFF;"> </span><span style="color: #FFCB6B;">message</span><span style="color: #C792EA;">=</span><span style="color: #D3423E;">{</span><span style="color: #BFC7D5;">errors</span><span style="color: #C792EA;">.</span><span style="color: #89DDFF;">message</span><span style="color: #D3423E;">}</span><span style="color: #89DDFF;"> </span><span style="color: #FFCB6B;">className</span><span style="color: #C792EA;">=</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #C3E88D;">mt-2</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #89DDFF;"> /&gt;</span></div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span style="color: #BFC7D5;"> </span><span style="color: #89DDFF;">&lt;</span><span style="color: #FF5572;">div</span><span style="color: #89DDFF;"> </span><span style="color: #FFCB6B;">className</span><span style="color: #C792EA;">=</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #C3E88D;">space-x-2</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #89DDFF;">&gt;</span></div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span style="color: #BFC7D5;"> </span><span style="color: #89DDFF;">&lt;</span><span style="color: #FF5572;">PrimaryButton</span><span style="color: #89DDFF;"> </span><span style="color: #FFCB6B;">className</span><span style="color: #C792EA;">=</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #C3E88D;">mt-4</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #89DDFF;">&gt;</span><span style="color: #BFC7D5;">Save</span><span style="color: #89DDFF;">&lt;/</span><span style="color: #FF5572;">PrimaryButton</span><span style="color: #89DDFF;">&gt;</span></div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span style="color: #BFC7D5;"> </span><span style="color: #89DDFF;">&lt;</span><span style="color: #FF5572;">button</span><span style="color: #89DDFF;"> </span><span style="color: #FFCB6B;">className</span><span style="color: #C792EA;">=</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #C3E88D;">mt-4</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #89DDFF;"> </span><span style="color: #FFCB6B;">onClick</span><span style="color: #C792EA;">=</span><span style="color: #D3423E;">{</span><span style="color: #D9F5DD;">()</span><span style="color: #89DDFF;"> </span><span style="color: #C792EA;">=&gt;</span><span style="color: #89DDFF;"> { </span><span style="color: #82AAFF;">setEditing</span><span style="color: #BFC7D5;">(</span><span style="color: #FF5874;">false</span><span style="color: #BFC7D5;">)</span><span style="color: #89DDFF;">; </span><span style="color: #82AAFF;">reset</span><span style="color: #BFC7D5;">()</span><span style="color: #89DDFF;">; </span><span style="color: #82AAFF;">clearErrors</span><span style="color: #BFC7D5;">()</span><span style="color: #89DDFF;">; }</span><span style="color: #D3423E;">}</span><span style="color: #89DDFF;">&gt;</span><span style="color: #BFC7D5;">Cancel</span><span style="color: #89DDFF;">&lt;/</span><span style="color: #FF5572;">button</span><span style="color: #89DDFF;">&gt;</span></div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span style="color: #BFC7D5;"> </span><span style="color: #89DDFF;">&lt;/</span><span style="color: #FF5572;">div</span><span style="color: #89DDFF;">&gt;</span></div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span style="color: #BFC7D5;"> </span><span style="color: #89DDFF;">&lt;/</span><span style="color: #FF5572;">form</span><span style="color: #89DDFF;">&gt;</span></div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span style="color: #BFC7D5;"> </span><span style="color: #89DDFF;">:</span><span style="color: #BFC7D5;"> </span><span style="color: #89DDFF;">&lt;</span><span style="color: #FF5572;">p</span><span style="color: #89DDFF;"> </span><span style="color: #FFCB6B;">className</span><span style="color: #C792EA;">=</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #C3E88D;">mt-4 text-lg text-gray-900</span><span style="color: #D9F5DD;">&quot;</span><span style="color: #89DDFF;">&gt;</span><span style="color: #D3423E;">{</span><span style="color: #BFC7D5;">chirp</span><span style="color: #C792EA;">.</span><span style="color: #89DDFF;">message</span><span style="color: #D3423E;">}</span><span style="color: #89DDFF;">&lt;/</span><span style="color: #FF5572;">p</span><span style="color: #89DDFF;">&gt;</span></div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span style="color: #BFC7D5;"> </span><span style="color: #D3423E;">}</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span style="color: #BFC7D5;"> </span><span style="color: #89DDFF;">&lt;/</span><span style="color: #FF5572;">div</span><span style="color: #89DDFF;">&gt;</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span style="color: #BFC7D5;"> </span><span style="color: #89DDFF;">&lt;/</span><span style="color: #FF5572;">div</span><span style="color: #89DDFF;">&gt;</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span style="color: #BFC7D5;"> )</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span style="color: #BFC7D5;">}</span></div></code></pre> </div> </div> </div> <h2><a id="updating-our-controller" href="#updating-our-controller" class="heading-permalink" aria-hidden="true" title="Permalink">#</a>Updating our controller</h2> <p>We can now update the <code>update</code> method on our <code>ChirpController</code> class to validate the request and update the database. Even though we're only displaying the edit button to the author of the Chirp, we also need to authorize the request to make sure it's actually the author that is updating it:</p> <div class="code-container"> <div class="code-container-filename">app/Http/Controllers/ChirpController.php</div> <pre><code data-theme="olaolu-palenight" data-lang="php" class='torchlight has-add-lines has-remove-lines has-diff-lines has-summaries' style='background-color: #292D3E; --theme-selection-background: #7580B850;'><!-- Syntax highlighted by torchlight.dev --><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-empty' style='user-select: none; color: #4c5374'></span><span style="color: #D3423E;">&lt;?php</span></div><details><summary style='cursor: pointer; display: block'><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-start' style='user-select: none; color: #4c5374'></span>&nbsp;<span class='summary-hide-when-open' style='color:#4c5374'>...</span></div></summary><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #C792EA;">namespace</span><span style="color: #BFC7D5;"> App\Http\Controllers;</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span>&nbsp;</div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #C792EA;">use</span><span style="color: #BFC7D5;"> App\Models\</span><span style="color: #FFCB8B;">Chirp</span><span style="color: #BFC7D5;">;</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #C792EA;">use</span><span style="color: #BFC7D5;"> Illuminate\Http\</span><span style="color: #FFCB8B;">RedirectResponse</span><span style="color: #BFC7D5;">;</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-end' style='user-select: none; color: #4c5374'></span><span style="color: #C792EA;">use</span><span style="color: #BFC7D5;"> Illuminate\Http\</span><span style="color: #FFCB8B;">Request</span><span style="color: #BFC7D5;">;</span></div></details><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span class='summary-caret summary-caret-empty' style='user-select: none; color: #4c5374'></span><span style="color: #C792EA;">use</span><span style="color: #BFC7D5;"> Illuminate\Support\Facades\</span><span style="color: #FFCB8B;">Gate</span><span style="color: #BFC7D5;">;</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-empty' style='user-select: none; color: #4c5374'></span><span style="color: #C792EA;">use</span><span style="color: #BFC7D5;"> Inertia\</span><span style="color: #FFCB8B;">Inertia</span><span style="color: #BFC7D5;">;</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-empty' style='user-select: none; color: #4c5374'></span><span style="color: #C792EA;">use</span><span style="color: #BFC7D5;"> Inertia\</span><span style="color: #FFCB8B;">Response</span><span style="color: #BFC7D5;">;</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-empty' style='user-select: none; color: #4c5374'></span>&nbsp;</div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-empty' style='user-select: none; color: #4c5374'></span><span style="color: #C792EA;">class</span><span style="color: #BFC7D5;"> </span><span style="color: #FFCB6B;">ChirpController</span><span style="color: #BFC7D5;"> </span><span style="color: #C792EA;">extends</span><span style="color: #BFC7D5;"> </span><span style="color: #A9C77D;">Controller</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-empty' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;">{</span></div><details><summary style='cursor: pointer; display: block'><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-start' style='user-select: none; color: #4c5374'></span>&nbsp;<span class='summary-hide-when-open' style='color:#4c5374'>...</span></div></summary><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> </span><span style="color: #697098;">/**</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #697098;"> * Display a listing of the resource.</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #697098;"> </span><span style="color: #697098;">*/</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> </span><span style="color: #C792EA;">public</span><span style="color: #BFC7D5;"> </span><span style="color: #C792EA;">function</span><span style="color: #BFC7D5;"> </span><span style="color: #82AAFF;">index</span><span style="color: #D9F5DD;">()</span><span style="color: #89DDFF;">:</span><span style="color: #BFC7D5;"> </span><span style="color: #FFCB8B;">Response</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> {</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> </span><span style="color: #C792EA;">return</span><span style="color: #BFC7D5;"> </span><span style="color: #FFCB8B;">Inertia</span><span style="color: #89DDFF;">::</span><span style="color: #82AAFF;">render</span><span style="color: #BFC7D5;">(</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #C3E88D;">Chirps/Index</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #BFC7D5;">, [</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> </span><span style="color: #D9F5DD;">&#39;</span><span style="color: #C3E88D;">chirps</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #BFC7D5;"> </span><span style="color: #89DDFF;">=&gt;</span><span style="color: #BFC7D5;"> </span><span style="color: #FFCB8B;">Chirp</span><span style="color: #89DDFF;">::</span><span style="color: #82AAFF;">with</span><span style="color: #BFC7D5;">(</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #C3E88D;">user:id,name</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #BFC7D5;">)</span><span style="color: #89DDFF;">-&gt;</span><span style="color: #82AAFF;">latest</span><span style="color: #BFC7D5;">()</span><span style="color: #89DDFF;">-&gt;</span><span style="color: #82AAFF;">get</span><span style="color: #BFC7D5;">(),</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> ]);</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> }</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span>&nbsp;</div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> </span><span style="color: #697098;">/**</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #697098;"> * Show the form for creating a new resource.</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #697098;"> </span><span style="color: #697098;">*/</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> </span><span style="color: #C792EA;">public</span><span style="color: #BFC7D5;"> </span><span style="color: #C792EA;">function</span><span style="color: #BFC7D5;"> </span><span style="color: #82AAFF;">create</span><span style="color: #D9F5DD;">()</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> {</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> </span><span style="color: #697098;">//</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> }</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span>&nbsp;</div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> </span><span style="color: #697098;">/**</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #697098;"> * Store a newly created resource in storage.</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #697098;"> </span><span style="color: #697098;">*/</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> </span><span style="color: #C792EA;">public</span><span style="color: #BFC7D5;"> </span><span style="color: #C792EA;">function</span><span style="color: #BFC7D5;"> </span><span style="color: #82AAFF;">store</span><span style="color: #D9F5DD;">(</span><span style="color: #FFCB8B;">Request</span><span style="color: #BFC7D5;"> </span><span style="color: #BEC5D4;">$request</span><span style="color: #D9F5DD;">)</span><span style="color: #89DDFF;">:</span><span style="color: #BFC7D5;"> </span><span style="color: #FFCB8B;">RedirectResponse</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> {</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> </span><span style="color: #BEC5D4;">$validated</span><span style="color: #BFC7D5;"> </span><span style="color: #C792EA;">=</span><span style="color: #BFC7D5;"> </span><span style="color: #BEC5D4;">$request</span><span style="color: #89DDFF;">-&gt;</span><span style="color: #82AAFF;">validate</span><span style="color: #BFC7D5;">([</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> </span><span style="color: #D9F5DD;">&#39;</span><span style="color: #C3E88D;">message</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #BFC7D5;"> </span><span style="color: #89DDFF;">=&gt;</span><span style="color: #BFC7D5;"> </span><span style="color: #D9F5DD;">&#39;</span><span style="color: #C3E88D;">required|string|max:255</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #BFC7D5;">,</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> ]);</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span>&nbsp;</div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> </span><span style="color: #BEC5D4;">$request</span><span style="color: #89DDFF;">-&gt;</span><span style="color: #82AAFF;">user</span><span style="color: #BFC7D5;">()</span><span style="color: #89DDFF;">-&gt;</span><span style="color: #82AAFF;">chirps</span><span style="color: #BFC7D5;">()</span><span style="color: #89DDFF;">-&gt;</span><span style="color: #82AAFF;">create</span><span style="color: #BFC7D5;">(</span><span style="color: #BEC5D4;">$validated</span><span style="color: #BFC7D5;">);</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span>&nbsp;</div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> </span><span style="color: #C792EA;">return</span><span style="color: #BFC7D5;"> </span><span style="color: #82AAFF;">redirect</span><span style="color: #BFC7D5;">(</span><span style="color: #82AAFF;">route</span><span style="color: #BFC7D5;">(</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #C3E88D;">chirps.index</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #BFC7D5;">));</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> }</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span>&nbsp;</div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> </span><span style="color: #697098;">/**</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #697098;"> * Display the specified resource.</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #697098;"> </span><span style="color: #697098;">*/</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> </span><span style="color: #C792EA;">public</span><span style="color: #BFC7D5;"> </span><span style="color: #C792EA;">function</span><span style="color: #BFC7D5;"> </span><span style="color: #82AAFF;">show</span><span style="color: #D9F5DD;">(</span><span style="color: #FFCB8B;">Chirp</span><span style="color: #BFC7D5;"> </span><span style="color: #BEC5D4;">$chirp</span><span style="color: #D9F5DD;">)</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> {</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> </span><span style="color: #697098;">//</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> }</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span>&nbsp;</div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> </span><span style="color: #697098;">/**</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #697098;"> * Show the form for editing the specified resource.</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #697098;"> </span><span style="color: #697098;">*/</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> </span><span style="color: #C792EA;">public</span><span style="color: #BFC7D5;"> </span><span style="color: #C792EA;">function</span><span style="color: #BFC7D5;"> </span><span style="color: #82AAFF;">edit</span><span style="color: #D9F5DD;">(</span><span style="color: #FFCB8B;">Chirp</span><span style="color: #BFC7D5;"> </span><span style="color: #BEC5D4;">$chirp</span><span style="color: #D9F5DD;">)</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> {</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> </span><span style="color: #697098;">//</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> }</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-end' style='user-select: none; color: #4c5374'></span>&nbsp;</div></details><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-empty' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> </span><span style="color: #697098;">/**</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-empty' style='user-select: none; color: #4c5374'></span><span style="color: #697098;"> * Update the specified resource in storage.</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-empty' style='user-select: none; color: #4c5374'></span><span style="color: #697098;"> </span><span style="color: #697098;">*/</span></div><div class='line line-remove line-has-background' style='background-color: #ef535033'><span style="color:#f07178; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">-</span><span class='summary-caret summary-caret-empty' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> </span><span style="color: #C792EA;">public</span><span style="color: #BFC7D5;"> </span><span style="color: #C792EA;">function</span><span style="color: #BFC7D5;"> </span><span style="color: #82AAFF;">update</span><span style="color: #D9F5DD;">(</span><span style="color: #FFCB8B;">Request</span><span style="color: #BFC7D5;"> </span><span style="color: #BEC5D4;">$request</span><span style="color: #BFC7D5;">, </span><span style="color: #FFCB8B;">Chirp</span><span style="color: #BFC7D5;"> </span><span style="color: #BEC5D4;">$chirp</span><span style="color: #D9F5DD;">)</span></div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span class='summary-caret summary-caret-empty' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> </span><span style="color: #C792EA;">public</span><span style="color: #BFC7D5;"> </span><span style="color: #C792EA;">function</span><span style="color: #BFC7D5;"> </span><span style="color: #82AAFF;">update</span><span style="color: #D9F5DD;">(</span><span style="color: #FFCB8B;">Request</span><span style="color: #BFC7D5;"> </span><span style="color: #BEC5D4;">$request</span><span style="color: #BFC7D5;">, </span><span style="color: #FFCB8B;">Chirp</span><span style="color: #BFC7D5;"> </span><span style="color: #BEC5D4;">$chirp</span><span style="color: #D9F5DD;">)</span><span style="color: #89DDFF;">:</span><span style="color: #BFC7D5;"> </span><span style="color: #FFCB8B;">RedirectResponse</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-empty' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> {</span></div><div class='line line-remove line-has-background' style='background-color: #ef535033'><span style="color:#f07178; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">-</span><span class='summary-caret summary-caret-empty' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> </span><span style="color: #697098;">//</span></div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span class='summary-caret summary-caret-empty' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> </span><span style="color: #FFCB8B;">Gate</span><span style="color: #89DDFF;">::</span><span style="color: #82AAFF;">authorize</span><span style="color: #BFC7D5;">(</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #C3E88D;">update</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #BFC7D5;">, </span><span style="color: #BEC5D4;">$chirp</span><span style="color: #BFC7D5;">);</span></div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span class='summary-caret summary-caret-empty' style='user-select: none; color: #4c5374'></span>&nbsp;</div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span class='summary-caret summary-caret-empty' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> </span><span style="color: #BEC5D4;">$validated</span><span style="color: #BFC7D5;"> </span><span style="color: #C792EA;">=</span><span style="color: #BFC7D5;"> </span><span style="color: #BEC5D4;">$request</span><span style="color: #89DDFF;">-&gt;</span><span style="color: #82AAFF;">validate</span><span style="color: #BFC7D5;">([</span></div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span class='summary-caret summary-caret-empty' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> </span><span style="color: #D9F5DD;">&#39;</span><span style="color: #C3E88D;">message</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #BFC7D5;"> </span><span style="color: #89DDFF;">=&gt;</span><span style="color: #BFC7D5;"> </span><span style="color: #D9F5DD;">&#39;</span><span style="color: #C3E88D;">required|string|max:255</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #BFC7D5;">,</span></div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span class='summary-caret summary-caret-empty' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> ]);</span></div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span class='summary-caret summary-caret-empty' style='user-select: none; color: #4c5374'></span>&nbsp;</div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span class='summary-caret summary-caret-empty' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> </span><span style="color: #BEC5D4;">$chirp</span><span style="color: #89DDFF;">-&gt;</span><span style="color: #82AAFF;">update</span><span style="color: #BFC7D5;">(</span><span style="color: #BEC5D4;">$validated</span><span style="color: #BFC7D5;">);</span></div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span class='summary-caret summary-caret-empty' style='user-select: none; color: #4c5374'></span>&nbsp;</div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span class='summary-caret summary-caret-empty' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> </span><span style="color: #C792EA;">return</span><span style="color: #BFC7D5;"> </span><span style="color: #82AAFF;">redirect</span><span style="color: #BFC7D5;">(</span><span style="color: #82AAFF;">route</span><span style="color: #BFC7D5;">(</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #C3E88D;">chirps.index</span><span style="color: #D9F5DD;">&#39;</span><span style="color: #BFC7D5;">));</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-empty' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> }</span></div><details><summary style='cursor: pointer; display: block'><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-start' style='user-select: none; color: #4c5374'></span>&nbsp;<span class='summary-hide-when-open' style='color:#4c5374'>...</span></div></summary><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> </span><span style="color: #697098;">/**</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #697098;"> * Remove the specified resource from storage.</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #697098;"> </span><span style="color: #697098;">*/</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> </span><span style="color: #C792EA;">public</span><span style="color: #BFC7D5;"> </span><span style="color: #C792EA;">function</span><span style="color: #BFC7D5;"> </span><span style="color: #82AAFF;">destroy</span><span style="color: #D9F5DD;">(</span><span style="color: #FFCB8B;">Chirp</span><span style="color: #BFC7D5;"> </span><span style="color: #BEC5D4;">$chirp</span><span style="color: #D9F5DD;">)</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> {</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> </span><span style="color: #697098;">//</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> }</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-end' style='user-select: none; color: #4c5374'></span>&nbsp;</div></details><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-empty' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;">}</span></div></code></pre> </div> <aside class="mb-10 max-w-2xl mx-auto px-4 py-8 shadow-lg lg:flex lg:items-center bg-white dark:bg-dark-700"><div class="w-20 h-20 mb-6 flex items-center justify-center shrink-0 bg-purple-600 lg:mb-0"><img src="/img/callouts/lightbulb.min.svg" class="opacity-75"></img></div><div class="lg:ml-6 prose-p:m-0"><p> You may have noticed the validation rules are duplicated with the <code>store</code> method. You might consider extracting them using Laravel's <a href="https://laravel.com/docs/validation#form-request-validation">Form Request Validation</a>, which makes it easy to re-use validation rules and to keep your controllers light.</p></div></aside> <h2><a id="authorization" href="#authorization" class="heading-permalink" aria-hidden="true" title="Permalink">#</a>Authorization</h2> <p>By default, the <code>authorize</code> method will prevent <em>everyone</em> from being able to update the Chirp. We can specify who is allowed to update it by creating a <a href="https://laravel.com/docs/authorization#creating-policies">Model Policy</a> with the following command:</p> <div class="code-container"> <pre><code data-theme="olaolu-palenight" data-lang="shell" class='torchlight' style='background-color: #292D3E; --theme-selection-background: #7580B850;'><!-- Syntax highlighted by torchlight.dev --><div class='line'><span style="color: #BFC7D5;">php </span><span style="color: #BFC7D5;">artisan</span><span style="color: #BFC7D5;"> </span><span style="color: #BFC7D5;">make:policy</span><span style="color: #BFC7D5;"> </span><span style="color: #BFC7D5;">ChirpPolicy</span><span style="color: #BFC7D5;"> </span><span style="color: #82AAFF;">--model=Chirp</span></div></code></pre> </div> <p>This will create a policy class at <code>app/Policies/ChirpPolicy.php</code> which we can update to specify that only the author is authorized to update a Chirp:</p> <div class="code-container"> <div class="code-container-filename">app/Policies/ChirpPolicy.php</div> <pre><code data-theme="olaolu-palenight" data-lang="php" class='torchlight has-add-lines has-remove-lines has-diff-lines has-summaries' style='background-color: #292D3E; --theme-selection-background: #7580B850;'><!-- Syntax highlighted by torchlight.dev --><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-empty' style='user-select: none; color: #4c5374'></span><span style="color: #D3423E;">&lt;?php</span></div><details><summary style='cursor: pointer; display: block'><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-start' style='user-select: none; color: #4c5374'></span>&nbsp;<span class='summary-hide-when-open' style='color:#4c5374'>...</span></div></summary><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #C792EA;">namespace</span><span style="color: #BFC7D5;"> App\Policies;</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span>&nbsp;</div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #C792EA;">use</span><span style="color: #BFC7D5;"> App\Models\</span><span style="color: #FFCB8B;">Chirp</span><span style="color: #BFC7D5;">;</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #C792EA;">use</span><span style="color: #BFC7D5;"> App\Models\</span><span style="color: #FFCB8B;">User</span><span style="color: #BFC7D5;">;</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #C792EA;">use</span><span style="color: #BFC7D5;"> Illuminate\Auth\Access\</span><span style="color: #FFCB8B;">HandlesAuthorization</span><span style="color: #BFC7D5;">;</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-end' style='user-select: none; color: #4c5374'></span>&nbsp;</div></details><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-empty' style='user-select: none; color: #4c5374'></span><span style="color: #C792EA;">class</span><span style="color: #BFC7D5;"> </span><span style="color: #FFCB6B;">ChirpPolicy</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-empty' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;">{</span></div><details><summary style='cursor: pointer; display: block'><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-start' style='user-select: none; color: #4c5374'></span>&nbsp;<span class='summary-hide-when-open' style='color:#4c5374'>...</span></div></summary><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> </span><span style="color: #C792EA;">use</span><span style="color: #BFC7D5;"> </span><span style="color: #FFCB8B;">HandlesAuthorization</span><span style="color: #BFC7D5;">;</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span>&nbsp;</div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> </span><span style="color: #697098;">/**</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #697098;"> * Determine whether the user can view any models.</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #697098;"> </span><span style="color: #697098;">*/</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> </span><span style="color: #C792EA;">public</span><span style="color: #BFC7D5;"> </span><span style="color: #C792EA;">function</span><span style="color: #BFC7D5;"> </span><span style="color: #82AAFF;">viewAny</span><span style="color: #D9F5DD;">(</span><span style="color: #FFCB8B;">User</span><span style="color: #BFC7D5;"> </span><span style="color: #BEC5D4;">$user</span><span style="color: #D9F5DD;">)</span><span style="color: #89DDFF;">:</span><span style="color: #BFC7D5;"> </span><span style="color: #C792EA;">bool</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> {</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> </span><span style="color: #697098;">//</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> }</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span>&nbsp;</div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> </span><span style="color: #697098;">/**</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #697098;"> * Determine whether the user can view the model.</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #697098;"> </span><span style="color: #697098;">*/</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> </span><span style="color: #C792EA;">public</span><span style="color: #BFC7D5;"> </span><span style="color: #C792EA;">function</span><span style="color: #BFC7D5;"> </span><span style="color: #82AAFF;">view</span><span style="color: #D9F5DD;">(</span><span style="color: #FFCB8B;">User</span><span style="color: #BFC7D5;"> </span><span style="color: #BEC5D4;">$user</span><span style="color: #BFC7D5;">, </span><span style="color: #FFCB8B;">Chirp</span><span style="color: #BFC7D5;"> </span><span style="color: #BEC5D4;">$chirp</span><span style="color: #D9F5DD;">)</span><span style="color: #89DDFF;">:</span><span style="color: #BFC7D5;"> </span><span style="color: #C792EA;">bool</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> {</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> </span><span style="color: #697098;">//</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> }</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span>&nbsp;</div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> </span><span style="color: #697098;">/**</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #697098;"> * Determine whether the user can create models.</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #697098;"> </span><span style="color: #697098;">*/</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> </span><span style="color: #C792EA;">public</span><span style="color: #BFC7D5;"> </span><span style="color: #C792EA;">function</span><span style="color: #BFC7D5;"> </span><span style="color: #82AAFF;">create</span><span style="color: #D9F5DD;">(</span><span style="color: #FFCB8B;">User</span><span style="color: #BFC7D5;"> </span><span style="color: #BEC5D4;">$user</span><span style="color: #D9F5DD;">)</span><span style="color: #89DDFF;">:</span><span style="color: #BFC7D5;"> </span><span style="color: #C792EA;">bool</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> {</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> </span><span style="color: #697098;">//</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> }</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-end' style='user-select: none; color: #4c5374'></span>&nbsp;</div></details><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-empty' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> </span><span style="color: #697098;">/**</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-empty' style='user-select: none; color: #4c5374'></span><span style="color: #697098;"> * Determine whether the user can update the model.</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-empty' style='user-select: none; color: #4c5374'></span><span style="color: #697098;"> </span><span style="color: #697098;">*/</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-empty' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> </span><span style="color: #C792EA;">public</span><span style="color: #BFC7D5;"> </span><span style="color: #C792EA;">function</span><span style="color: #BFC7D5;"> </span><span style="color: #82AAFF;">update</span><span style="color: #D9F5DD;">(</span><span style="color: #FFCB8B;">User</span><span style="color: #BFC7D5;"> </span><span style="color: #BEC5D4;">$user</span><span style="color: #BFC7D5;">, </span><span style="color: #FFCB8B;">Chirp</span><span style="color: #BFC7D5;"> </span><span style="color: #BEC5D4;">$chirp</span><span style="color: #D9F5DD;">)</span><span style="color: #89DDFF;">:</span><span style="color: #BFC7D5;"> </span><span style="color: #C792EA;">bool</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-empty' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> {</span></div><div class='line line-remove line-has-background' style='background-color: #ef535033'><span style="color:#f07178; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">-</span><span class='summary-caret summary-caret-empty' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> </span><span style="color: #697098;">//</span></div><div class='line line-add line-has-background' style='background-color: #99b76d23'><span style="color:#C3E88D; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number">+</span><span class='summary-caret summary-caret-empty' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> </span><span style="color: #C792EA;">return</span><span style="color: #BFC7D5;"> </span><span style="color: #BEC5D4;">$chirp</span><span style="color: #89DDFF;">-&gt;</span><span style="color: #82AAFF;">user</span><span style="color: #BFC7D5;">()</span><span style="color: #89DDFF;">-&gt;</span><span style="color: #82AAFF;">is</span><span style="color: #BFC7D5;">(</span><span style="color: #BEC5D4;">$user</span><span style="color: #BFC7D5;">);</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-empty' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> }</span></div><details><summary style='cursor: pointer; display: block'><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-start' style='user-select: none; color: #4c5374'></span>&nbsp;<span class='summary-hide-when-open' style='color:#4c5374'>...</span></div></summary><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> </span><span style="color: #697098;">/**</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #697098;"> * Determine whether the user can delete the model.</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #697098;"> </span><span style="color: #697098;">*/</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> </span><span style="color: #C792EA;">public</span><span style="color: #BFC7D5;"> </span><span style="color: #C792EA;">function</span><span style="color: #BFC7D5;"> </span><span style="color: #82AAFF;">delete</span><span style="color: #D9F5DD;">(</span><span style="color: #FFCB8B;">User</span><span style="color: #BFC7D5;"> </span><span style="color: #BEC5D4;">$user</span><span style="color: #BFC7D5;">, </span><span style="color: #FFCB8B;">Chirp</span><span style="color: #BFC7D5;"> </span><span style="color: #BEC5D4;">$chirp</span><span style="color: #D9F5DD;">)</span><span style="color: #89DDFF;">:</span><span style="color: #BFC7D5;"> </span><span style="color: #C792EA;">bool</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> {</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> </span><span style="color: #697098;">//</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> }</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span>&nbsp;</div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> </span><span style="color: #697098;">/**</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #697098;"> * Determine whether the user can restore the model.</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #697098;"> </span><span style="color: #697098;">*/</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> </span><span style="color: #C792EA;">public</span><span style="color: #BFC7D5;"> </span><span style="color: #C792EA;">function</span><span style="color: #BFC7D5;"> </span><span style="color: #82AAFF;">restore</span><span style="color: #D9F5DD;">(</span><span style="color: #FFCB8B;">User</span><span style="color: #BFC7D5;"> </span><span style="color: #BEC5D4;">$user</span><span style="color: #BFC7D5;">, </span><span style="color: #FFCB8B;">Chirp</span><span style="color: #BFC7D5;"> </span><span style="color: #BEC5D4;">$chirp</span><span style="color: #D9F5DD;">)</span><span style="color: #89DDFF;">:</span><span style="color: #BFC7D5;"> </span><span style="color: #C792EA;">bool</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> {</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> </span><span style="color: #697098;">//</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> }</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span>&nbsp;</div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> </span><span style="color: #697098;">/**</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #697098;"> * Determine whether the user can permanently delete the model.</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #697098;"> </span><span style="color: #697098;">*/</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> </span><span style="color: #C792EA;">public</span><span style="color: #BFC7D5;"> </span><span style="color: #C792EA;">function</span><span style="color: #BFC7D5;"> </span><span style="color: #82AAFF;">forceDelete</span><span style="color: #D9F5DD;">(</span><span style="color: #FFCB8B;">User</span><span style="color: #BFC7D5;"> </span><span style="color: #BEC5D4;">$user</span><span style="color: #BFC7D5;">, </span><span style="color: #FFCB8B;">Chirp</span><span style="color: #BFC7D5;"> </span><span style="color: #BEC5D4;">$chirp</span><span style="color: #D9F5DD;">)</span><span style="color: #89DDFF;">:</span><span style="color: #BFC7D5;"> </span><span style="color: #C792EA;">bool</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> {</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> </span><span style="color: #697098;">//</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-middle' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;"> }</span></div><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-end' style='user-select: none; color: #4c5374'></span>&nbsp;</div></details><div class='line'><span style="color:#4c5374; text-align: right; -webkit-user-select: none; user-select: none;" class="line-number"> </span><span class='summary-caret summary-caret-empty' style='user-select: none; color: #4c5374'></span><span style="color: #BFC7D5;">}</span></div></code></pre> </div> <h2><a id="testing-it-out" href="#testing-it-out" class="heading-permalink" aria-hidden="true" title="Permalink">#</a>Testing it out</h2> <p>Time to test it out! Go ahead and edit a few Chirps using the dropdown menu. If you register another user account, you'll see that only the author of a Chirp can edit it.</p> <img src="/img/screenshots/chirp-editted.png" alt="An editted chirp" class="rounded-lg border dark:border-none shadow-lg" /> <p><a href="/inertia/deleting-chirps">Continue to allow deleting of Chirps...</a></p><script> function setTab(tab, group, save) { save = typeof save === 'undefined' ? true : save document .querySelectorAll(`.tabbed-code[data-group="${group}"] .tabbed-code-nav-button`) .forEach(el => el.classList.remove('active')) document .querySelectorAll(`.tabbed-code[data-group="${group}"] .code-container`) .forEach(el => el.classList.remove('active')) document .querySelectorAll(`.tabbed-code[data-group="${group}"] [data-tab="${tab}"]`) .forEach(el => el.classList.add('active')) if (save) { saveTab(tab, group) } } function getTabs() { try { return JSON.parse(localStorage.tabs) } catch { return {} } } function saveTab(tab, group) { localStorage.tabs = JSON.stringify({ ...getTabs(), [group]: tab, }) } function restoreTabs() { Object.entries(getTabs()).forEach(([group, tab]) => setTab(tab, group, false)) } restoreTabs() </script> </div> <script> // Set the active navigation state... Array.from(document.querySelectorAll('#header a, #sidebar a')).forEach(link => { if (link.hostname === location.hostname && (link.pathname === location.pathname || (link.pathname === '/introduction' && location.pathname === '/')) ) { link.classList.add('active') if (link.parentNode.tagName === 'LI') { link.parentNode.parentNode.parentNode.classList.add('sub--on') } } }) // Make the navigation headings expandable... Array.from(document.querySelectorAll('.docs_sidebar h2')).forEach(el => { if (el.children.length > 1) { return } el.addEventListener('click', (e) => { const active = el.parentNode.classList.contains('sub--on'); [...document.querySelectorAll('.docs_sidebar ul li')].forEach(el => el.classList.remove('sub--on')); if (! active) { el.parentNode.classList.add('sub--on'); } }) }) // Highlight the active section in the table of contents... function setActiveTableOfContents () { const links = Array.from(document.querySelectorAll('.table-of-contents a')) const lastVisible = links .slice() .reverse() .find(link => { const el = document.querySelector(link.hash) return el.getBoundingClientRect().top <= 56; }) ?? links[0] links.forEach(link => { if (link === lastVisible) { link.classList.add('active') } else { link.classList.remove('active') } }) } setActiveTableOfContents() window.addEventListener('scroll', setActiveTableOfContents, { passive: true }) </script> </div> </section> </section> </div> </section> </div> <footer class="relative mt-12 pt-12 bg-gradient-to-b from-gray-50 to-white dark:from-dark-800 dark:to-dark-700"> <div class="max-w-screen-2xl mx-auto w-full px-8"> <div> <a href="https://laravel.com" class="inline-flex"> <img class="h-14" src="/img/logo.min.svg" alt="Laravel" loading="lazy"> </a> </div> <div class="mt-6 sm:mt-12"> <p class="max-w-sm text-xs text-gray-700 sm:text-sm dark:text-gray-500">Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel attempts to take the pain out of development by easing common tasks used in most web projects.</p> <ul class="mt-6 flex items-center space-x-3"> <li> <a href="https://twitter.com/laravelphp"> <img id="footer__twitter_dark" class="hidden dark:inline-block w-6 h-6" src="/img/social/twitter.dark.min.svg" alt="Twitter" loading="lazy" width="24" height="20"> <img id="footer__twitter" class="inline-block dark:hidden w-6 h-6" src="/img/social/twitter.min.svg" alt="Twitter" loading="lazy" width="24" height="20"> </a> </li> <li> <a href="https://github.com/laravel"> <img id="footer__github_dark" class="hidden dark:inline-block w-6 h-6" src="/img/social/github.dark.min.svg" alt="GitHub" loading="lazy" width="24" height="24"> <img id="footer__github" class="inline-block dark:hidden w-6 h-6" src="/img/social/github.min.svg" alt="GitHub" loading="lazy" width="24" height="24"> </a> </li> <li> <a href="https://discord.gg/mPZNm7A"> <img id="footer__discord_dark" class="hidden dark:inline-block w-6 h-6" src="/img/social/discord.dark.min.svg" alt="Discord" loading="lazy" width="21" height="24"> <img id="footer__discord" class="inline-block dark:hidden w-6 h-6" src="/img/social/discord.min.svg" alt="Discord" loading="lazy" width="21" height="24"> </a> </li> <li> <a href="https://www.youtube.com/laravelphp"> <img id="footer__youtube_dark" class="hidden dark:inline-block w-6 h-6" src="/img/social/youtube.dark.min.svg" alt="YouTube" loading="lazy" width="169" height="150"> <img id="footer__youtube" class="inline-block dark:hidden w-6 h-6" src="/img/social/youtube.min.svg" alt="YouTube" loading="lazy" width="169" height="150"> </a> </li> </ul> </div> <div class="mt-10 border-t pt-6 pb-16 border-gray-200 dark:border-dark-500"> <p class="text-xs text-gray-700 dark:text-gray-400"> Laravel is a Trademark of Laravel Holdings Inc.<br /> Copyright &copy; Laravel Holdings Inc. </p> <p class="mt-6 text-xs text-gray-700 dark:text-gray-400"> Code highlighting provided by <a href="https://torchlight.dev">Torchlight</a> </p> </div> </div> </footer> </div> </body> </html>

Pages: 1 2 3 4 5 6 7 8 9 10