jonnybarnes.uk/database/seeders/ArticlesTableSeeder.php

59 lines
1.3 KiB
PHP
Raw Normal View History

2016-05-19 15:01:28 +01:00
<?php
2020-10-17 17:15:06 +01:00
namespace Database\Seeders;
use App\Models\Article;
2016-05-19 15:01:28 +01:00
use Illuminate\Database\Seeder;
2022-07-09 10:08:26 +01:00
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\DB;
2016-05-19 15:01:28 +01:00
class ArticlesTableSeeder extends Seeder
{
/**
2023-02-18 09:34:57 +00:00
* Seed the articles table.
2016-05-19 15:01:28 +01:00
*/
2023-02-18 09:34:57 +00:00
public function run(): void
2016-05-19 15:01:28 +01:00
{
$now = Carbon::now()->subMonth()->subDays(5);
$articleFirst = Article::create([
2016-05-19 15:01:28 +01:00
'title' => 'My New Blog',
'main' => 'This is *my* new blog. It uses `Markdown`.',
2016-05-19 15:01:28 +01:00
'published' => 1,
'created_at' => $now,
2016-05-19 15:01:28 +01:00
]);
DB::table('articles')
->where('id', $articleFirst->id)
->update(['updated_at' => $now->toDateTimeString()]);
Improve syntax highlighting of code Squashed commit of the following: commit eb55e94ed89a1b8ccd1db10a36efd28d8896f316 Author: Jonny Barnes <jonny@jonnybarnes.uk> Date: Thu Jan 24 18:45:00 2019 +0000 Remove un-needed use statments, fix tests now we have 2 articles commit f1c12c1b43d071fe0484407a9692ee4184542437 Author: Jonny Barnes <jonny@jonnybarnes.uk> Date: Wed Jan 23 19:39:56 2019 +0000 Remove prism files commit 3a1d12d9181600f661593c662dbc18d152413b28 Author: Jonny Barnes <jonny@jonnybarnes.uk> Date: Wed Jan 23 19:39:24 2019 +0000 Use the new css file in the search page commit 119b6b5163c217a15770004a45b07bacdfb766f0 Author: Jonny Barnes <jonny@jonnybarnes.uk> Date: Wed Jan 23 19:36:14 2019 +0000 Recompress assets commit afae245d0211dd31fcc131cecb0fab4084895612 Author: Jonny Barnes <jonny@jonnybarnes.uk> Date: Sun Jan 20 19:33:56 2019 +0000 Style codeblocks in articles as well commit 53be0a2023755c2f16ba1560d88f9c66675b581d Author: Jonny Barnes <jonny@jonnybarnes.uk> Date: Sun Jan 20 19:23:25 2019 +0000 Styled codeblocks are now on the notes pages commit 818add06f349874501cc44baf332dc63dfdcfab1 Author: Jonny Barnes <jonny@jonnybarnes.uk> Date: Sun Jan 20 19:08:56 2019 +0000 Install spatie’s commonmark highlighter, use it for notes commit fb69d98b2bd3bb56540854fe16200c027e5ef6b2 Author: Jonny Barnes <jonny@jonnybarnes.uk> Date: Sun Jan 20 18:54:27 2019 +0000 Remove links to prism code in the notes pages commit dc89fcd4711b25e8407be9b25b58cd4cd1e9980e Author: Jonny Barnes <jonny@jonnybarnes.uk> Date: Sun Jan 20 18:54:11 2019 +0000 Add a note to the seeder which has a code block
2019-01-24 19:19:45 +00:00
$now = Carbon::now()->subHours(2)->subMinutes(25);
2022-07-09 10:08:26 +01:00
$articleWithCode = <<<'EOF'
Improve syntax highlighting of code Squashed commit of the following: commit eb55e94ed89a1b8ccd1db10a36efd28d8896f316 Author: Jonny Barnes <jonny@jonnybarnes.uk> Date: Thu Jan 24 18:45:00 2019 +0000 Remove un-needed use statments, fix tests now we have 2 articles commit f1c12c1b43d071fe0484407a9692ee4184542437 Author: Jonny Barnes <jonny@jonnybarnes.uk> Date: Wed Jan 23 19:39:56 2019 +0000 Remove prism files commit 3a1d12d9181600f661593c662dbc18d152413b28 Author: Jonny Barnes <jonny@jonnybarnes.uk> Date: Wed Jan 23 19:39:24 2019 +0000 Use the new css file in the search page commit 119b6b5163c217a15770004a45b07bacdfb766f0 Author: Jonny Barnes <jonny@jonnybarnes.uk> Date: Wed Jan 23 19:36:14 2019 +0000 Recompress assets commit afae245d0211dd31fcc131cecb0fab4084895612 Author: Jonny Barnes <jonny@jonnybarnes.uk> Date: Sun Jan 20 19:33:56 2019 +0000 Style codeblocks in articles as well commit 53be0a2023755c2f16ba1560d88f9c66675b581d Author: Jonny Barnes <jonny@jonnybarnes.uk> Date: Sun Jan 20 19:23:25 2019 +0000 Styled codeblocks are now on the notes pages commit 818add06f349874501cc44baf332dc63dfdcfab1 Author: Jonny Barnes <jonny@jonnybarnes.uk> Date: Sun Jan 20 19:08:56 2019 +0000 Install spatie’s commonmark highlighter, use it for notes commit fb69d98b2bd3bb56540854fe16200c027e5ef6b2 Author: Jonny Barnes <jonny@jonnybarnes.uk> Date: Sun Jan 20 18:54:27 2019 +0000 Remove links to prism code in the notes pages commit dc89fcd4711b25e8407be9b25b58cd4cd1e9980e Author: Jonny Barnes <jonny@jonnybarnes.uk> Date: Sun Jan 20 18:54:11 2019 +0000 Add a note to the seeder which has a code block
2019-01-24 19:19:45 +00:00
I wrote some code.
I liked writing this:
```php
<?php
declare(strict_types=1);
class Foo
{
public function __construct()
{
echo 'Foo class constructed';
}
}
```
EOF;
$articleSecond = Article::create([
Improve syntax highlighting of code Squashed commit of the following: commit eb55e94ed89a1b8ccd1db10a36efd28d8896f316 Author: Jonny Barnes <jonny@jonnybarnes.uk> Date: Thu Jan 24 18:45:00 2019 +0000 Remove un-needed use statments, fix tests now we have 2 articles commit f1c12c1b43d071fe0484407a9692ee4184542437 Author: Jonny Barnes <jonny@jonnybarnes.uk> Date: Wed Jan 23 19:39:56 2019 +0000 Remove prism files commit 3a1d12d9181600f661593c662dbc18d152413b28 Author: Jonny Barnes <jonny@jonnybarnes.uk> Date: Wed Jan 23 19:39:24 2019 +0000 Use the new css file in the search page commit 119b6b5163c217a15770004a45b07bacdfb766f0 Author: Jonny Barnes <jonny@jonnybarnes.uk> Date: Wed Jan 23 19:36:14 2019 +0000 Recompress assets commit afae245d0211dd31fcc131cecb0fab4084895612 Author: Jonny Barnes <jonny@jonnybarnes.uk> Date: Sun Jan 20 19:33:56 2019 +0000 Style codeblocks in articles as well commit 53be0a2023755c2f16ba1560d88f9c66675b581d Author: Jonny Barnes <jonny@jonnybarnes.uk> Date: Sun Jan 20 19:23:25 2019 +0000 Styled codeblocks are now on the notes pages commit 818add06f349874501cc44baf332dc63dfdcfab1 Author: Jonny Barnes <jonny@jonnybarnes.uk> Date: Sun Jan 20 19:08:56 2019 +0000 Install spatie’s commonmark highlighter, use it for notes commit fb69d98b2bd3bb56540854fe16200c027e5ef6b2 Author: Jonny Barnes <jonny@jonnybarnes.uk> Date: Sun Jan 20 18:54:27 2019 +0000 Remove links to prism code in the notes pages commit dc89fcd4711b25e8407be9b25b58cd4cd1e9980e Author: Jonny Barnes <jonny@jonnybarnes.uk> Date: Sun Jan 20 18:54:11 2019 +0000 Add a note to the seeder which has a code block
2019-01-24 19:19:45 +00:00
'title' => 'Some code I did',
'main' => $articleWithCode,
'published' => 1,
'created_at' => $now,
Improve syntax highlighting of code Squashed commit of the following: commit eb55e94ed89a1b8ccd1db10a36efd28d8896f316 Author: Jonny Barnes <jonny@jonnybarnes.uk> Date: Thu Jan 24 18:45:00 2019 +0000 Remove un-needed use statments, fix tests now we have 2 articles commit f1c12c1b43d071fe0484407a9692ee4184542437 Author: Jonny Barnes <jonny@jonnybarnes.uk> Date: Wed Jan 23 19:39:56 2019 +0000 Remove prism files commit 3a1d12d9181600f661593c662dbc18d152413b28 Author: Jonny Barnes <jonny@jonnybarnes.uk> Date: Wed Jan 23 19:39:24 2019 +0000 Use the new css file in the search page commit 119b6b5163c217a15770004a45b07bacdfb766f0 Author: Jonny Barnes <jonny@jonnybarnes.uk> Date: Wed Jan 23 19:36:14 2019 +0000 Recompress assets commit afae245d0211dd31fcc131cecb0fab4084895612 Author: Jonny Barnes <jonny@jonnybarnes.uk> Date: Sun Jan 20 19:33:56 2019 +0000 Style codeblocks in articles as well commit 53be0a2023755c2f16ba1560d88f9c66675b581d Author: Jonny Barnes <jonny@jonnybarnes.uk> Date: Sun Jan 20 19:23:25 2019 +0000 Styled codeblocks are now on the notes pages commit 818add06f349874501cc44baf332dc63dfdcfab1 Author: Jonny Barnes <jonny@jonnybarnes.uk> Date: Sun Jan 20 19:08:56 2019 +0000 Install spatie’s commonmark highlighter, use it for notes commit fb69d98b2bd3bb56540854fe16200c027e5ef6b2 Author: Jonny Barnes <jonny@jonnybarnes.uk> Date: Sun Jan 20 18:54:27 2019 +0000 Remove links to prism code in the notes pages commit dc89fcd4711b25e8407be9b25b58cd4cd1e9980e Author: Jonny Barnes <jonny@jonnybarnes.uk> Date: Sun Jan 20 18:54:11 2019 +0000 Add a note to the seeder which has a code block
2019-01-24 19:19:45 +00:00
]);
DB::table('articles')
->where('id', $articleSecond->id)
->update(['updated_at' => $now->toDateTimeString()]);
2016-05-19 15:01:28 +01:00
}
}