Illuminate\Database\Query\Builder.php to accept another param because the original was causing an error in mysql
public function paginate($perPage = 15, $columns = ['*'], $pageName = 'page', $page = null, $table_to_count_from=null)
{
$page = $page ?: Paginator::resolveCurrentPage($pageName);
// MY CHANGE!!! I CHANGED THE CODE BECAUSE IT CAUSES AN ERROR IN MYSQL ON MULTIPLE COLUMNS
$total = (is_null($table_to_count_from)) ? $this->getCountForPagination($columns) : $this->getCountForPagination([$table_to_count_from.'.id']);
$results = $total ? $this->forPage($page, $perPage)->get($columns) : [];
return new LengthAwarePaginator($results, $total, $perPage, $page, [
'path' => Paginator::resolveCurrentPath(),
'pageName' => $pageName,
]);
}