File tree Expand file tree Collapse file tree 7 files changed +67
-24
lines changed
Filament/Resources/Articles
resources/js/Pages/Public/Articles Expand file tree Collapse file tree 7 files changed +67
-24
lines changed Original file line number Diff line number Diff 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 ([
Original file line number Diff line number Diff 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 ),
Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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 /**
Original file line number Diff line number Diff line change 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+ };
Original file line number Diff line number Diff line change 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 ' ,
Original file line number Diff line number Diff line change 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
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 >
You can’t perform that action at this time.
0 commit comments