| 2 |
lars |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
namespace App\Models;
|
|
|
4 |
|
| 69 |
lars |
5 |
use Illuminate\Database\Eloquent\Casts\Attribute;
|
| 2 |
lars |
6 |
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
|
7 |
use Illuminate\Database\Eloquent\Model;
|
|
|
8 |
|
| 415 |
lars |
9 |
/**
|
|
|
10 |
* App\Models\PriceAgency
|
|
|
11 |
*
|
|
|
12 |
* @property int $id
|
|
|
13 |
* @property int $shop_id
|
|
|
14 |
* @property string $name
|
|
|
15 |
* @property int $records
|
|
|
16 |
* @property string $logo_url
|
|
|
17 |
* @property string $home_url
|
|
|
18 |
* @property string $csv_url
|
|
|
19 |
* @property string $trigger_url
|
|
|
20 |
* @property string $contact_name
|
|
|
21 |
* @property string $contact_email
|
|
|
22 |
* @property string $contact_phone
|
|
|
23 |
* @property string $voting_url
|
|
|
24 |
* @property string $access_url
|
|
|
25 |
* @property string $access_user
|
|
|
26 |
* @property string $access_password
|
|
|
27 |
* @property string $comment
|
|
|
28 |
* @property string $locked_manufacturers
|
|
|
29 |
* @property string $config
|
|
|
30 |
* @property int $status
|
|
|
31 |
* @property int $only_deliverable
|
|
|
32 |
* @property float $min_price
|
|
|
33 |
* @property string|null $last_updated_at
|
|
|
34 |
* @property string|null $last_access_at
|
|
|
35 |
* @property string $last_access_by
|
|
|
36 |
* @property string $created_by
|
|
|
37 |
* @property string $updated_by
|
|
|
38 |
* @property \Illuminate\Support\Carbon|null $created_at
|
|
|
39 |
* @property \Illuminate\Support\Carbon|null $updated_at
|
|
|
40 |
* @method static \Database\Factories\PriceAgencyFactory factory($count = null, $state = [])
|
|
|
41 |
* @method static \Illuminate\Database\Eloquent\Builder|PriceAgency newModelQuery()
|
|
|
42 |
* @method static \Illuminate\Database\Eloquent\Builder|PriceAgency newQuery()
|
|
|
43 |
* @method static \Illuminate\Database\Eloquent\Builder|PriceAgency query()
|
|
|
44 |
* @method static \Illuminate\Database\Eloquent\Builder|PriceAgency whereAccessPassword($value)
|
|
|
45 |
* @method static \Illuminate\Database\Eloquent\Builder|PriceAgency whereAccessUrl($value)
|
|
|
46 |
* @method static \Illuminate\Database\Eloquent\Builder|PriceAgency whereAccessUser($value)
|
|
|
47 |
* @method static \Illuminate\Database\Eloquent\Builder|PriceAgency whereComment($value)
|
|
|
48 |
* @method static \Illuminate\Database\Eloquent\Builder|PriceAgency whereConfig($value)
|
|
|
49 |
* @method static \Illuminate\Database\Eloquent\Builder|PriceAgency whereContactEmail($value)
|
|
|
50 |
* @method static \Illuminate\Database\Eloquent\Builder|PriceAgency whereContactName($value)
|
|
|
51 |
* @method static \Illuminate\Database\Eloquent\Builder|PriceAgency whereContactPhone($value)
|
|
|
52 |
* @method static \Illuminate\Database\Eloquent\Builder|PriceAgency whereCreatedAt($value)
|
|
|
53 |
* @method static \Illuminate\Database\Eloquent\Builder|PriceAgency whereCreatedBy($value)
|
|
|
54 |
* @method static \Illuminate\Database\Eloquent\Builder|PriceAgency whereCsvUrl($value)
|
|
|
55 |
* @method static \Illuminate\Database\Eloquent\Builder|PriceAgency whereHomeUrl($value)
|
|
|
56 |
* @method static \Illuminate\Database\Eloquent\Builder|PriceAgency whereId($value)
|
|
|
57 |
* @method static \Illuminate\Database\Eloquent\Builder|PriceAgency whereLastAccessAt($value)
|
|
|
58 |
* @method static \Illuminate\Database\Eloquent\Builder|PriceAgency whereLastAccessBy($value)
|
|
|
59 |
* @method static \Illuminate\Database\Eloquent\Builder|PriceAgency whereLastUpdatedAt($value)
|
|
|
60 |
* @method static \Illuminate\Database\Eloquent\Builder|PriceAgency whereLockedManufacturers($value)
|
|
|
61 |
* @method static \Illuminate\Database\Eloquent\Builder|PriceAgency whereLogoUrl($value)
|
|
|
62 |
* @method static \Illuminate\Database\Eloquent\Builder|PriceAgency whereMinPrice($value)
|
|
|
63 |
* @method static \Illuminate\Database\Eloquent\Builder|PriceAgency whereName($value)
|
|
|
64 |
* @method static \Illuminate\Database\Eloquent\Builder|PriceAgency whereOnlyDeliverable($value)
|
|
|
65 |
* @method static \Illuminate\Database\Eloquent\Builder|PriceAgency whereRecords($value)
|
|
|
66 |
* @method static \Illuminate\Database\Eloquent\Builder|PriceAgency whereShopId($value)
|
|
|
67 |
* @method static \Illuminate\Database\Eloquent\Builder|PriceAgency whereStatus($value)
|
|
|
68 |
* @method static \Illuminate\Database\Eloquent\Builder|PriceAgency whereTriggerUrl($value)
|
|
|
69 |
* @method static \Illuminate\Database\Eloquent\Builder|PriceAgency whereUpdatedAt($value)
|
|
|
70 |
* @method static \Illuminate\Database\Eloquent\Builder|PriceAgency whereUpdatedBy($value)
|
|
|
71 |
* @method static \Illuminate\Database\Eloquent\Builder|PriceAgency whereVotingUrl($value)
|
|
|
72 |
* @mixin \Eloquent
|
|
|
73 |
*/
|
|
|
74 |
class PriceAgency extends Model
|
| 2 |
lars |
75 |
{
|
|
|
76 |
use HasFactory;
|
| 48 |
lars |
77 |
|
| 69 |
lars |
78 |
protected $fillable = [
|
|
|
79 |
"only_deliverable",
|
|
|
80 |
"min_price",
|
|
|
81 |
"access_url",
|
|
|
82 |
"access_user",
|
|
|
83 |
"access_password",
|
|
|
84 |
"comment",
|
|
|
85 |
"contact_name",
|
|
|
86 |
"contact_email",
|
|
|
87 |
"contact_phone",
|
|
|
88 |
];
|
|
|
89 |
|
| 70 |
lars |
90 |
protected function lockedManufacturers(): Attribute
|
| 69 |
lars |
91 |
{
|
|
|
92 |
return Attribute::make(
|
| 78 |
lars |
93 |
get: function ( string $value )
|
| 75 |
lars |
94 |
{
|
| 80 |
lars |
95 |
$manufacturer = new Manufacturer();
|
| 78 |
lars |
96 |
if ( $this->shop_id > 1 )
|
| 75 |
lars |
97 |
{
|
| 80 |
lars |
98 |
$manufacturer->setConnection( 'shop' . $this->shop_id );
|
| 75 |
lars |
99 |
}
|
| 78 |
lars |
100 |
$manufacturer->whereIn( "id", json_decode( $value, true ) )->get();
|
| 82 |
lars |
101 |
return $manufacturer;
|
| 75 |
lars |
102 |
}
|
| 69 |
lars |
103 |
|
|
|
104 |
);
|
|
|
105 |
}
|
| 2 |
lars |
106 |
}
|