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