Skip to content

Commit

Permalink
feat: add default markdown to content
Browse files Browse the repository at this point in the history
  • Loading branch information
Layla Krauss authored and Layla Krauss committed Oct 14, 2024
1 parent cf2f0e3 commit 1349ede
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
1 change: 1 addition & 0 deletions app/Filament/Resources/PresentationResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public static function form(Form $form): Form
->schema([
Forms\Components\MarkdownEditor::make('content')
->required()
->default(Presentation::DEFAULT_MARKDOWN)
->hint(new HtmlString(
'<strong>Tip:</strong> '
.'Slides are separated by 2 newlines.'
Expand Down
16 changes: 14 additions & 2 deletions app/Models/Presentation.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,18 @@ class Presentation extends Model implements HasMedia
use InteractsWithMedia;
use SoftDeletes;

public const DEFAULT_MARKDOWN = <<<'MARKDOWN'
# My Presentation
A Cool Subtitle
## Topic 1
- Point 1
- Point 2
- [Point 3](https://example.com)
MARKDOWN;

/**
* The attributes that are not mass assignable.
*
Expand Down Expand Up @@ -108,8 +120,8 @@ protected function shouldTrackView(): Attribute
*/
public function scopeForUser(Builder $query): void
{
$query->when(!auth()->user()->isAdministrator(), function($qr){
$qr->where('user_id',auth()->id());
$query->when(! auth()->user()->isAdministrator(), function ($qr) {
$qr->where('user_id', auth()->id());
});
}

Expand Down

0 comments on commit 1349ede

Please sign in to comment.