Skip to content

Commit b5a0cad

Browse files
Develop (#410)
* chore: update local development readme and db seeder (#404) * chore: update development readme * chore: add about and faq pages to db seeder * chore: readme tiny change * hotfix: filter out projects with invalid dates (#406) * fix: apply HasValidDates scope to Project and BCRProject queries * chore: rename for readability fix * fix email * add cover url for cover photo in article * fix cs-fixer * add fallback --------- Co-authored-by: ancarofl <35558437+ancarofl@users.noreply.github.com>
1 parent cb7cf97 commit b5a0cad

File tree

7 files changed

+67
-24
lines changed

7 files changed

+67
-24
lines changed

app/Filament/Resources/Articles/ArticleResource.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,11 @@ public static function form(Form $form): Form
103103
->relationship('category', 'name')
104104
->required(),
105105

106+
TextInput::make('cover_photo_url')
107+
->label(__('article.cover_photo_url'))
108+
->url()
109+
->maxLength(255),
110+
106111
TiptapEditor::make('content')
107112
->label(__('article.content'))
108113
->extraInputAttributes([

app/Http/Resources/Articles/ArticleResource.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ public function toArray(Request $request): array
1818
return [
1919
'id' => $this->id,
2020
'title' => $this->title,
21+
'cover_photo_url' => $this->cover_photo_url ?? '#',
2122
'description' => Str::of($this->content)
2223
->stripTags()
2324
->limit(200),

app/Models/Article.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ class Article extends Model implements HasMedia
2929
'slug',
3030
'content',
3131
'article_category_id',
32+
'cover_photo_url',
3233
'author',
3334
];
3435

app/Notifications/Admin/ExportExcelNotification.php

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,20 @@ public function via(object $notifiable): array
4545
*/
4646
public function toMail(object $notifiable): MailMessage
4747
{
48-
$file = Storage::disk('filament-excel')->exists($this->filename)
49-
? Storage::disk('filament-excel')->get($this->filename)
50-
: null;
51-
52-
return (new MailMessage)
48+
$mail = (new MailMessage)
5349
->subject(__('notification.export_finished.title'))
5450
->line(__('notification.export_finished.body', ['filename' => $this->filename]))
55-
->attachData($file, $this->filename)
5651
->action(__('notification.export_finished.action'), $this->generateURL());
52+
53+
if (Storage::disk('filament-excel')->exists($this->filename)) {
54+
$mail->attachData(
55+
Storage::disk('filament-excel')->get($this->filename),
56+
$this->filename,
57+
['mime' => Storage::disk('filament-excel')->mimeType($this->filename)]
58+
);
59+
}
60+
61+
return $mail;
5762
}
5863

5964
/**
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
return new class extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*/
12+
public function up(): void
13+
{
14+
Schema::table('articles', function (Blueprint $table) {
15+
$table->string('cover_photo_url')->nullable();
16+
});
17+
}
18+
19+
/**
20+
* Reverse the migrations.
21+
*/
22+
public function down(): void
23+
{
24+
Schema::table('articles', function (Blueprint $table) {
25+
$table->dropColumn('cover_photo_url');
26+
});
27+
}
28+
};

lang/ro/article.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
'title' => 'Titlu',
1616
'content' => 'Conținut',
1717
'is_published' => 'Publicat',
18+
'cover_photo_url' => 'URL fotografie copertă',
1819
'category' => 'Categorie articol',
1920
'author' => 'Autor',
2021
'created_at' => 'Creat la',

resources/js/Pages/Public/Articles/Show.vue

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44

55
<figure class="container">
66
<div class="aspect-w-2 aspect-h-1">
7-
<img class="object-cover" :src="resource.cover" alt="" />
7+
<a :href="resource.cover_photo_url" target="_blank" rel="noopener">
8+
<img class="object-cover" :src="resource.cover" alt="" />
9+
</a>
810
</div>
911
</figure>
1012

@@ -68,22 +70,22 @@
6870
</template>
6971

7072
<script setup>
71-
import ArticleCard from '@/Components/cards/ArticleCard.vue';
72-
import Head from '@/Components/Head.vue';
73-
import LargeSquarePattern from '@/Components/patterns/LargeSquarePattern.vue';
74-
import PageLayout from '@/Layouts/PageLayout.vue';
75-
import SharePage from '@/Components/SharePage.vue';
76-
import Gallery from '@/Components/Gallery.vue';
77-
import { SpeakerphoneIcon } from '@heroicons/vue/outline';
73+
import ArticleCard from '@/Components/cards/ArticleCard.vue';
74+
import Head from '@/Components/Head.vue';
75+
import LargeSquarePattern from '@/Components/patterns/LargeSquarePattern.vue';
76+
import PageLayout from '@/Layouts/PageLayout.vue';
77+
import SharePage from '@/Components/SharePage.vue';
78+
import Gallery from '@/Components/Gallery.vue';
79+
import { SpeakerphoneIcon } from '@heroicons/vue/outline';
7880
79-
defineProps({
80-
resource: {
81-
type: Object,
82-
required: true,
83-
},
84-
related: {
85-
type: Object,
86-
default: () => ({}),
87-
},
88-
});
81+
defineProps({
82+
resource: {
83+
type: Object,
84+
required: true,
85+
},
86+
related: {
87+
type: Object,
88+
default: () => ({}),
89+
},
90+
});
8991
</script>

0 commit comments

Comments
 (0)