mercredi 23 mai 2018

change boolean field value with laravel

I want to hide post in posts migration I have boolean 'is_hide' field that its default is 0 when I try to change it , success message appear but it didn't change in the database

 public function isHide(Post $post)
    {
        if($post->update([

            'is_hide' => 1
        ]))
        {

        return redirect()->back()->with('success', 'success ');
        }
        return redirect()->back()->with('error', 'error');

    }

in view

<li><a href="">Hide</a></li>

web.php

Route::get('/posts/{post}/hide', 'Web\PostsController@isHide')->name('updateIs_hide');



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

Aucun commentaire:

Enregistrer un commentaire