Question

  • Creator
    Topic
  • #2140438

    Laravel pagination with problems

    by belmeska ·

    i have a simple question as i do not know which line i should add into to get laravel pagination. (->paginate(5). Wonderful source to read. It helped me a lot, but still… https://.com/laravel/laravel-overwriting-default-pagination-system

    public function index(Request $request)
    {

    $codeSearch = $request->get(‘code’);
    $descriptionSearch = $request->get(‘description’);

    //$tmp = Category::all()->toArray();
    $tmp = Category::where(‘code’,’like’,’%’ .$codeSearch. ‘%’)->where(‘description’,’like’,’%’ .$codeSearch. ‘%’)->get()->toArray();

    $category = array();
    foreach ($tmp as $key => $row) {
    $policy = Category::find($row[‘parent_id’]);

    $tmpResult = new Category();
    $tmpResult->id = $row[‘id’];
    $tmpResult->code = $row[‘code’];
    $tmpResult->description = $row[‘description’];
    $tmpResult->parent_id = $policy[‘description’];
    $tmpResult->status = $row[‘status’];

    array_push($category, $tmpResult);
    }

    return view(‘category.index’, compact(‘category’));
    }

    Moderator Note: URL disabled so this is not spam.

You are posting a reply to: Laravel pagination with problems

The posting of advertisements, profanity, or personal attacks is prohibited. Please refer to our Community FAQs for details. All submitted content is subject to our Terms of Use.

All Answers

Viewing 1 reply thread