Skip to content

Commit

Permalink
Merge pull request #46 from alkrauss48/issue-43-default-markdown
Browse files Browse the repository at this point in the history
Issue 43 default markdown
  • Loading branch information
alkrauss48 authored Oct 14, 2024
2 parents cf2f0e3 + 4887113 commit 65c2fb5
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 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
6 changes: 3 additions & 3 deletions app/Models/DailyView.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ public function scopeStats(Builder $query, ?string $presentationId = null): void
*/
public function scopeForUser(Builder $query): void
{
$query->when(!auth()->user()->isAdministrator(), function($qr){
$qr->whereHas('presentation', function($qrPresn){
$qrPresn->where('user_id',auth()->id());
$query->when(! auth()->user()->isAdministrator(), function ($qr) {
$qr->whereHas('presentation', function ($qrPresn) {
$qrPresn->where('user_id', auth()->id());
});
});
}
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 65c2fb5

Please sign in to comment.