mirror of
https://github.com/archtechx/laravel-pages.git
synced 2025-12-12 09:54:03 +00:00
Add password protected pages (resolve #3)
This commit is contained in:
parent
e9d1cd6fe7
commit
c0c4ebe0d0
5 changed files with 23 additions and 4 deletions
|
|
@ -19,6 +19,7 @@ class Page extends Model
|
|||
{
|
||||
$table->string('slug');
|
||||
$table->string('title');
|
||||
$table->string('password')->nullable();
|
||||
$table->longText('content');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,10 @@ class PageController
|
|||
}
|
||||
|
||||
if ($model = config('pages.model')::find($page)) {
|
||||
if ($model->password) {
|
||||
abort_unless(request()->query('password') === $model->password, 403);
|
||||
}
|
||||
|
||||
seo()
|
||||
->title($model->title)
|
||||
->description(Str::limit($model->content, 100));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue