/** * Display the password reset view for the given token. * * @param string $token * @return \Response */ public function getReset($token = null) { if (is_null($token)) { App::abort(404); } $this->view('password.reset', ['token' => $token]); }
/** * Index action. * * @return mixed */ public function getIndex($type = null) { $container = Input::get('c'); $files = Input::get('files', ''); if (empty($type) || !in_array($type, array('style', 'script'))) { App::abort(404); } if (empty($container)) { App::abort(404); } $files = json_decode(base64_decode($files), true); if (empty($files) || !is_array($files)) { App::abort(404); } foreach ($files as $file) { Casset::container($container)->add(array_get($file, 'source'), array(), array_get($file, 'dependencies', array())); } $response = Response::make(Casset::container($container)->content($type)); if ('style' == $type) { $response->headers->set('Content-Type', 'text/css'); } else { $response->headers->set('Content-Type', 'application/json'); } return $response; }
/** * Display the password reset view for the given token. * * @param string $token * * @return Response */ public function getReset($token = null) { if (is_null($token)) { App::abort(404); } return View::make('password.reset')->with('token', $token); }
public function getImage($id, $type, $extension) { $coverType = Image::getImageTypeFromName($type); if ($coverType == null) { App::abort(404); } $image = Image::find($id); if (!$image) { App::abort(404); } $response = Response::make('', 200); $filename = $image->getFile($coverType['id']); if (!is_file($filename)) { $redirect = url('/images/icons/profile_' . Image::$ImageTypes[$coverType['id']]['name'] . '.png'); return Redirect::to($redirect); } if (Config::get('app.sendfile')) { $response->header('X-Sendfile', $filename); } else { $response->header('X-Accel-Redirect', $filename); } $response->header('Content-Disposition', "filename=\"ponyfm-i{$id}-{$type}.{$image->extension}\""); $response->header('Content-Type', $image->mime); $lastModified = filemtime($filename); $response->header('Last-Modified', $lastModified); $response->header('Cache-Control', 'max-age=' . 60 * 60 * 24 * 7); return $response; }
/** * Handle an incoming request. * * Check to see if ANY accounts have been setup. If they have, return a 404. This * should be used for requests that are only active when no accounts are available. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed */ public function handle($request, Closure $next) { if ($this->accountService->totalNumberOfAccounts()) { App::abort(404); } return $next($request); }
/** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * * @throws App * * @return mixed */ public function handle($request, Closure $next) { $is_auth = $this->authorizer->validateScopeOfMe($request); if ($is_auth['status'] != 'success') { App::abort(404); } return $next($request); }
public function salas() { $salas = Sala::all(); if (is_null($salas)) { App::abort(404); } return view('docente.versalas', compact('salas', 'campus')); }
public function asignar($id) { $campus = Campus::find($id); if (is_null($campus)) { App::abort(404); } return view('administrador.asignar', compact('campus')); }
public function editar($id) { $salas = Sala::find($id); if (is_null($salas)) { App::abort(404); } return view('encargado.edit', compact('salas')); }
public function handle($request, Closure $next) { $route_helper = App::make('route_perm_helper'); if (!$route_helper->hasPermForRoute(Route::currentRouteName())) { App::abort('401'); } return $next($request); }
/** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * * @throws App * * @return mixed */ public function handle($request, Closure $next) { $is_auth = json_decode($this->authorizer->inspectRequest($request), true); if ($is_auth['status'] != 'success') { App::abort(404); } return $next($request); }
public function handle($request, Closure $next, $permissions) { $admin = Auth::admin()->get(); if (!$admin->can(explode(',', $permissions))) { App::abort('404'); } return $next($request); }
public function getPublicProfile($username) { $lender = LenderQuery::create()->useUserQuery()->filterByUsername($username)->endUse()->findOne(); if (!$lender) { \Illuminate\Support\Facades\App::abort(404); } return View::make('lender.public-profile', compact('lender')); }
/** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * * @throws App * * @return mixed */ public function handle($request, Closure $next) { $is_allowed = json_decode($this->authorizer->validateSuperUser($request), true); if ($is_allowed['status'] != 'success') { App::abort(404); } return $next($request); }
/** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed */ public function handle($request, \Closure $next) { $locale = $this->request->segment(1) ?: App::getLocale(); $item = $this->menuItem->findByUriInLanguage($this->request->segment(2), $locale); if ($this->isOffline($item)) { App::abort(404); } return $next($request); }
public function getDocs($page = 'api-docs.json') { $path = head((array) config('latrell-swagger.output')) . DIRECTORY_SEPARATOR . $page; if (!file_exists($path)) { App::abort(404); } $content = file_get_contents($path); return Response::make($content)->header('Content-Type', 'application/json'); }
/** * Edit Form * * @param $id */ public function edit($id) { try { $menuType = $this->menuTypeRepo->findById($id); return $this->view('admin.pages.menu_type.edit', compact('menuType')); } catch (NotFoundException $e) { App::abort(404); } }
public function init($node, $method) { // FIXME: move paramter to config if (!$node->isActive(App::getLocale()) && !Input::has('show')) { App::abort(404); } $this->node = $node; return $this->{$method}(); }
public function show($slug) { $page = Page::slug($slug); if ($page) { return view('layouts.' . $page->layout->slug)->with('page', $page); } else { App::abort(404); } }
public function handle($request, Closure $next) { $permissions = array_slice(func_get_args(), 2); $authentication_helper = App::make('authentication_helper'); if (!$authentication_helper->hasPermission($permissions)) { App::abort('401'); } return $next($request); }
public function author($model) { if (Auth::user()->role == 'admin') { return true; } if ($model && $model->user_id != Auth::user()->id) { return App::abort(403); } }
/** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * * @throws App * * @return mixed */ public function handle($request, Closure $next, $role) { $request->merge(['role' => [$role]]); $is_allowed = $this->authorizer->validateRole($request); if ($is_allowed['status'] != 'success') { App::abort(404); } return $next($request); }
/** * @param $id * * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View * @internal param $slug */ public function show($id) { $user = $this->user; $ticket = $this->ticket->find($id); $comments = $this->getComments($ticket); if ($this->member && $this->member->company == $ticket->customer->company || $user->employee()) { return view('support.ticket.show', compact('ticket', 'comments', 'user')); } App::abort(403, 'Unauthorized action.'); }
private function showPattern($prefix, $view) { try { $journal = JournalDao::findByPrefix($prefix); } catch (NoElementException $e) { App::abort(404, 'Journal not found'); } $issueYears = EditionDao::listYears($journal->journal_id); return view($view)->with(array('journal' => $journal, 'issueYears' => $issueYears)); }
public function show($slug) { $posts = Post::withTopic($slug); $topic = Topic::where('slug', '=', $slug)->first(); if ($topic) { return view('topics.show')->with(['posts' => $posts, 'topic' => $topic]); } else { App::abort(404); } }
public function show($topicId) { try { $topic = TopicDao::findById($topicId); } catch (NoElementException $e) { App::abort(404, 'Topic not found'); } $articles = ArticleDao::findByTopicPaginated($topicId, self::PAGE_SIZE); return view('topic.details')->with(array('topic' => $topic, 'articles' => $articles)); }
/** * Display all of the given user's bios * * @return Response */ public function index($userId) { if ($userId != OAuthGuard::user()->id) { App::abort(404); } $return = OAuthGuard::user()->bios->map(function ($bio) { return new Bio($bio); }); return response()->jsonApi(['data' => $return]); }
public function search() { if (!Input::has('types') || !Input::has('term')) { return App::abort('404'); } $limit = Input::has('limit') ? intval(Input::get('limit')) : 5; $types = Input::get('types'); $term = Input::get('term'); $results = $this->getResults($types, $term, ['limit' => $limit]); return Response::json(['term' => $term, 'results' => $results])->setCallback(Input::get('callback')); }
public function show($authorId) { try { $author = AuthorDao::findById($authorId); } catch (NoElementException $e) { App::abort(404, 'Author not found'); } $articles = ArticleDao::findByAuthor($authorId); $articles = ArticleService::getEnrichedArticles($articles); return view('author.details')->with(array('author' => $author, 'articles' => $articles)); }
/** * Get image from storage * * @param Request $request * @return file */ public function getImage(Request $request) { /** * Check the cache */ $cacheKey = 'image:' . $request->imageName . ':' . $request->imageExtension; /** * File cached */ if (Cache::has($cacheKey)) { $imageMeta = Cache::get($cacheKey); } else { /** * Get META information */ $imageMeta = Image::where(['url' => $request->imageName, 'image_extension' => $request->imageExtension])->first(['image_mime_type', 'image_size', 'id', 'updated_at', 'image_etag']); /** * File does not exist */ if (empty($imageMeta) == TRUE) { App::abort(404); } /** * Save meta information to cache */ Cache::forever($cacheKey, $imageMeta); } /** * Get filename */ $filename = Helpers::getStorageFilename(env('APP_IMAGE_STORAGE_DIRECTORY', 'images'), $imageMeta->id); /** * Prepare stream */ $stream = Storage::readStream($filename); /** * File headers */ $headers = array('Content-Description' => 'File Transfer', 'Content-Type' => $imageMeta->image_mime_type, 'Content-Transfer-Encoding' => 'binary', 'Pragma' => 'public', 'Expires' => Carbon::createFromTimestamp(time() + 3600)->toRfc2822String(), 'Last-Modified' => $imageMeta->updated_at->toRfc2822String(), 'Etag' => $imageMeta->image_etag); /** * Response code cached */ if (isset($_SERVER['HTTP_IF_NONE_MATCH']) && $_SERVER['HTTP_IF_NONE_MATCH'] == $imageMeta->image_etag || isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && $_SERVER['HTTP_IF_MODIFIED_SINCE'] == $imageMeta->updated_at->toRfc2822String()) { $responseCode = 304; } else { $responseCode = 200; } /** * Stream to browser */ return Response::stream(function () use($stream) { fpassthru($stream); }, $responseCode, $headers); }