Back | Home
الـ Path الحالي: /home/picotech/domains/instantly.picotech.app/public_html/public/uploads/../../app/.././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

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

<?php

namespace App\Models;

use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class Message extends Model
{
    use SoftDeletes;
    protected $dates=['schedule_datetime'];

    protected $fillable=['body','emails','schedule_datetime','type','read','schedule_completed','message_obj','message_files','from_name','reply_to','subject'];

    public function setScheduleDatetimeAttribute($value){
        $this->attributes['schedule_datetime']=Carbon::createFromTimeString($value);
    }

    public function user(){
        return $this->belongsTo(Customer::class,'customer_id')->withDefault();
    }

    public function getTimeAttribute(){
        return $this->created_at->diffForHumans();
    }
    public function getFormattedEmailToAttribute(){

        if(is_array(json_decode($this->emails)->to)){
            return implode (", ",json_decode($this->emails)->to);
        }

    }
    public function getFormattedSentFailsAttribute(){
        $numbers=[];
        foreach ($this->sent_fails as $fail){
            $numbers[]=$fail->to_number;
        }
      return implode(', ',$numbers);
    }
    public function getFormattedEmailFromAttribute(){
        return json_decode($this->emails)->from;
    }

    public function sent_fails()
    {
        return $this->hasMany(SentFail::class);
    }
    public function campaign_tempate(){
        return $this->belongsTo(CampaignTemplate::class,'template_id')->withDefault();
    }

}