mirror of
https://github.com/archtechx/laravel-pages.git
synced 2025-12-12 09:54:03 +00:00
add source code
This commit is contained in:
commit
e534ddd14c
23 changed files with 798 additions and 0 deletions
41
src/Page.php
Normal file
41
src/Page.php
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace ArchTech\Pages;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Orbit\Concerns\Orbital;
|
||||
|
||||
class Page extends Model
|
||||
{
|
||||
use Orbital;
|
||||
|
||||
protected $guarded = [];
|
||||
|
||||
public static function schema(Blueprint $table)
|
||||
{
|
||||
$table->string('slug');
|
||||
$table->string('title');
|
||||
$table->longText('content');
|
||||
}
|
||||
|
||||
public function getKeyName()
|
||||
{
|
||||
return 'slug';
|
||||
}
|
||||
|
||||
public function getIncrementing()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function routes(): void
|
||||
{
|
||||
Route::get('/{page}', config('pages.routes.handler'))
|
||||
->prefix(config('pages.routes.prefix'))
|
||||
->name(config('pages.routes.name'));
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue