-
Notifications
You must be signed in to change notification settings - Fork 52
/
Setting.php
48 lines (41 loc) · 1.37 KB
/
Setting.php
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
46
47
48
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Setting extends Model
{
protected $fillable = ['module', 'setting_key', 'setting_value'];
public static function getNoShowEmail()
{
return [
'subject' => self::where('setting_key', 'no_show_mail_subject')->first()->setting_value ?? null,
'body' => self::where('setting_key', 'no_show_mail_body')->first()->setting_value ?? null,
];
}
public static function getApplicationApprovedEmail()
{
return [
'subject' => self::where('setting_key', 'approved_mail_subject')->first()->setting_value ?? null,
'body' => self::where('setting_key', 'approved_mail_body')->first()->setting_value ?? null,
];
}
public static function getOfferLetterTemplate()
{
return [
'body' => self::where('setting_key', 'offer_letter_template')->first()->setting_value ?? null,
];
}
public static function scopeKey($query, $key)
{
return $query->where('setting_key', $key);
}
public static function scopeModule($query, $module)
{
return $query->where('module', $module);
}
public static function getSendInvoiceTemplate()
{
return [
'body' => self::where('setting_key', 'send-invoice')->first()->setting_value ?? null,
];
}
}