1. Go to this page and download the library: Download rinvex/laravel-pages 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/ */
rinvex / laravel-pages example snippets
$page = app('rinvex.pages.page')->create([
'uri' => 'test',
'slug' => 'test-page',
'route' => 'frontend.pages.test',
'title' => 'Test Page',
'view' => 'test-page',
]);
// Deactivate the page
$page->deactivate();
// Activate the page
$page->activate();
// Get all pages
$pages = app('rinvex.pages.page')->all();
// Get active pages
$pages = app('rinvex.pages.page')->where('is_active', true)->get();
use App\Models\Article;
use Illuminate\Database\Eloquent\Relations\MorphToMany;
app('rinvex.pages.pageables')->put('article', Article::class);
app('rinvex.pages.page')->macro('setArticlesAttribute', function ($articles) {
static::saved(function (self $model) use ($articles) {
$model->entries(Article::class)->sync($articles, true);
});
});
app('rinvex.pages.page')->resolveRelationUsing('articles', function ($pageModel): MorphToMany {
return $pageModel->entries(Article::class);
});
shell
php artisan rinvex:publish:pages
shell
php artisan rinvex:migrate:pages
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.