Mark ticket as complete.

@param int $id

@return Response
172540
public function complete($id)
    {
        if ($this->permToClose($id) == 'yes') {
            $ticket = $this->tickets->findOrFail($id);
            $ticket->completed_at = Carbon::now();

            if (Setting::grab('default_close_status_id')) {
                $ticket->status_id = Setting::grab('default_close_status_id');
            }

            $subject = $ticket->subject;
            $ticket->save();

            session()->flash('status', trans('ticketit::lang.the-ticket-has-been-completed', ['name' => $subject]));

            return redirect()->route(Setting::grab('main_route').'.index');
        }

        return redirect()->route(Setting::grab('main_route').'.index')
            ->with('warning', trans('ticketit::lang.you-are-not-permitted-to-do-this'));
    }
1230305
public function close($id)
	{
		$endpoint = new Close($this->getTransport());
		$endpoint->setId($id);

		try {
			$result = $endpoint->performRequest();
		} catch (ResourceNotFoundException $e) {
			return false;
		}

		return $result['status'] == 204;
	}
746442
public function show($id)
    {
        $data = $this->service->show($id);

        return $this->success($data);
    }
1071943
protected function __apiUpdate(string $id)
    {
        $record = Galleries::findOrFail($id);

        $data = $this->getInputData();

        $record->update(array_get($data, 'record'));
        $record->updateTranslations(array_get($data, 'translations'));
        $record->images()->sync(array_get($data, 'images'));


        return $this->apiShow($record->id);
    }
1302752
public function deleteAddonAction($id)
    {
        $this->getManager()->deleteById($id, true);

        $view = $this->view();

        return $this->handleView($view);
    }
654327
public function update($id)
    {
        try {
            $entry = $this->collection->findOne($id);
        } catch (Exception $e) {
            // noop
        }

        if (is_null($entry)) {
            return $this->app->notFound();
        }

        if ($this->request->isPost() || $this->request->isPut()) {
            try {
                $merged = array_merge(
                    isset($entry) ? $entry->dump() : array(),
                    $this->request->getBody() ?: array()
                );

                $entry->set($merged)->save();

                h('notification.info', $this->clazz.' updated');

                h('controller.update.success', array(
                    'model' => $entry,
                ));
            } catch (Stop $e) {
                throw $e;
            } catch (Exception $e) {
                h('notification.error', $e);

                if (empty($entry)) {
                    $model = null;
                }

                h('controller.update.error', array(
                    'error' => $e,
                    'model' => $entry,
                ));
            }
        }

        $this->data['entry'] = $entry;
    }
24611
public static function isAgent($id = null)
    {
        if (isset($id)) {
            $user = User::find($id);
            if ($user->ticketit_agent) {
                return true;
            }

            return false;
        }
        if (auth()->check()) {
            if (auth()->user()->ticketit_agent) {
                return true;
            }
        }
    }
654755
public function cancel_payment($id) {
        $request = array(
            "uri" => "/v1/payments/{$id}",
            "params" => array(
                "access_token" => $this->get_access_token()
            ),
            "data" => array(
                "status" => "cancelled"
            )
        );

        $response = MPRestClient::put($request);
        return $response;
    }
981730
public function destroy($id)
    {
        $priority = Priority::findOrFail($id);
        $name = $priority->name;
        $priority->delete();

        Session::flash('status', trans('ticketit::lang.priority-name-has-been-deleted', ['name' => $name]));

        \Cache::forget('ticketit::priorities');

        return redirect()->action('\Kordy\Ticketit\Controllers\PrioritiesController@index');
    }
559875
public function update(Request $request, $id)
    {
        $this->validate($request, [
            'subject'     => 'required|min:3',
            'content'     => 'required|min:6',
            'priority_id' => 'required|exists:ticketit_priorities,id',
            'category_id' => 'required|exists:ticketit_categories,id',
            'status_id'   => 'required|exists:ticketit_statuses,id',
            'agent_id'    => 'required',
        ]);

        $ticket = $this->tickets->findOrFail($id);

        $ticket->subject = $request->subject;

        $ticket->setPurifiedContent($request->get('content'));

        $ticket->status_id = $request->status_id;
        $ticket->category_id = $request->category_id;
        $ticket->priority_id = $request->priority_id;

        if ($request->input('agent_id') == 'auto') {
            $ticket->autoSelectAgent();
        } else {
            $ticket->agent_id = $request->input('agent_id');
        }

        $ticket->save();

        session()->flash('status', trans('ticketit::lang.the-ticket-has-been-modified'));

        return redirect()->route(Setting::grab('main_route').'.show', $id);
    }
279652
public function refund_payment($id) {
        $request = array(
            "uri" => "/v1/payments/{$id}/refunds",
            "params" => array(
                "access_token" => $this->get_access_token()
            )
        );

        $response = MPRestClient::post($request);
        return $response;
    }
208599
public function show($id)
    {
        $forward = $this->client->get(
            sprintf('buckets/%d/inbox_forwards/%d.json', $this->bucket, $id)
        );

        return new Forward($this->response($forward));
    }
288188
public function edit($id)
    {
        $entry = $this->entriesRepository->getById($id, $this->resource);

        return view('laramanager::entries.edit')
            ->with('resource', $this->resource)
            ->with('entry', $entry);
    }
524410
public function destroy($id)
    {
        $ticket = $this->tickets->findOrFail($id);
        $subject = $ticket->subject;
        $ticket->delete();

        session()->flash('status', trans('ticketit::lang.the-ticket-has-been-deleted', ['name' => $subject]));

        return redirect()->route(Setting::grab('main_route').'.index');
    }
338148
public function getLastPage($id = null)
    {
        $totalItems = ($this->getTotalItems($id) > 0) ? $this->getTotalItems($id) : 1;
        return (int)ceil($totalItems / $this->getItemsPerPage($id));
    }
1132585
protected function __apiUpdate (string $id)
    {
        $record = HCGroups::findOrFail ($id);

        $data = $this->getInputData ();

        $record->update (array_get ($data, 'record', []));
        $record->users()->sync(array_get($data, 'users'));

        return $this->apiShow ($record->id);
    }
1283825
public function actionEdit(int $id): void
	{
		$this->page = $this->orm->pages->getById($id);
		if (!$this->page) {
			$this->error();
		}

		$gallery = $this['gallery'];
		$gallery->setStorage($this->orm->pagesGalleries);
		$gallery->setForeignKey('page', $this->page->id);
		$gallery->setNamespace('page/' . $this->page->url);
	}