?
Current File : /home/sanghavirealty/public_html/appazwer/Models/Profile.php
<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

use Auth;
use Storage;

class Profile extends Model
{
    use HasFactory;


    public $table="membertbl";

    const CREATED_AT = 'createdate';
    const UPDATED_AT = 'modifydate';

    protected $dates = [
        'dob', ];



        public function getAuthorMemberTitle()
        {
                return $this->hasOne(Blog::class, 'createby','id');
        }


        public function getCommentMemberTitle()
        {
          return $this->hasOne(Comment::class, 'createby','id');
        }



    

    public static function getProfileData (){

        //works for both the users
        
        $GetProfileName = Profile::Where('currentstatus',0)
        ->Where('createby',Auth::user()->id)
        ->first();
        
        
        // dd($GetProfileName);
        
        if($GetProfileName !== null ) {
        
        $SendName = $GetProfileName ;
        
        }else {
        
          $SendName = Auth::user() ;
        
        } 
        
        
        return $SendName ;
        
        }




}