jwavess's avatar

Laravel is no longer loading in my browser!

So somewhere after this video

https://laracasts.com/series/laravel-5-fundamentals/episodes/7

My homestead is no longer loading in safari, it just says "Can't open page".

Besides the video I have been takin the Team Treehouse Javascript course and tried applying what I learned to my views in Laravel. I made the following changes in Laravel, could any of the following changes look incorrect?

(in routes) Route::get('/', 'AppController@Homescreenmethod'); (in AppController) `namespace App\Http\Controllers;

use Illuminate\Http\Request;

use App\Http\Requests; use App\Http\Controllers\Controller;

class AppController extends Controller { public function contactmethod() { return view('Contactview')->with([

        'first' => 'Bill',
        'last' => 'Cadara'

//The above way of listing information, and is meant for attaching many $varibles to its own value. ]); }

public function aboutmethod() {

    $animals = [

        'Rainbow Shrimp',
        'Nutebrech',
        'Red Panda',
        'Wolf',
        'Jelly Fish',
        'Bat'
    ];
    return view('Aboutview', compact('animals'));

//The above way of attaching information, this is meant for attaching many values to ONE variable.

}

public function Homescreenmethod() {

    return view('Homescreenview');
}

}(in Homescreenview)DOCTYPE html html lang="en head meta charset="UTF-8" script src="javascript.js"></script title>Title</title /head body h2>This is the home screen!</h2 /body /html(in javascript.js)/**

  • Created by imclockedout on 1/6/16. */ alert("javascript!");`

P.S. my javascript.js file is in resources/views Im also thinking maybe it was an update? Or perhaps something when I was migrating things? Everything seemed to go just as Jeffires screen did, only difference is that I am using MySQL, not Sqlite.

0 likes
12 replies
zachleigh's avatar

Please post your entire view. Also, make sure Laravel is in debug mode so you get stack traces.

ps. When posting code, wrap it in three back ticks (`) to create code blocks.

1 like
zachleigh's avatar

What happens if you take out the script tag? You shouldnt put javascript files in your views folder. They should be in /public. Laravel will look there by default.

jwavess's avatar

I moved the javascript.js file to the public directory in the framework, and the page seems to still have the same problem. It just loads a little bit when I click refresh in safari, after a while it just says "Can't open the page".

is there steps I can take to make sure everything with homestead is set up correctly? Perhaps something was changed somehow.

IsaacBen's avatar

Don't kill yourself with these stuff. Focus on programming and not installation stuff. The first little error that I got with homestead and I immediately switched back to MAMP/WAMP. You should do the same.

zachleigh's avatar

Do you get the error for every page, or just the homepage?

jwavess's avatar

yeea, I appreciate the thought but I'd really rather learn what the problem is so I can grow in homestead, @zachleigh if you have any other ideas let me know, in the mean time ill try and crack this puppy.

jwavess's avatar

@zachleigh I didn't see your last question, every page. I just went over my homestead installation and it seems all is installed correctly. I also ran vagrant provision and I had a few errors, but nothing that should cause the problem that I am having.

zachleigh's avatar

Just to try to identify the problem, try thus in your controller :

public function Homescreenmethod() {

    dd('it works');
}

Does it work?

jwavess's avatar

@zachleigh this is so weird. So I didn't do anything last night accept "vagrant provision" and turn my laptop off and then I check it again today and now Its loading but it says "No input file specified.".

Please or to participate in this conversation.