We don’t need the complexity of S3. Sepcifically the complexity of managing my own AWS account, flysystem made the Laravel side easy. A command is added to copy the the S3 files over to local storage.
39 lines
1 KiB
PHP
39 lines
1 KiB
PHP
<?php
|
|
|
|
namespace Database\Seeders;
|
|
|
|
use App\Models\Contact;
|
|
use Illuminate\Database\Seeder;
|
|
use Illuminate\FileSystem\FileSystem;
|
|
|
|
class ContactsTableSeeder extends Seeder
|
|
{
|
|
/**
|
|
* Seed the contacts table.
|
|
*
|
|
* @psalm-suppress PossiblyUnusedMethod
|
|
*/
|
|
public function run(): void
|
|
{
|
|
Contact::create([
|
|
'nick' => 'tantek',
|
|
'name' => 'Tantek Çelik',
|
|
'homepage' => 'http://tantek.com',
|
|
'twitter' => 't',
|
|
]);
|
|
Contact::create([
|
|
'nick' => 'aaron',
|
|
'name' => 'Aaron Parecki',
|
|
'homepage' => 'https://aaronparecki.com',
|
|
'facebook' => '123456',
|
|
]);
|
|
$fs = new FileSystem;
|
|
if (! $fs->exists(public_path('assets/profile-images/aaronparecki.com'))) {
|
|
$fs->makeDirectory(public_path('assets/profile-images/aaronparecki.com'));
|
|
}
|
|
$fs->copy(
|
|
base_path('tests/aaron.png'),
|
|
public_path('assets/profile-images/aaronparecki.com/image')
|
|
);
|
|
}
|
|
}
|