Skip to content
This repository has been archived by the owner on Jun 4, 2022. It is now read-only.

Commit

Permalink
Update Stubs
Browse files Browse the repository at this point in the history
  • Loading branch information
bayareawebpro committed Dec 26, 2020
1 parent 4b7040c commit 1c4aa3d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion stubs/models/Page.stub
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ class Page extends Model

public function getUrlAttribute()
{
return url(data_get($this->attributes, 'slug'));
return url($this->slug);
}
}
16 changes: 11 additions & 5 deletions stubs/resources/Page.stub
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
namespace App\Nova;

use Illuminate\Http\Request;
use Laravel\Nova\Fields\ID;
use Laravel\Nova\Fields\Text;
use Laravel\Nova\Fields\Slug;
use Laravel\Nova\Fields\Select;
use Laravel\Nova\Fields\Textarea;
use BayAreaWebPro\NovaFieldCkEditor\CkEditor;
Expand Down Expand Up @@ -48,15 +48,21 @@ class Page extends Resource
{
return [

Text::make('title')
Text::make('Title')
->rules('required','string')
->stacked(),

Text::make('slug')
Slug::make('Slug')
->rules('required','string')
->stacked(),

CkEditor::make('content')
// The Url Attribute should be appended to the resource index
// for editor requests if you want to control the link format.
Text::make('Url')
->onlyOnIndex()
->hideFromIndex(!$request->has('ckeditor')),

CkEditor::make('Content')
->rules('nullable','string')
->hideFromIndex()
->mediaBrowser()
Expand All @@ -69,7 +75,7 @@ class Page extends Resource
])
->stacked(),

CkEditor::make('excerpt')
CkEditor::make('Excerpt')
->rules('nullable','string')
->hideFromIndex()
->mediaBrowser()
Expand Down

0 comments on commit 1c4aa3d

Please sign in to comment.