Answer the question
In order to leave comments, you need to log in
Laravel how to make elegant has many?
There is a model, it has a one-to-many relationship through a global variable model code:
<?php namespace My\Trading\Models;
use Model;
/**
* Model
*/
class Groups extends Model
{
use \October\Rain\Database\Traits\Validation;
/*
* Validation
*/
public $rules = [
];
/*
* Disable timestamps by default.
* Remove this line if timestamps are defined in the database table.
*/
public $timestamps = true;
/**
* @var string The database table used by the model.
*/
public $table = 'trading_groups';
public $hasMany = [
'statistics' => ['\My\Trading\Models\Statistics', 'key' => 'groups_id'],
];
}
(new Groups)->hasMany('\My\Trading\Models\Statistics');
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question