Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply only to certain views #97

Open
robertmain opened this issue Mar 20, 2017 · 0 comments
Open

Apply only to certain views #97

robertmain opened this issue Mar 20, 2017 · 0 comments

Comments

@robertmain
Copy link

robertmain commented Mar 20, 2017

I was under the impression that calling JavaScript::put() would affect only that controller action in which it was called. However, I'm finding that my unit tests are gaining because the JavaScript is finding its way into my API controller outputs.

My web routes file looks like this(I want to direct all web traffic to my SPA) and I wanted to pass some js variables through as well...

I figured that the route groups would isolate this from the API routes and stop what I was doing in here bleeding through, but perhaps I misunderstood?

<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| This file is where you may define all of the routes that are handled
| by your application. Just tell Laravel the URIs it should respond
| to using a Closure or controller method. Build something great!
|
*/
Route::get('/{catchall?}', function () {

    JavaScript::put([
        'APPTITLE' => htmlspecialchars_decode(config('app.name'))
    ]);

    return View::make('partials.index');
})->where('catchall', '(.*)');
;

Have i misunderstood something or misconfigured something here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant