-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathCsrCampaignPage.php
More file actions
45 lines (37 loc) · 1.03 KB
/
CsrCampaignPage.php
File metadata and controls
45 lines (37 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class CsrCampaignPage extends Model
{
protected $table = 'csr_campaign_page';
protected $fillable = [
'use_dynamic_content',
'hero_text',
'primary_cta_text',
'primary_cta_link',
'secondary_cta_text',
'secondary_cta_link',
'about_title',
'about_description',
'resources_title',
];
protected $casts = [
'use_dynamic_content' => 'boolean',
];
public function resources()
{
return $this->hasMany(CsrCampaignResource::class, 'page_id')->orderBy('position');
}
public static function config(): self
{
$page = self::first();
if ($page) {
return $page;
}
return self::create([
'use_dynamic_content' => false,
'primary_cta_link' => 'https://codeweek.eu/blog/futurereadycsr-campaign-launch',
'secondary_cta_link' => 'https://codeweek.eu/blog/futurereadycsr-resources',
]);
}
}