winter
winter copied to clipboard
Support arbitrary depth of depends on
Depends on with One to Many supported.
Create Plugin, Model and Controller
php artisan create:plugin Meesiris.Plan
php artisan create:model Meesiris.Plan Dependency
php artisan create:controller Meesiris.Plan Dependencies
create_dependencies_table.php
<?php namespace Meesiris\Plan\Updates;
use Schema;
use Winter\Storm\Database\Schema\Blueprint;
use Winter\Storm\Database\Updates\Migration;
class CreateDependenciesTable extends Migration
{
public function up()
{
Schema::create('meesiris_plan_dependencies', function (Blueprint $table) {
$table->engine = 'InnoDB';
$table->increments('id');
$table->string('cus_name');
$table->integer('per_income_per_day')->nullable();
$table->integer('per_income_per_month')->nullable();
$table->integer('per_income_per_year')->nullable();
$table->integer('per_income_total')->nullable();
$table->integer('per_expense_per_day')->nullable();
$table->integer('per_expense_per_month')->nullable();
$table->integer('per_expense_per_year')->nullable();
$table->integer('per_expense_total')->nullable();
$table->integer('per_balance_total')->nullable();
$table->integer('fam_income_per_day')->nullable();
$table->integer('fam_income_per_month')->nullable();
$table->integer('fam_income_per_year')->nullable();
$table->integer('fam_income_total')->nullable();
$table->integer('fam_expense_per_day')->nullable();
$table->integer('fam_expense_per_month')->nullable();
$table->integer('fam_expense_per_year')->nullable();
$table->integer('fam_expense_total')->nullable();
$table->integer('fam_balance_total')->nullable();
$table->integer('all_balance_total')->nullable();
$table->integer('all_income_total')->nullable();
$table->integer('all_expense_total')->nullable();
$table->integer('all_income_per_day')->nullable();
$table->integer('all_income_per_week')->nullable();
$table->integer('all_income_per_month')->nullable();
$table->integer('all_income_per_year')->nullable();
$table->integer('all_expense_per_day')->nullable();
$table->integer('all_expense_per_week')->nullable();
$table->integer('all_expense_per_month')->nullable();
$table->integer('all_expense_per_year')->nullable();
$table->timestamps();
});
}
public function down()
{
Schema::dropIfExists('meesiris_plan_dependencies');
}
}
Model: Dependency.php
<?php namespace Meesiris\Plan\Models;
use Model;
/**
* Dependency Model
*/
class Dependency extends Model
{
use \Winter\Storm\Database\Traits\Validation;
/**
* @var string The database table used by the model.
*/
public $table = 'meesiris_plan_dependencies';
/**
* @var array Guarded fields
*/
protected $guarded = ['*'];
/**
* @var array Fillable fields
*/
protected $fillable = [];
/**
* @var array Validation rules for attributes
*/
public $rules = [];
/**
* @var array Attributes to be cast to native types
*/
protected $casts = [];
/**
* @var array Attributes to be cast to JSON
*/
protected $jsonable = [];
/**
* @var array Attributes to be appended to the API representation of the model (ex. toArray())
*/
protected $appends = [];
/**
* @var array Attributes to be removed from the API representation of the model (ex. toArray())
*/
protected $hidden = [];
/**
* @var array Attributes to be cast to Argon (Carbon) instances
*/
protected $dates = [
'created_at',
'updated_at'
];
/**
* @var array Relations
*/
public $hasOne = [];
public $hasMany = [];
public $hasOneThrough = [];
public $hasManyThrough = [];
public $belongsTo = [];
public $belongsToMany = [];
public $morphTo = [];
public $morphOne = [];
public $morphMany = [];
public $attachOne = [];
public $attachMany = [];
public function getPerIncomeTotalAttribute()
{
$result = ($this->per_income_per_day*365)
+($this->per_income_per_week*52)
+($this->per_income_per_month*12)
+($this->per_income_per_year*1);
return $result;
}
public function getPerExpenseTotalAttribute()
{
$result = ($this->per_expense_per_day*365)
+($this->per_expense_per_week*52)
+($this->per_expense_per_month*12)
+($this->per_expense_per_year*1);
return $result;
}
public function getPerBalanceTotalAttribute()
{
return $this->per_income_total-$this->per_expense_total;
}
public function getFamIncomeTotalAttribute()
{
$result = ($this->fam_income_per_day*365)
+($this->fam_income_per_week*52)
+($this->fam_income_per_month*12)
+($this->fam_income_per_year*1);
return $result;
}
public function getFamExpenseTotalAttribute()
{
$result = ($this->fam_expense_per_day*365)
+($this->fam_expense_per_week*52)
+($this->fam_expense_per_month*12)
+($this->fam_expense_per_year*1);
return $result;
}
public function getFamBalanceTotalAttribute()
{
return $this->fam_income_total-$this->fam_expense_total;
}
public function getAllBalanceTotalAttribute()
{
return $this->per_balance_total+$this->fam_balance_total;
}
public function getAllIncomeTotalAttribute()
{
return $this->per_income_total+$this->fam_income_total;
}
public function getAllExpenseTotalAttribute()
{
return $this->per_expense_total+$this->fam_expense_total;
}
public function getAllIncomePerDayAttribute()
{
return $this->all_income_total/365;
}
public function getAllIncomePerWeekAttribute()
{
return $this->all_income_total/52;
}
public function getAllIncomePerMonthAttribute()
{
return $this->all_income_total/12;
}
public function getAllIncomePerYearAttribute()
{
return $this->all_income_total/1;
}
public function getAllExpensePerDayAttribute()
{
return $this->all_expense_total/365;
}
public function getAllExpensePerWeekAttribute()
{
return $this->all_expense_total/52;
}
public function getAllExpensePerMonthAttribute()
{
return $this->all_expense_total/12;
}
public function getAllExpensePerYearAttribute()
{
return $this->all_expense_total/1;
}
}
columns.yaml
columns:
cus_name:
label: cus_name
type: text
all_balance_total:
label: all_balance_total
type: number
fields.yaml
# ===================================
# Form Field Definitions
# ===================================
fields:
cus_name:
label: Customer Name
type: text
span: left
per_income_per_day:
label: Personal income per day
type: number
span: left
per_income_per_month:
label: Personal income per month
type: number
span: left
per_income_per_year:
label: Personal income per year
type: number
span: left
per_income_total:
label: Personal income total
type: number
span: left
dependsOn:
- per_income_per_day
- per_income_per_month
- per_income_per_year
readOnly: true
per_expense_per_day:
label: Personal expense per day
type: number
span: left
per_expense_per_month:
label: Personal expense per month
type: number
span: left
per_expense_per_year:
label: Personal expense per year
type: number
span: left
per_expense_total:
label: Personal expense total
type: number
span: left
dependsOn:
- per_expense_per_day
- per_expense_per_month
- per_expense_per_year
readOnly: true
per_balance_total:
label: Personal balance total
type: number
span: left
dependsOn:
- per_income_total
- per_expense_total
readOnly: true
fam_income_per_day:
label: Family income per day
type: number
span: left
fam_income_per_month:
label: Family income per month
type: number
span: left
fam_income_per_year:
label: Family income per year
type: number
span: left
fam_income_total:
label: Family income total
type: number
span: left
dependsOn:
- fam_income_per_day
- fam_income_per_month
- fam_income_per_year
readOnly: true
fam_expense_per_day:
label: Family expense per day
type: number
span: left
fam_expense_per_month:
label: Family expense per month
type: number
span: left
fam_expense_per_year:
label: Family expense per year
type: number
span: left
fam_expense_total:
label: Family expense total
type: number
span: left
dependsOn:
- fam_expense_per_day
- fam_expense_per_month
- fam_expense_per_year
readOnly: true
fam_balance_total:
label: Family balance total
type: number
span: left
dependsOn:
- fam_income_total
- fam_expense_total
readOnly: true
all_income_total:
label: All income total
type: number
span: left
dependsOn:
- per_income_total
- fam_income_total
readOnly: true
all_expense_total:
label: All expense total
type: number
span: left
dependsOn:
- per_expense_total
- fam_expense_total
readOnly: true
all_balance_total:
label: All balance total
type: number
span: left
dependsOn:
- per_balance_total
- fam_balance_total
readOnly: true
all_income_per_day:
label: All income per day
type: number
span: left
dependsOn:
- all_income_total
readOnly: true
all_income_per_week:
label: All income per week
type: number
span: left
dependsOn:
- all_income_total
readOnly: true
all_income_per_month:
label: All income per month
type: number
span: left
dependsOn:
- all_income_total
readOnly: true
all_income_per_year:
label: All income per year
type: number
span: left
dependsOn:
- all_income_total
readOnly: true
all_expense_per_day:
label: All expense per day
type: number
span: left
dependsOn:
- all_expense_total
readOnly: true
all_expense_per_week:
label: All expense per week
type: number
span: left
dependsOn:
- all_expense_total
readOnly: true
all_expense_per_month:
label: All expense per month
type: number
span: left
dependsOn:
- all_expense_total
readOnly: true
all_expense_per_year:
label: All expense per year
type: number
span: left
dependsOn:
- all_expense_total
readOnly: true
Refresh Plugin for create dependencies table.
php artisan plugin:refresh Meesiris.Plan
@meesiris thanks for the PR. We're prioritising finishing off 1.1.3 and releasing the website and marketplace. Once these are done, we'll be happy to consider implementing this.
We'll be in touch soon.
This pull request will be closed and archived in 3 days, as there has been no activity in the last 60 days. If this is still being worked on, please respond and we will re-open this pull request. If this pull request is critical to your business, consider joining the Premium Support Program where a Service Level Agreement is offered.
This pull request will be closed and archived in 3 days, as there has been no activity in the last 60 days. If this is still being worked on, please respond and we will re-open this pull request. If this pull request is critical to your business, consider joining the Premium Support Program where a Service Level Agreement is offered.
This pull request will be closed and archived in 3 days, as there has been no activity in the last 60 days. If this is still being worked on, please respond and we will re-open this pull request. If this pull request is critical to your business, consider joining the Premium Support Program where a Service Level Agreement is offered.
This pull request will be closed and archived in 3 days, as there has been no activity in the last 60 days. If this is still being worked on, please respond and we will re-open this pull request. If this pull request is critical to your business, consider joining the Premium Support Program where a Service Level Agreement is offered.
This pull request will be closed and archived in 3 days, as there has been no activity in the last 60 days. If this is still being worked on, please respond and we will re-open this pull request. If this pull request is critical to your business, consider joining the Premium Support Program where a Service Level Agreement is offered.
This pull request will be closed and archived in 3 days, as there has been no activity in the last 60 days. If this is still being worked on, please respond and we will re-open this pull request. If this pull request is critical to your business, consider joining the Premium Support Program where a Service Level Agreement is offered.
@meesiris was there an issue associated with this PR?
@LukeTowers Please review issues from following link.
https://octobercms.com/forum/post/two-level-dependson-function
https://github.com/octobercms/october/pull/5519
@meesiris looks like those issues were fixed by #34 in https://github.com/wintercms/winter/commit/712843d3c231432cefcc3fd5728518e43f73cd33. What's the key issue with the original approach in #34 that makes it so that this PR is required? I think I have a grasp of what's going on here but if you could restate the problem as simply as possible that would be helpful and then I should be able to merge this.
This pull request will be closed and archived in 3 days, as there has been no activity in this pull request for the last 6 months. If you intend to continue working on this pull request, please respond within 3 days. If this pull request is critical for your business, please reach out to us at [email protected].
This pull request will be closed and archived in 3 days, as there has been no activity in this pull request for the last 6 months. If you intend to continue working on this pull request, please respond within 3 days. If this pull request is critical for your business, please reach out to us at [email protected].
This pull request will be closed and archived in 3 days, as there has been no activity in this pull request for the last 6 months. If you intend to continue working on this pull request, please respond within 3 days. If this pull request is critical for your business, please reach out to us at [email protected].
@meesiris (or anyone) did you have a response for https://github.com/wintercms/winter/pull/69#issuecomment-1104494657? I'm not opposed to merging this but if no one currently cares then I won't bother at the moment and will just let the bot close it.
@LukeTowers This PR enhancement of https://github.com/wintercms/winter/pull/34/
@meesiris you didn't respond to my comment.
@meesiris you didn't respond to my comment.
@LukeTowers This PR enhancement of https://github.com/wintercms/winter/pull/34/. It will loop in deep more than https://github.com/wintercms/winter/pull/34/.