Back | Home
الـ Path الحالي: /home/picotech/domains/instantly.picotech.app/public_html/public/uploads/.././././../app/Models
الملفات الموجودة في هذا الـ Path:
.
..
Accelerator.php
AcceleratorCategory.php
Activity.php
BillingRequest.php
Campaign.php
CampaignTemplate.php
Contact.php
ContactGroup.php
Customer.php
CustomerMail.php
CustomerPlan.php
CustomerSettings.php
Domain.php
Draft.php
EmailAccount.php
EmailAddress.php
EmailQueue.php
EmailTemplate.php
Faq.php
Form.php
FormData.php
FormDetail.php
FrontContact.php
Group.php
Label.php
Lead.php
Message.php
MessageLog.php
Page.php
Plan.php
Sender.php
SendingServer.php
Settings.php
Tax.php
Template.php
Ticket.php
TicketDescription.php
Unsubscribe.php
User.php
VerifyCustomer.php

مشاهدة ملف: Customer.php

<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;

class Customer extends Authenticatable
{
    use Notifiable;

    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'first_name', 'last_name', 'email', 'password', 'status', 'email_verified_at',
    ];

    /**
     * The attributes that should be hidden for arrays.
     *
     * @var array
     */
    protected $hidden = [
        'password', 'remember_token',
    ];

    /**
     * The attributes that should be cast to native types.
     *
     * @var array
     */
    protected $casts = [
        'email_verified_at' => 'datetime',
    ];

    protected $dates = ['created_at', 'updated_at'];

    public function email_accounts(){
        return $this->hasMany(EmailAccount::class, 'customer_id', 'id');
    }
    public function sending_servers(){
        return $this->hasMany(SendingServer::class, 'customer_id', 'id');
    }

    public function getFullNameAttribute()
    {
        return "{$this->first_name} {$this->last_name}";
    }

    public function setPasswordAttribute($value)
    {
        $this->attributes['password'] = bcrypt($value);
    }

    public function getStatusAttribute($value)
    {
        return ucfirst($value);
    }

    public function admin()
    {
        return $this->belongsTo(User::class, 'admin_id')->withDefault();
    }

    public function numbers()
    {
        return $this->hasMany(CustomerMail::class);
    }

    public function plan()
    {
        return $this->hasOne(CustomerPlan::class);
    }

    public function messages()
    {
        return $this->hasMany(Message::class)->orderByDesc('created_at');
    }

    public function sent_messages()
    {
        return $this->messages()->where('type', 'sent');
    }

    public function receive_messages()
    {
        return $this->messages()->where('type', 'inbox');
    }

    public function drafts()
    {
        return $this->hasMany(Draft::class)->orderByDesc('created_at');
    }

    public function unread_messages()
    {
        return $this->receive_messages()->where('read', 'no');
    }

    public function settings()
    {
        return $this->hasMany(CustomerSettings::class);
    }

    public function contacts()
    {
        return $this->hasMany(Contact::class)->orderByDesc('created_at');
    }

    public function groups()
    {
        return $this->hasMany(Group::class)->orderByDesc('created_at');
    }

    public function contact_groups()
    {
        return $this->hasMany(ContactGroup::class)->orderByDesc('created_at');
    }

    public function active_groups()
    {
        return $this->groups()->where('status', 'active');
    }

    public function email_queues()
    {
        return $this->hasMany(EmailQueue::class);
    }

    public function campaings()
    {
        return $this->hasMany(Campaign::class);
    }
    public function tickets(){
        return $this->hasMany(Ticket::class);
    }
    public function message_logs()
    {
        return $this->hasMany(MessageLog::class);
    }

    public function email_templates()
    {
        return $this->hasMany(EmailTemplate::class, 'user_id', 'id');
    }
    public function forms()
    {
        return $this->hasMany(Form::class,'user_id', 'id');
    }
    public function domains(){
        return $this->hasMany(Domain::class, 'customer_id', 'id');
    }
    public function activities(){
        return $this->hasMany(Activity::class, 'customer_id', 'id');
    }
    public function form_details()
    {
        return $this->hasMany(FormDetail::class,'user_id', 'id');
    }
    public function form_datas()
    {
        return $this->hasMany(FormData::class,'user_id', 'id');
    }

    public function campaign_template()
    {
        return $this->hasMany(CampaignTemplate::class,'customer_id', 'id');
    }

    public function senders()
    {
        return $this->hasMany(Sender::class,'customer_id', 'id');
    }

    public function labels(){
        return $this->hasMany(Label::class, 'customer_id', 'id');
    }
}