This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

ljwjulian37073
ljwjulian37073

I have 'PaymentData' model and 'AppsData' model. They both have 'mem_id' column and I want to get the 'app_process' column's values from 'AppsData' model based on the 'PaymentData' model's data.

What I tried below causes this error message.

"SQLSTATE[42S22]: Column not found: 1054 Unknown column 'app_process' in 'where clause' (SQL: select count(*) as aggregate from BYAPPS_apps_payment_data where pay_type != 1 and amount = 0 and app_process != 8)" on line 664 of /home/ljw/public_html/byapps_cms/vendor/laravel/framework/src/Illuminate/Database/Connection.php

PaymentData model

class PaymentData extends Model
{
    use \October\Rain\Database\Traits\Validation;

    public $table = 'BYAPPS_apps_payment_data';

    public $rules = [
    ];

    public $hasOne = [
      'joins' => [
        'Jiwon\Byapps\Models\AppsData',
        'key' => 'mem_id',
        'otherKey' => 'mem_id'
      ]
    ];
}

AppsData model

class AppsData extends Model
{
    use \October\Rain\Database\Traits\Validation;

    public $table = 'BYAPPS_apps_data';

    public $rules = [
    ];
}

what I tried in home.htm

use Jiwon\Byapps\Models\AppsData;
use Jiwon\Byapps\Models\PaymentData;

function onGetAppChartData()
{

  $this['appsFree'] = PaymentData::where('pay_type', '!=', '1')
                      ->where('amount', '=', '0')
                      ->where('app_process', '!=', '8')
                      ->count();
}

What did I wrong here? Please, help me...!_!

1-1 of 1

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.