PHP code example of wallacemaxters / laravel-navalha
1. Go to this page and download the library: Download wallacemaxters/laravel-navalha library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
wallacemaxters / laravel-navalha example snippets
namespace App\Navalha;
use App\Models\Product;
use WallaceMaxters\Navalha\Component;
class Products extends Component
{
public function mount(): void
{
$this->paginate(1);
}
protected function data(): array
{
return [
'page' => 1,
'products' => null,
];
}
public function paginate(int $page)
{
$this['products'] = Product::query()->paginate(3, page: $page);
$this['page'] = $page;
// or
// $this->set('page', $page);
}
public function render()
{
return view("navalha.products");
}
}