Updates to 03-2025
This commit is contained in:
parent
6167273a48
commit
9b54eb0512
348 changed files with 34535 additions and 5774 deletions
132
app/Models/UserShop.php
Normal file
132
app/Models/UserShop.php
Normal file
|
|
@ -0,0 +1,132 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\User;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
/**
|
||||
* Class UserShop
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $user_id
|
||||
* @property string|null $url
|
||||
* @property string|null $name
|
||||
* @property string|null $description
|
||||
* @property string|null $about_you
|
||||
* @property string|null $user_address
|
||||
* @property string|null $trans
|
||||
* @property bool $pick_up
|
||||
* @property bool $active
|
||||
* @property Carbon|null $active_date
|
||||
* @property string|null $featured
|
||||
* @property Carbon|null $created_at
|
||||
* @property Carbon|null $updated_at
|
||||
* @property string|null $deleted_at
|
||||
* @property User $user
|
||||
* @package App\Models
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserShop newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserShop newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserShop onlyTrashed()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserShop query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserShop whereAboutYou($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserShop whereActive($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserShop whereActiveDate($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserShop whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserShop whereDeletedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserShop whereDescription($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserShop whereFeatured($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserShop whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserShop whereName($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserShop wherePickUp($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserShop whereTrans($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserShop whereUpdatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserShop whereUrl($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserShop whereUserAddress($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserShop whereUserId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserShop withTrashed()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserShop withoutTrashed()
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class UserShop extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'user_shops';
|
||||
|
||||
protected $casts = [
|
||||
'user_id' => 'int',
|
||||
'pick_up' => 'bool',
|
||||
'active' => 'bool',
|
||||
'featured' => 'array',
|
||||
'trans' => 'array',
|
||||
];
|
||||
|
||||
protected $dates = [
|
||||
'active_date'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'user_id',
|
||||
'url',
|
||||
'name',
|
||||
'description',
|
||||
'about_you',
|
||||
'user_address',
|
||||
'trans',
|
||||
'pick_up',
|
||||
'active',
|
||||
'active_date',
|
||||
'featured'
|
||||
];
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
||||
public function getUrlPreview()
|
||||
{
|
||||
return $this->url ? config('app.shop_url')."/".$this->url : "";
|
||||
}
|
||||
|
||||
public function getLang($key, $default = true)
|
||||
{
|
||||
$lang = \App::getLocale();
|
||||
if ($lang == 'de') {
|
||||
return $this->{$key};
|
||||
}
|
||||
return $this->getTrans($key, $lang, $default);
|
||||
}
|
||||
|
||||
public function getTrans($key, $lang, $default = true)
|
||||
{
|
||||
if ($lang == 'de') {
|
||||
return $this->{$key};
|
||||
}
|
||||
if(!empty($this->trans[$lang][$key])){
|
||||
return $this->trans[$lang][$key];
|
||||
}
|
||||
if($default){
|
||||
return !empty($this->{$key}) ? $this->{$key} : '';
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public function isActive(){
|
||||
if($this->active){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getSubdomain(){
|
||||
return "";
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue