SeedPdfTemplatesTable::run()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 16
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 16
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 10
nc 2
nop 0
1
<?php namespace VojtaSvoboda\UserExportPdf\Updates;
2
3
use File;
4
use Renatio\DynamicPDF\Models\Layout;
5
use Renatio\DynamicPDF\Models\Template;
6
use Schema;
7
use Seeder;
8
9
class SeedPdfTemplatesTable extends Seeder
10
{
11
    public function run()
12
    {
13
        if (!Schema::hasTable('renatio_dynamicpdf_pdf_templates')) {
14
            return false;
15
        }
16
17
        $layout = Layout::where('code', 'rainlab::user')->first();
18
19
        Template::create([
20
            'title' => 'User profile',
21
            'description' => "User's PDF card template",
22
            'layout' => $layout,
23
            'code' => 'rainlab::user',
24
            'content_html' => File::get(__DIR__ . '/templates/user.htm'),
25
        ]);
26
    }
27
}
28