/** * Returns a new Issue table. * * @param Issue|Builder $issue * @param array $with * @param Closure $closure * * @return \Orchestra\Contracts\Html\Builder */ public function table($issue, array $with = ['users', 'labels'], Closure $closure = null) { $label = request('label'); // Filter issues with the specified request label. $issue->with($with)->label($label)->latest(); return $this->table->of('issues', function (TableGrid $table) use($issue, $closure) { if ($closure instanceof Closure) { $table = call_user_func($closure, $table, $issue); } else { $table->with($issue)->paginate($this->perPage); } $table->sortable(['title', 'description', 'created_at']); $table->searchable(['title', 'description']); $table->column('status', function (Column $column) { $column->label = ''; $column->value = function (Issue $issue) { return $issue->present()->statusIcon(); }; $column->attributes(function () { return ['width' => '30']; }); }); $table->column('title', function (Column $column) { return $this->tableTitle($column); }); }); }
/** * Displays the issue. * * @param int|string $id * * @return \Illuminate\View\View */ public function show($id) { $with = ['comments', 'comments.revisions', 'comments.files', 'labels', 'revisions', 'files']; $issue = $this->issue->with($with)->findOrFail($id); $this->authorize('issues.show', [$issue]); $resolution = $issue->comments->first(function ($key, $comment) { return $comment->resolution; }); $formComment = $this->presenter->formComment($issue); $formLabels = $this->presenter->formLabels($issue); $formUsers = $this->presenter->formUsers($issue); return view('pages.issues.show', compact('issue', 'resolution', 'formComment', 'formLabels', 'formUsers')); }