laravel-routing

Can I group multiple domains in a routing group in Laravel?

人走茶凉 提交于 2019-12-18 10:53:02
问题 Let's say I have the following: Route::group(array('domain' => array('admin.example.com')), function() { ... }); Route::group(array('domain' => array('app.example.com')), function() { ... }); Route::group(array('domain' => array('dev.app.example.com')), function() { ... }); Is there any way to have multiple domains share a routing group? Something like: Route::group(array('domain' => array('dev.app.example.com','app.example.com')), function() { ... }); 回答1: Laravel does not seem to support

Can I group multiple domains in a routing group in Laravel?

和自甴很熟 提交于 2019-12-18 10:52:35
问题 Let's say I have the following: Route::group(array('domain' => array('admin.example.com')), function() { ... }); Route::group(array('domain' => array('app.example.com')), function() { ... }); Route::group(array('domain' => array('dev.app.example.com')), function() { ... }); Is there any way to have multiple domains share a routing group? Something like: Route::group(array('domain' => array('dev.app.example.com','app.example.com')), function() { ... }); 回答1: Laravel does not seem to support

Set session variable in laravel

﹥>﹥吖頭↗ 提交于 2019-12-18 10:29:46
问题 I would like to set a variable in the session using laravel this way Session::set('variableName')=$value; but the problem is that I don't know where to put this code, 'cause I would like to set it for one time (when the guest visite the home page or any other page)? The main idea is to use a global variable to use it in all application controllers, I heared about something related to configuration variables but I'm not sure if it will be a good Idea to use config variables or only the session

My Routes are Returning a 404, How can I Fix Them?

微笑、不失礼 提交于 2019-12-18 10:17:53
问题 I've just started learning the Laravel framework and I'm having an issue with routing. The only route that's working is the default home route that's attached to Laravel out of the box. I'm using WAMP on Windows and it uses PHP 5.4.3, and Apache 2.2.22, and I also have mod_rewrite enabled, and have removed the 'index.php' from the application.php config file to leave an empty string. I've created a new controller called User : class User_Controller extends Base_Controller { public $restful =

order of route declarations in laravel package

老子叫甜甜 提交于 2019-12-18 09:05:50
问题 I have made a laravel package which contains a route, it is a special route that catches a large number of possible urls. I don't want my route to take precedence over other packages or routes declared in the main application. How can I ensure that my route is the last route declared? 回答1: Routes are evaluated in the order that they are listed in routes.php. Simply making sure this route is the last one in the array should do it. update I believe you could just register the route in the App:

Laravel 5.2 : Web middleware is applied twice

感情迁移 提交于 2019-12-17 21:23:15
问题 Here is my routes.php code Route::auth(); Route::group(['middleware' => 'web'], function () { Route::group(['namespace' => 'Admin', 'prefix' => 'admin', 'middleware' => ['auth','role:Admin']], function(){ Route::get('/home', 'HomeController@index'); Route::get('user/data', ['as' => 'admin.user.data','uses'=>'UserController@userData']); Route::resource('user', 'UserController'); Route::get('merchant/data', ['as' => 'admin.merchant.data','uses'=>'MerchantController@merchantData']); Route:

Controller class not found in Laravel 4

浪子不回头ぞ 提交于 2019-12-17 21:21:14
问题 I have the following error while trying to run my controller Controller class not found I have this code in my routes.php file Route::get('cms/create-page', 'AdminCMSController@create_page'); Route::post('cms/createpage','AdminCMSController@createpage'); Route::controller('cms','AdminCMSController'); And this is the code in my Controller class AdminCMSController extends BaseController { public function create_page() { } public function createpage() { } } How can I fix it? 回答1: If you didn't

post request not working Laravel 5

落爺英雄遲暮 提交于 2019-12-17 21:18:47
问题 I am trying to submit a form using post method, but it does not seem to be working. I have enabled error debug on but still no error is shown. After submitting the form the same page is loaded without any errors. This is my route Route::post('/home' , ['as' => 'store-post' , 'uses'=>'FacebookControllers\PostsController@save']); And my form is {!! Form::open(['route'=>'store-post' , 'class'=>'form'])!!} <div class="form-group"> <label for="textarea"></label> <textarea class="form-control" rows

Laravel 4 : Route to localhost/controller/action

柔情痞子 提交于 2019-12-17 12:41:53
问题 I'm more or less new to Laravel 4. I've never used routes before but normally what I'm used to is url/controller/action and then the backend routing for me. I've read the documentation for routes and controllers a few times as well as read through some tutorials and so, I'm trying to figure out how to get this to work without writing a route for every controller and action. I tried something like Route::get('{controller}/{action}', function($controller, $action = 'index'){ return $controller.

Laravel 4 : Route to localhost/controller/action

♀尐吖头ヾ 提交于 2019-12-17 12:41:05
问题 I'm more or less new to Laravel 4. I've never used routes before but normally what I'm used to is url/controller/action and then the backend routing for me. I've read the documentation for routes and controllers a few times as well as read through some tutorials and so, I'm trying to figure out how to get this to work without writing a route for every controller and action. I tried something like Route::get('{controller}/{action}', function($controller, $action = 'index'){ return $controller.