File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed
Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ namespace App \Console \Commands ;
6+
7+ use App \Models \Organisation ;
8+ use Illuminate \Console \Command ;
9+
10+ class MoveOrganisationLogoToPublicBucket extends Command
11+ {
12+ /**
13+ * The name and signature of the console command.
14+ *
15+ * @var string
16+ */
17+ protected $ signature = 'app:move-organisation-logo-to-public-bucket ' ;
18+
19+ /**
20+ * The console command description.
21+ *
22+ * @var string
23+ */
24+ protected $ description = 'Move organisation logo to public bucket ' ;
25+
26+ /**
27+ * Execute the console command.
28+ */
29+ public function handle ()
30+ {
31+ Organisation::query ()
32+ ->whereHas ('media ' )
33+ ->each (function (Organisation $ organisation ) {
34+ $ logo = $ organisation ->getFirstMedia ('default ' );
35+ $ logo ->move ($ organisation , 'default ' , 's3-public ' );
36+ $ this ->info ("Moved logo for organisation: {$ organisation ->name }" );
37+ });
38+ }
39+ }
You can’t perform that action at this time.
0 commit comments