App\Http\Controllers\DraftController::index PHP Method

index() public method

public index ( )
    public function index()
    {
        if (Auth::guest() !== true) {
            $drafts = XeDraft::get(Input::get('key'));
            if (!empty($drafts)) {
                uasort($drafts, function ($a, $b) {
                    if ($a->createdAt == $b->createdAt) {
                        return 0;
                    }
                    return $a->createdAt < $b->createdAt ? 1 : -1;
                });
            }
            return XePresenter::makeApi($drafts);
        }
    }