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

[L5.3.x] Uncaught SyntaxError: Invalid or unexpected token when querying models (again) #14

Open
rjsworking opened this issue Aug 28, 2016 · 0 comments

Comments

@rjsworking
Copy link

rjsworking commented Aug 28, 2016

Hi.

I'm facing this error again with latest Laravel 5.3 (5,3,4) See #7 please.

Curious thing: if I query the model in the web routes file it works ok. If the route points to a an action in a controller I get the error.

routes/web.php

Route::get('/', function () {
    $data = \App\Models\Test::all();

    return view('welcome', ["data" => $data]);
});

Works ok.
routes/web.php

Route::get('/', 'IndexController@index')->name('index');

IndexController

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

class IndexController extends Controller
{
    public function index()
    {
        $data = \App\Models\Test::all();

        return view('welcome', ["data" => $data]);
    }
}

Error in the console.

The error of #7 is logged in the console.
Tested in a Linode VPS with Ubuntu 16.04 and latest nginx/php and both cases are working ok.

Cheers

@rjsworking rjsworking changed the title [L5.3.x9] Uncaught SyntaxError: Invalid or unexpected token when querying models (again) [L5.3.x] Uncaught SyntaxError: Invalid or unexpected token when querying models (again) Aug 28, 2016
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