Open giwrgos88 opened 7 years ago
Hi, could you solve the problem? I have the same one:
PHP Fatal error: Call to a member function make() on null in /Users/riggi/PhpstormProjects/vivida/vendor/illuminate/pagination/LengthAwarePaginator.php on line 140
seems like
static::viewFactory()
returns null
Yes @riggi basically I i replaced the links function with a custom pagination
@Riggi here is my temporary solution
$function = new Twig_SimpleFunction("render", function ($object) {
$html = '';
$data = array(); // start out array
$data['pages'] = ceil($object->total() / $object->perPage()); // calc pages
$data['si'] = ($object->currentPage() * $object->perPage()) - $object->perPage(); // what row to start at
$data['curr_page'] = $object->currentPage(); // Whats the current page
$max = 7;
if ($data['curr_page'] < $max) {
$sp = 1;
} elseif ($data['curr_page'] >= ($data['pages'] - floor($max / 2))) {
$sp = $data['pages'] - $max + 1;
} elseif ($data['curr_page'] >= $max) {
$sp = $data['curr_page'] - floor($max / 2);
}
if ($data['curr_page'] > $max) {
$html .= '<li ><a href="' . $object->url(1) . '">First Page</a></li>';
}
for ($i = $sp; $i <= ($sp + $max - 1); $i++) {
if ($i > $data['pages']) {
continue;
}
if ($object->currentPage() == $i) {
$html .= ' <li class="active">';
} else {
$html .= '<li >';
}
$html .= ' <a href="' . $object->url($i) . '">' . $i . '</a>
</li>';
}
if ($data['curr_page'] < ($data['pages'] - floor($max / 2))) {
$html .= '<li ><a href="' . $object->url($object->lastPage()) . '">Last Page</a></li>';
}
return $html;
});
Does anyone tried to use the Eloquent 5.3 pagination with Twig?
I'm getting the following error message
Fatal error: Uncaught Error: Call to a member function make() on null in /Applications/XAMPP/xamppfiles/htdocs/****/public_html/wp-content/plugins/crm/vendor/illuminate/pagination/LengthAwarePaginator.php:140 Stack trace: #0 /Applications/XAMPP/xamppfiles/htdocs/****/public_html/wp-content/plugins/crm/app/Providers/CMSServiceProvider.php(116): Illuminate\Pagination\LengthAwarePaginator->render() #1 /Applications/XAMPP/xamppfiles/htdocs/****/public_html/wp-content/twig-cache/18/189d0df44f1fe623fdad2b6fb631c15897dda3614de070c872657111c85f5f1a.php(333): Herbert\Framework\Application->{closure}(Object(Illuminate\Pagination\LengthAwarePaginator)) #2 /Applications/XAMPP/xamppfiles/htdocs/****/public_html/wp-content/plugins/properties-integration/vendor/twig/twig/lib/Twig/Template.php(438): __TwigTemplate_9d8cd83a4a6f650d70c2593b9c9d8a8b349ba241d19c1308c7f81a99c4d3f082->doDisplay(Array, Array) #3 /Applications/XAMPP/xamppfiles/htdocs/****/public_html/wp-content/plu in /Applications/XAMPP/xamppfiles/htdocs/****/public_html/wp-content/plugins/crm/vendor/illuminate/pagination/LengthAwarePaginator.php on line 140