{"action":"created","issue":{"url":"https://api.github.com/repos/serverfireteam/panel/issues/106","labels_url":"https://api.github.com/repos/serverfireteam/panel/issues/106/labels{/name}","comments_url":"https://api.github.com/repos/serverfireteam/panel/issues/106/comments","events_url":"https://api.github.com/repos/serverfireteam/panel/issues/106/events","html_url":"https://github.com/serverfireteam/panel/issues/106","id":106980105,"number":106,"title":"Creating a crud","user":{"login":"MehmetOzkose","id":10828731,"avatar_url":"https://avatars.githubusercontent.com/u/10828731?v=3","gravatar_id":"","url":"https://api.github.com/users/MehmetOzkose","html_url":"https://github.com/MehmetOzkose","followers_url":"https://api.github.com/users/MehmetOzkose/followers","following_url":"https://api.github.com/users/MehmetOzkose/following{/other_user}","gists_url":"https://api.github.com/users/MehmetOzkose/gists{/gist_id}","starred_url":"https://api.github.com/users/MehmetOzkose/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MehmetOzkose/subscriptions","organizations_url":"https://api.github.com/users/MehmetOzkose/orgs","repos_url":"https://api.github.com/users/MehmetOzkose/repos","events_url":"https://api.github.com/users/MehmetOzkose/events{/privacy}","received_events_url":"https://api.github.com/users/MehmetOzkose/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-09-17T13:07:46Z","updated_at":"2015-09-19T11:34:43Z","closed_at":null,"body":"I am newbie to Laravel. I have two mysql tables named galleries and gallery_images. No problem with the  galleries crud.But i want to show the gallery_images related to galleries, when a gallery name clicked in crud.\r\nDo I have to create seperate files out of laravelpanel or is there an easy way to solve this problem in laravelpanel?\r\nThanks to everyone.\r\n"},"comment":{"url":"https://api.github.com/repos/serverfireteam/panel/issues/comments/141653530","html_url":"https://github.com/serverfireteam/panel/issues/106#issuecomment-141653530","issue_url":"https://api.github.com/repos/serverfireteam/panel/issues/106","id":141653530,"user":{"login":"alenoosh","id":13883,"avatar_url":"https://avatars.githubusercontent.com/u/13883?v=3","gravatar_id":"","url":"https://api.github.com/users/alenoosh","html_url":"https://github.com/alenoosh","followers_url":"https://api.github.com/users/alenoosh/followers","following_url":"https://api.github.com/users/alenoosh/following{/other_user}","gists_url":"https://api.github.com/users/alenoosh/gists{/gist_id}","starred_url":"https://api.github.com/users/alenoosh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alenoosh/subscriptions","organizations_url":"https://api.github.com/users/alenoosh/orgs","repos_url":"https://api.github.com/users/alenoosh/repos","events_url":"https://api.github.com/users/alenoosh/events{/privacy}","received_events_url":"https://api.github.com/users/alenoosh/received_events","type":"User","site_admin":false},"created_at":"2015-09-19T11:34:43Z","updated_at":"2015-09-19T11:34:43Z","body":"@MehmetOzkose Ok as I've understood you want to create a relation between two cruds, it's not straightforward but to do that you should : \r\n\r\n1) add a link in your 'galleries' crud : \r\n```\r\n\t$imagesUrl = url('/panel/galleryImages/all?id={{ $id }}');\r\n\t$this->grid->add('<a href=\"' . $imagesUrl . '\">View Gallery Images</a>', '');\r\n```\r\n\r\n2) Then create the galleryImages crud and remove this crud from the 'links' table.\r\n\r\n3) Then in your galleryImages crud you have to add a condition to list just the images of that specific gallery : \r\n````\r\n        $imagesFilter = \\App\\galleryImages::with('galleries');               \r\n        $this->filter = \\DataFilter::source($imagesFilter);\r\n        \r\n        $images = \\App\\galleryImages::whereHas('galleries', function($q) {\r\n            $q->where('id', '=', \\Input::get('id')); // id of gallery\r\n        })->with('galleries');\r\n\r\n\t$this->filter = \\DataFilter::source($images);\r\n        .\r\n        .\r\n````\r\n4) You also should edit the 'Add' button in 'galleryImages' crud to include the 'gallery_id' parameter and then in edit section of galleryImages crud, you should pass the gallery_id as a hidden parameter to get that parameter and save it : \r\n``````\r\n\t$this->edit->add('gallery_id', '', 'hidden')->insertValue(\\Input::get('id'));\r\n`````\r\n\r\n\r\n\r\n"}}