Laravel 5从数据库中删除一行

时间:2015-11-24 17:34:12

标签: php database laravel-5 delete-row

我正在尝试通过点击按钮删除某个类别,但却找不到我找到的页面。

enter image description here控制器

    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::get('backend/portfolio/{$id}','BackendControlador@ApagarPortfolio');

索引

                                        <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>

1 个答案:

答案 0 :(得分:2)

变化:

backend/portfolio/{id}

为:

-(BOOL) openAddCardForPaymentUIIfNeeded
{
    if ( [PKPassLibrary isPassLibraryAvailable] )
    {
        if ( ![PKPaymentAuthorizationViewController canMakePaymentsUsingNetworks:[NSArray arrayWithObjects: PKPaymentNetworkAmex, PKPaymentNetworkMasterCard, PKPaymentNetworkVisa, nil]] )
        {
            UIAlertView* alert = [[UIAlertView alloc] initWithTitle:@"Add a Credit Card to Wallet" message:@"Would you like to add a credit card to your wallet now?" delegate:self cancelButtonTitle:@"No" otherButtonTitles:@"Yes", nil];
            [alert show];
            return true;

        }
    }
    return false;
}