{"action":"created","issue":{"url":"https://api.github.com/repos/FrozenNode/Laravel-Administrator/issues/956","labels_url":"https://api.github.com/repos/FrozenNode/Laravel-Administrator/issues/956/labels{/name}","comments_url":"https://api.github.com/repos/FrozenNode/Laravel-Administrator/issues/956/comments","events_url":"https://api.github.com/repos/FrozenNode/Laravel-Administrator/issues/956/events","html_url":"https://github.com/FrozenNode/Laravel-Administrator/issues/956","id":119362358,"number":956,"title":"Everything is ok except constraints not work","user":{"login":"vFire","id":15304028,"avatar_url":"https://avatars.githubusercontent.com/u/15304028?v=3","gravatar_id":"","url":"https://api.github.com/users/vFire","html_url":"https://github.com/vFire","followers_url":"https://api.github.com/users/vFire/followers","following_url":"https://api.github.com/users/vFire/following{/other_user}","gists_url":"https://api.github.com/users/vFire/gists{/gist_id}","starred_url":"https://api.github.com/users/vFire/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vFire/subscriptions","organizations_url":"https://api.github.com/users/vFire/orgs","repos_url":"https://api.github.com/users/vFire/repos","events_url":"https://api.github.com/users/vFire/events{/privacy}","received_events_url":"https://api.github.com/users/vFire/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/FrozenNode/Laravel-Administrator/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-11-29T14:23:16Z","updated_at":"2015-12-19T17:08:58Z","closed_at":null,"body":"Enviorment:\r\nLaravel 5.1\r\nLaravel-Administrator 5.0.5 / Also tested with src replacement with 5.0.8, both don't work\r\n\r\n---------------------------------------------------\r\nPart of Config File:\r\n---------------------------------------------------\r\n```javascript\r\n\t'edit_fields' => [\r\n\t\t'maincategory' => [\r\n\t\t\t'title' => 'Main Category',\r\n\t\t\t'type' => 'relationship',\r\n\t\t\t'name_field' => \"title\",\r\n\t\t\t'constraints' => array('subcategory' => 'mainCategories'),\r\n\t\t],\r\n\t\t'subcategory' => [\r\n\t\t\t'title' => 'Sub Category',\r\n\t\t\t'type' => 'relationship',\r\n\t\t\t'name_field' => \"title\",\r\n\t\t\t'constraints' => array('maincategory' => 'subCategories'),\r\n\t\t],\r\n\t]\r\n```\r\n---------------------------------------------------\r\nPart of Model File **ProductMainCategory**:\r\n---------------------------------------------------\r\n```php\r\n<?php\r\nnamespace App\\Models;\r\nuse Illuminate\\Database\\Eloquent\\Model;\r\n\r\nclass ProductMainCategory extends Model {\r\n\r\n\tpublic function products(){\r\n\t\treturn $this->hasMany('App\\Models\\Product', 'main_category_id');\r\n\t}\r\n\r\n\tpublic function subCategories(){\r\n\t\treturn $this->hasMany('App\\Models\\ProductSubCategory', 'main_category_id');\r\n\t}\r\n\r\n}\r\n```\r\n---------------------------------------------------\r\nPart of Model File **ProductSubCategory**:\r\n---------------------------------------------------\r\n```php\r\n<?php\r\nnamespace App\\Models;\r\nuse Illuminate\\Database\\Eloquent\\Model;\r\n\r\nclass ProductSubCategory extends Model {\r\n\r\n\tpublic function products(){\r\n\t\treturn $this->hasMany('App\\Models\\Product', 'sub_category_id');\r\n\t}\r\n\r\n\tpublic function mainCategory(){\r\n\t\treturn $this->belongsTo('App\\Models\\ProductMainCategory', 'main_category_id');\r\n\t}\r\n\r\n}\r\n```\r\n---------------------------------------------------\r\nPart of Model File **Product**:\r\n---------------------------------------------------\r\n```php\r\n<?php\r\nnamespace App\\Models;\r\nuse Illuminate\\Database\\Eloquent\\Model;\r\n\r\nclass Product extends Model {\r\n\r\n\tpublic static $rules = [\r\n\t\t'title' => 'required|max:30',\r\n\t\t'seasons' => 'required',\r\n\t];\r\n\r\n\tpublic function mainCategory(){\r\n\t\treturn $this->belongsTo('App\\Models\\ProductMainCategory', 'main_category_id');\r\n\t}\r\n\r\n\tpublic function subCategory(){\r\n\t\treturn $this->belongsTo('App\\Models\\ProductSubCategory', 'sub_category_id');\r\n\t}\r\n\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/FrozenNode/Laravel-Administrator/issues/comments/166004535","html_url":"https://github.com/FrozenNode/Laravel-Administrator/issues/956#issuecomment-166004535","issue_url":"https://api.github.com/repos/FrozenNode/Laravel-Administrator/issues/956","id":166004535,"user":{"login":"vFire","id":15304028,"avatar_url":"https://avatars.githubusercontent.com/u/15304028?v=3","gravatar_id":"","url":"https://api.github.com/users/vFire","html_url":"https://github.com/vFire","followers_url":"https://api.github.com/users/vFire/followers","following_url":"https://api.github.com/users/vFire/following{/other_user}","gists_url":"https://api.github.com/users/vFire/gists{/gist_id}","starred_url":"https://api.github.com/users/vFire/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vFire/subscriptions","organizations_url":"https://api.github.com/users/vFire/orgs","repos_url":"https://api.github.com/users/vFire/repos","events_url":"https://api.github.com/users/vFire/events{/privacy}","received_events_url":"https://api.github.com/users/vFire/received_events","type":"User","site_admin":false},"created_at":"2015-12-19T17:08:58Z","updated_at":"2015-12-19T17:08:58Z","body":"Yes, when I change the maincategory, the subcategory values do get correctly, but maybe the bug of javascript especially of select2(maybe the version is too old), I can't render it correctly.Nothing happened, but I do find the result fetched correctly.\r\n\r\nAs for contraints in filter, seedmed not work, when I try to change the options, seemed the event not been triggered. A very useful function,hope to be repair soon, if possible maybe you can give me more info about the location of related code, I can try to work on it."}}