mercredi 1 avril 2020

why my database does not update ? (LARAVEL)

my database does not update while when i do

 dd(request()->has('validated'));

this is what my web.php looks like:

Route::patch('prof/theme/{id}/validated', 'Theme\ThemeController@valide')->name('prof.theme.validated');

this is what my ThemeController.php looks like:

public function valide(Theme $theme) {
        $theme->update([
            'validated' => request()->has('validated')
        ]);
       return back();

    }

this is what my show.blade.php looks like:

<form action="" method="POST">
                        @csrf
                        @method('PATCH')
                             @if ($theme->validated)
                                <button type="submit" class="btn btn-danger text-center" style="width: 350px">
                                            INVALIDER LE THEME
                                </button>
                             @else
                                 <button type="submit" class="btn btn-success text-center" name="validated" id="validated" style="width: 350px">
                                                VALIDER LE THEME
                                 </button>
                             @endif
                         </form> 

this code does not show me any error but it does not produce the expected action. my variable "validated" is a boolean



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2JrlSl8
via IFTTT

Aucun commentaire:

Enregistrer un commentaire