Author Archives: admin

distinct() and count()

 

Download Files using response()

 

Route mapping issue – get wrong function

The sequence in routes/web.php do effect the result and map to a wrong function.

Solution:

This is because var id has no specific data type so “login” in this path “/member/login” will be passed to function login as a parameter.

https://laravel.com/docs/5.1/routing?fbclid=IwAR3AtLACEAYNy43usFklrMVxrsfaTbaKPqn_Jq-FGQX6RUgbyr9Qg_ZbBlA#parameters-regular-expression-constraints

Laravel Join Example

Advanced:

 

Model example for multilanguage

Controller:

Translate entire model and display with custom helper:

 

Reference:

  1. https://docs.laravelvoyager.com/core-concepts/multilanguage

Customize pagination generated by links()

Override the template of pagination in following path:

  1. Copy template file to view folder
    From:
    /vendor/laravel/framework/src/Illuminate/Pagination/resources/views/bootstrap-4.blade.php
    To:
    /resources/views/partials
  2. Revise template in view
  3. Add this view in links() param:

Reference:

  1. https://mattstauffer.com/blog/customizing-pagination-templates-in-laravel-5-3/
  2. https://stackoverflow.com/questions/28240777/custom-pagination-view-in-laravel-5