Laravel分页中不存在方法附加

时间:2018-01-10 12:47:15

标签: php laravel pagination laravel-5.5

我在使用以下代码时遇到了一些麻烦。看起来我已经忘记了在圣诞节休息后如何去拉拉维尔

{{ $portalEntries->append(Input::except('page'))->links() }}

错误异常

Method append does not exist. (View: /home/sites/mydomain.com/resources/views/portal/page.blade.php)

以下是获取变量$portalEntries

的代码
public function getEntries($paginate = 20, $deleted = false)
{
    $query = PortalEntry::select(DB::raw('portal_entries.*'))
        ->where('portal_entries.portal_page_id', $this->id)
        ->orderBy('portal_entries.id', 'desc');

    if($deleted) {
        $query->where('portal_entries.deleted', 1);
    }
    else {
        $query->where('portal_entries.deleted', 0);
    }

    if(request()->has('search')) {
        $query->join('portal_entries_values', 'portal_entries.id', '=', 'portal_entries_values.portal_entries_id');
        $query->where('value', 'like', '%'.request("search").'%');

        if(request()->input('search_column', 'all') !== 'all') {

            $query->where('portal_entries_values.portal_page_columns_id', request()->input('search_column'));
        }
    }

    return $query->paginate($paginate);
}

1 个答案:

答案 0 :(得分:2)

将附加替换为追加check this link for details

试试这个

{{ $portalEntries->appends(Input::except('page'))->links() }}