/** * Show the form for editing the specified resource. * * @param Category $category * @return Response */ public function edit(Category $category) { // $groups = Role::lists('name', 'id'); $accessCategoryIds = CategoryPermission::where('category_id', '=', $category->id)->where('permission_id', '=', 20)->lists('role_id', 'role_id'); $createThreadIds = CategoryPermission::where('category_id', '=', $category->id)->where('permission_id', '=', 1)->lists('role_id', 'role_id'); $replyIds = CategoryPermission::where('category_id', '=', $category->id)->where('permission_id', '=', 6)->lists('role_id', 'role_id'); $createThreadIds = array_except($createThreadIds, [2]); $replyIds = array_except($replyIds, [2]); return view('core.admin.forums.permission-editor.category.edit', array('category' => $category, 'accessCategory' => $accessCategoryIds, 'createThread' => $createThreadIds, 'reply' => $replyIds, 'groups' => $groups)); }
/** * Show the form for editing the specified resource. * * @param Channel $channel * @return Response */ public function edit(Channel $channel) { // $groups = Role::lists('name', 'id'); $createThreadIds = ChannelPermission::where('channel_id', '=', $channel->id)->where('permission_id', '=', 1)->lists('role_id', 'role_id'); $accessChannelIds = ChannelPermission::where('channel_id', '=', $channel->id)->where('permission_id', '=', 21)->lists('role_id', 'role_id'); $replyIds = ChannelPermission::where('channel_id', '=', $channel->id)->where('permission_id', '=', 6)->lists('role_id', 'role_id'); $createThreadIds = collect($createThreadIds); $createThreadIds = $createThreadIds->filter(function ($item) { return $item != 2; }); $replyIds = collect($replyIds); $replyIds = $replyIds->filter(function ($item) { return $item != 2; }); return view('core.admin.forums.permission-editor.channel.edit', array('channel' => $channel, 'accessChannel' => $accessChannelIds, 'createThread' => $createThreadIds->toArray(), 'reply' => $replyIds->toArray(), 'groups' => $groups)); }