File tree Expand file tree Collapse file tree 3 files changed +45
-0
lines changed Expand file tree Collapse file tree 3 files changed +45
-0
lines changed Original file line number Diff line number Diff line change @@ -38,3 +38,5 @@ TELEGRAM_CHANNEL=
38
38
39
39
FATHOM_SITE_ID =
40
40
FATHOM_TOKEN =
41
+
42
+ UNSPLASH_ACCESS_KEY =
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace App \Console \Commands ;
4
+
5
+ use App \Models \Article ;
6
+ use Illuminate \Console \Command ;
7
+
8
+ final class SyncArticleImages extends Command
9
+ {
10
+ protected $ signature = 'lio:sync-article-images ' ;
11
+
12
+ protected $ description = 'Updates the Unsplash image for all articles ' ;
13
+
14
+ protected $ accessKey ;
15
+
16
+ public function __construct ()
17
+ {
18
+ parent ::__construct ();
19
+
20
+ $ this ->accessKey = config ('services.unsplash.access_key ' );
21
+ }
22
+
23
+ public function handle (): void
24
+ {
25
+ if (! $ this ->accessKey ) {
26
+ $ this ->error ('Unsplash access key must be configured ' );
27
+
28
+ return ;
29
+ }
30
+
31
+ Article::published ()->chunk (100 , function ($ articles ) {
32
+ $ articles ->each (function ($ article ) {
33
+ if (! $ article ->hero_image ) {
34
+ // Update Unsplash image URL
35
+ }
36
+ });
37
+ });
38
+ }
39
+ }
Original file line number Diff line number Diff line change 62
62
'token ' => env ('FATHOM_TOKEN ' ),
63
63
],
64
64
65
+ 'unsplash ' => [
66
+ 'acccess_key ' => env ('UNSPLASH_ACCESS_KEY ' ),
67
+ ],
68
+
65
69
];
You can’t perform that action at this time.
0 commit comments