mardi 24 novembre 2015

Laravel 5 Delete a row from database

I am trying to delete a category by clicking on a button but give me page not found.

enter image description here controller

    public function ApagarPortfolio($id) {
        $i = DB::table('portfolio')->where('id',$id)->delete();
        if($i > 0) {
            Session::flash('apagarportfolio', 'Portfolio removido com sucesso'); 
            return Redirect::route('portfolio');                
        }
    }

route

Route::get('backend/portfolio/{$id}','BackendControlador@ApagarPortfolio');

index

                                        <a title="Apagar" href="{{URL::to('backend/portfolio/'.$portf->id) }}" style="color: white;">
                                            <button class="btn 
                                                @if($portf -> genero == 'Web Design')
                                                    btn-success btn-sm"                                                                             
                                                @endif   
                                                 data-widget="remove">
                                                    <i class="fa fa-times"></i>
                                            </button>
                                         </a>



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire