Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 43 default markdown #46

Merged
merged 3 commits into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading