MOON
Server: Apache
System: Linux e2e-78-16.ssdcloudindia.net 3.10.0-1160.45.1.el7.x86_64 #1 SMP Wed Oct 13 17:20:51 UTC 2021 x86_64
User: imensosw (1005)
PHP: 7.4.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: /home/imensosw/www/ezwork/app/Models/UserBankAccount.php
<?php

/**
 * UserBankAccountModel class file
 *
 * PHP Version 7.2
 *
 * @category Model
 * @package  Ez
 * @author   Imenso Software <admin@imensosoftware.com>
 * @license  http://imensosoftware/license.php GNU Public License
 * @link     http://imensosoftware.com/recipes
 */

namespace App\Models;
  
use Illuminate\Database\Eloquent\Model;
use DB;

/**
 * UserBankAccountModel class
 *
 * The class manage User Bank Account related queries
 *
 * @category UserBankAccountModel
 * @package  Ez
 * @author   Imenso Software <admin@imensosoftware.com>
 * @license  http://imensosoftware/license.php GNU Public License
 * @link     http://imensosoftware.com/recipes
 */

class UserBankAccount extends Model
{

    public $table = 'user_bank_accounts';

    public $fillable = [
        'user_id',
        'status_id',
        'bank_name',
        'beneficiary_name',
        'account_no',
        'ifsc_code',
        'branch_address',
        'bank_proof_type_id',
        'bank_proof_file',
        'paypal_id',
        'payment_method_type_id',
        'is_primary',
        'delete_status_id'
    ];

    public $timestamps = false;


    /**
     * GetUserBankAccounts gets the bank account details of specified user
     * and return user bank details.
     *
     * @param  array data
     * @return \App\Models\UserBankAccount
     */
    public static function getUserBankAccounts($data)
    {
        $user_id = $data['user_id'];
        return self::select(
            'user_bank_accounts.*',
            'user_bank_accounts.status_id as account_status_id',
            'payment_method_types.payment_method_type'
        )
            ->join(
                'payment_method_types',
                'payment_method_types.id',
                '=',
                'user_bank_accounts.payment_method_type_id'
            )
            ->where('user_bank_accounts.user_id', $user_id)
            ->orderBy('is_primary', 'desc')->get();
    }
    //  end getUserBankAccounts()
}
//  end class