laravel-routing

barryvdh/laravel-cors not working for my routes

心已入冬 提交于 2020-01-04 13:47:50
问题 I'm using [this laravel-cors package][1], I've read the docs and I've added the service provider to config/app.php . After adding the middleware to kernel.php like so: protected $middleware = [ \Barryvdh\Cors\HandleCors::class, \Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::class, ]; It works for my passport routes, but not for my own routes. Passport routes Route::group([ 'middleware' => ['api'] ], function ($router) { Passport::routes(); Passport::tokensExpireIn(Carbon::now

barryvdh/laravel-cors not working for my routes

帅比萌擦擦* 提交于 2020-01-04 13:46:06
问题 I'm using [this laravel-cors package][1], I've read the docs and I've added the service provider to config/app.php . After adding the middleware to kernel.php like so: protected $middleware = [ \Barryvdh\Cors\HandleCors::class, \Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::class, ]; It works for my passport routes, but not for my own routes. Passport routes Route::group([ 'middleware' => ['api'] ], function ($router) { Passport::routes(); Passport::tokensExpireIn(Carbon::now

Vue router server configuration for history mode on nginx does not work

*爱你&永不变心* 提交于 2020-01-02 04:50:40
问题 I read the following note from vue router documentation Note : when using the history mode, the server needs to be properly configured so that a user directly visiting a deep link on your site doesn't get a 404. So, I try to configure my nginx like the following server { listen 80 default_server; listen [::]:80 default_server ipv6only=on; root /var/www/laravel/public/; index index.php index.html index.htm; server_name working.dev; location /user { rewrite ^(.+)$ /index.php last; } location /

How to build a Laravel route that requires a specific URL query parameter?

孤人 提交于 2020-01-02 04:11:43
问题 Let's say I have URLs like this: localhost/ admin/users/ <--- Main Admin Users page localhost/ admin/users/?data=refresh <---- A typical ajax request made from that page And a simple controller like this: class UsersController extends Controller { public function index() // call some services // return a view } public function dataRefresh { // call some services // return some JSON } } And here's my routes.php I'm working on: Route::get('admin/users', array('as' => 'admin.users', 'uses' =>

Temporarily disable / bypass Middleware

北慕城南 提交于 2020-01-02 03:47:09
问题 In my Application I implemented a OAuth2-Server (oauth2-server-laravel) in combination with a custom Authentication Package (Sentinel by Cartalyst). In my routes.php: Route::group(['before' => 'oauth'], function() { // ... some routes here } So the request must provide an authorization header or the application quits with an OAuthException. Now I want to unittest my controllers. So I have to seed my database with a OAuth session and access token for every test. Then overwrite the call()

Laravel 5 - NotFoundHttpException in RouteCollection.php line 143

喜夏-厌秋 提交于 2020-01-02 02:53:24
问题 I get this error: Sorry, the page you are looking for could not be found. 1/1 NotFoundHttpException in RouteCollection.php line 143: in RouteCollection.php line 143 at RouteCollection->match(object(Request)) in Router.php line 746 at Router->findRoute(object(Request)) in Router.php line 655 at Router->dispatchToRoute(object(Request)) in Router.php line 631 at Router->dispatch(object(Request)) in Kernel.php line 229 at Kernel->Illuminate\Foundation\Http\{closure}(object(Request)) at call_user

User Auth not persisting within Laravel package

Deadly 提交于 2020-01-02 02:40:08
问题 This is my first attempt at a laravel package and have run into an issue where Auth::attempt($credentials) works within my login controller, but upon redirection to a protected route or controller, the user is no longer authenticated. Below is my login controller method with the redirect to dashboard commented out. public function attempt(Request $request){ $email = strtolower(strip_tags(htmlspecialchars($request->input('email')))); $password = strip_tags(htmlspecialchars($request->input(

Laravel - CNAME + Subdomain Routing

百般思念 提交于 2020-01-01 03:55:29
问题 I have my routes set up as follows: <?php Route::group([ 'domain' => '{username}.u.'.env('APP_DOMAIN'), ], function () { Route::get('/', 'FrontendController@site'); }); Route::group([ 'domain' => env('APP_DOMAIN'), ], function () { // Regular site routes }); Route::group([ 'domain' => '{domain}', ], function () { Route::get('/', 'FrontendController@domain'); }); What I'm trying to achieve is allowing users to have their own sites, e.g. hello.u.domain.com, and for those sites to also be served

Allow multiple subdomain in laravel without making subdomain as route variable?

左心房为你撑大大i 提交于 2019-12-30 14:51:08
问题 My subdomains are domain1 = dev1.myapp.com, domain2 = dev2.myapp.com, domain3 = dev3.myapp.com ... Using below code causing problem with first parameter in laravel controller, > Route::group(array('domain' => '{account}.myapp.com'), function() { > Route::get('/get_data/{id?}', 'DataController@getData'); > }) I am getting subdomain value( dev1 , dev2 , dev3 ) instead of $id value in controller in getData method. How to update my code to allow all subdomain, without making subdomain as first

Laravel redirect::route is showing a message between page loads

时光毁灭记忆、已成空白 提交于 2019-12-30 07:20:13
问题 I'm currently developing a web app using Laravel, and the app was working perfectly fine until recently. I had no idea what triggered it but here's a summary of the issue I'm having: Logging in used to work as I have an AccountController that does this: $auth = Auth::attempt(array( 'username' => Input::get('username'), 'password' => Input::get('password'), 'active'=>1); if ($auth) { return Redirect::route('home'); } return Redirect::route('account-sign-in'); And the home route looks like so: