jonnybarnes.uk/database/seeds/NotesTableSeeder.php
Jonny Barnes 1ba1b40588 Squashed commit of the following:
commit 94b13846d90c02041f56b21111709da91cd40726
Author: Jonny Barnes <jonny@jonnybarnes.uk>
Date:   Sun Oct 22 15:51:47 2017 +0100

    Remove un-needed use statement

commit c370d83766fb10a100f780124bdcfc2694208140
Author: Jonny Barnes <jonny@jonnybarnes.uk>
Date:   Sun Oct 22 15:44:50 2017 +0100

    use fillable instead of guarded, drop dates transform

commit dcf620c168f75d6c9860f5149adebfaceb9d772f
Author: Jonny Barnes <jonny@jonnybarnes.uk>
Date:   Sun Oct 22 15:42:41 2017 +0100

    Given we are adding a property for contacts, we need to invoke Laravel’s
    own model __construct() method.

commit 0cba9301c3175e60bf1c3b0ada36c79a3c33c72c
Author: Jonny Barnes <jonny@jonnybarnes.uk>
Date:   Sun Oct 22 15:37:19 2017 +0100

    Given change in mass-assignment protection, change how we populate database

commit 7d09d174153ca99c0975d70fbccdc340d437227c
Author: Jonny Barnes <jonny@jonnybarnes.uk>
Date:   Sun Oct 22 10:38:51 2017 +0100

    Use a property to hold parsed contact info

commit 25b05f8592ee282da5d82227b9873b523e9955d3
Author: Jonny Barnes <jonny@jonnybarnes.uk>
Date:   Fri Oct 20 17:19:44 2017 +0100

    First attempts at reducing eloquent calls
2017-10-22 16:16:13 +01:00

59 lines
2 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
use Illuminate\Database\Seeder;
class NotesTableSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
factory(App\Note::class, 10)->create();
sleep(1);
$noteWithPlace = App\Note::create([
'note' => 'Having a #beer at the local. 🍺',
]);
$noteWithPlace->tweet_id = '123456789';
$place = App\Place::find(1);
$noteWithPlace->place()->associate($place);
$noteWithPlace->save();
sleep(1);
$noteWithContact = App\Note::create([
'note' => 'Hi @tantek'
]);
sleep(1);
$noteWithContactPlusPic = App\Note::create([
'note' => 'Hi @aaron',
'client_id' => 'https://jbl5.dev/notes/new'
]);
sleep(1);
$noteWithoutContact = App\Note::create([
'note' => 'Hi @bob',
'client_id' => 'https://quill.p3k.io'
]);
sleep(1);
//copy aarons profile pic in place
$spl = new SplFileInfo(public_path() . '/assets/profile-images/aaronparecki.com');
if ($spl->isDir() === false) {
mkdir(public_path() . '/assets/profile-images/aaronparecki.com', 0755);
copy(base_path() . '/tests/aaron.png', public_path() . '/assets/profile-images/aaronparecki.com/image');
}
$noteWithCoords = App\Note::create([
'note' => 'Note from somehwere',
]);
$noteWithCoords->location = '53.499,-2.379';
$noteWithCoords->save();
sleep(1);
$noteSyndicated = App\Note::create([
'note' => 'This note has all the syndication targets',
]);
$noteSyndicated->tweet_id = '123456';
$noteSyndicated->facebook_url = 'https://www.facebook.com/post/12345789';
$noteSyndicated->swarm_url = 'https://www.swarmapp.com/checking/123456789';
$noteSyndicated->instagram_url = 'https://www.instagram.com/p/aWsEd123Jh';
$noteSyndicated->save();
}
}