laravel-routing

Laravel : How to hide url parameter?

风流意气都作罢 提交于 2019-11-27 16:45:45
问题 Here the scenario is I want to pass a variable which will be send from one page to another and in next page it's gonna store through a form. So I have passed the variable from first page to second page through the URL. But I want to hide the parameter in the URL. How do I do it? Here is my route : Route::get('/registration/{course_id}',[ 'uses'=>'AppController@getregistration', 'as'=>'registration' ]); And Controller : public function getregistration($course_id) { return view('index')->with(

FatalErrorException in HtmlServiceProvider.php line 36: laravel

大城市里の小女人 提交于 2019-11-27 16:05:28
问题 I am using laravel 5.2 and I am getting following error FatalErrorException in HtmlServiceProvider.php line 36: Call to undefined method Illuminate\Foundation\Application::bindShared() my app.php file is <?php return [ 'env' => env('APP_ENV', 'production'), 'debug' => env('APP_DEBUG', false), 'url' => 'http://localhost', 'timezone' => 'UTC', 'locale' => 'en', 'fallback_locale' => 'en', 'key' => env('APP_KEY'), 'cipher' => 'AES-256-CBC', 'log' => env('APP_LOG', 'single'), 'providers' => [ /* *

Laravel 4 : How to pass multiple optional parameters

巧了我就是萌 提交于 2019-11-27 15:26:19
问题 I am new to laravel and I am really struggling to understand how to pass multiple optional url parameters. What is the standard way to code routes when passing 3 optional parameters to the controller? Also is there a way to code a route to allow named parameters to be passed to the controller? such as public/test/id=1&page=2&opt=1 or public/test/id=1/page=2/opt=1 Thanks for any help 回答1: If you have multiple optional parameters Route::get('test',array('as'=>'test','uses'=>'HomeController

Laravel Queries Strings

纵饮孤独 提交于 2019-11-27 14:17:34
Does anyone know if it's possible to make use of URL query's within Laravel. Example I have the following route: Route::get('/text', 'TextController@index'); And the text on that page is based on the following url query: http://example.com/text?color={COLOR} How would I approach this within Laravel? Yes, it is possible. Try this: Route::get('test', function(){ return "<h1>" . Input::get("color") . "</h1>"; }); and call it by going to http://example.com/test?color=red . You can, of course, extend it with additional arguments to your heart's content. Try this: Route::get('test', function(){

(Laravel) How to use 2 controllers in 1 route?

牧云@^-^@ 提交于 2019-11-27 07:24:04
问题 How can I use 2 controllers in 1 route? The goal here is to create multiple pages with 1 career each (e.g: Accountants) then link them to a school providing an Accounting course. An example page would consist of: 1. Accountants career information (I'm using a "career" controller here) 2. Schools providing Accounting courses (I'm using a separate "schools" controller here). Route::get('/accountants-career', 'CareerController@accountants'); Route::get('/accountants-career', 'SchoolsController

Redirect to homepage if route doesnt exist in Laravel 5

守給你的承諾、 提交于 2019-11-27 04:20:00
问题 /** Redirect 404's to home *****************************************/ App::missing(function($exception) { // return Response::view('errors.missing', array(), 404); return Redirect::to('/'); }); I have this code in my routes.php file. I am wondering how to redirect back to the home page if there is a 404 error. Is this possible? 回答1: For that, you need to do add few lines of code to render method in app/Exceptions/Handler.php file which looks like this: public function render($request,

Laravel Controller Subfolder routing

无人久伴 提交于 2019-11-27 02:51:05
I'm new to Laravel. To try and keep my app organized I would like to put my controllers into subfolders of the controller folder. controllers\ ---- folder1 ---- folder2 I tried to route to a controller, but laravel doesn't find it. Route::get('/product/dashboard', 'folder1.MakeDashboardController@showDashboard'); What am I doing wrong? Ja22 For Laravel 5.3 above: php artisan make:controller test/TestController This will create the test folder if it does not exist, then creates TestController inside. TestController will look like this: <?php namespace App\Http\Controllers\test; use Illuminate

Call to undefined method Illuminate\Routing\Route::get()

為{幸葍}努か 提交于 2019-11-27 02:46:44
问题 I have just installed Laravel 5.1, visited the home page of my app and i get the following error: Whoops, looks like something went wrong. 1/1 FatalErrorException in routes.php line 16: Call to undefined method Illuminate\Routing\Route::get() in routes.php line 16 This is my routes.php file: <?php /* |-------------------------------------------------------------------------- | Application Routes |-------------------------------------------------------------------------- | | Here is where you

Single Laravel Route for multiple controllers

纵然是瞬间 提交于 2019-11-26 23:03:34
问题 I am creating a project where i have multiple user types, eg. superadmin, admin, managers etc. Once the user is authenticated, the system checks the user type and sends him to the respective controller. The middle ware for this is working fine. So when manager goes to http://example.com/dashboard he will see the managers dashboard while when admin goes to the same link he can see the admin dashboard. The below route groups work fine individually but when placed together only the last one

Download files in laravel using Response::download

自古美人都是妖i 提交于 2019-11-26 21:39:11
In Laravel application I'm trying to achieve a button inside view that can allow user to download file without navigating to any other view or route Now I have two issues: (1) below function throwing The file "/public/download/info.pdf" does not exist (2) Download button should not navigate user to anywhere and rather just download files on a same view, My current settings, routing a view to '/download' Here is how Im trying to achieve: Button: <a href="/download" class="btn btn-large pull-right"><i class="icon-download-alt"> </i> Download Brochure </a> Route : Route::get('/download',