Jump to content

Laravel views rending in the wrong place?

vorticalbox
Go to solution Solved by vorticalbox,

Hey past you, you forgot @endsection silly!

so I am learning laravel but I am having a problem I can no fix the nav section is being rendered under the content even though it's placed under the nav.

 

web.php (routes)

<?php
use App\Post;
use illumunate\Http\Request;
/*
|--------------------------------------------------------------------------
| 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('/', function () {
    $posts = Post::orderBy('created_at', 'asc')->get();
	return view('posts',[
		'posts'=>$posts
	]);
});

posts.blade.php

@extends('layouts.app')
@section('content')

	@include('errors.errors')
	@if (count($posts) > 0)
		@foreach ($posts as $post)
		<div class="panel panel-primary">
			<div class="panel-heading">{{$post->title}}</div>
			<div class="panel-body">{{$post->content}}</div>
			<div class="panel-footer">Posted By {{$post->user}} on {{$post->created_at}}</div>	
		</div>
		@endforeach
	@endif

app.blade.php

<!DOCTYPE html>
<html lang="en">
    <head>
        <title>Blog</title>

        <!-- CSS And JavaScript -->
		<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
  	<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
 	<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
 	<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
    </head>

    <body>
        <div class="container">
            <nav class="navbar navbar-default">
                <!-- Navbar Contents -->
				links
            </nav>
        </div>

        @yield('content')
    </body>
</html>

and finally what it looks like

 

 

Capture.PNG

                     ¸„»°'´¸„»°'´ Vorticalbox `'°«„¸`'°«„¸
`'°«„¸¸„»°'´¸„»°'´`'°«„¸Scientia Potentia est  ¸„»°'´`'°«„¸`'°«„¸¸„»°'´

Link to comment
Share on other sites

Link to post
Share on other sites

Hey past you, you forgot @endsection silly!

                     ¸„»°'´¸„»°'´ Vorticalbox `'°«„¸`'°«„¸
`'°«„¸¸„»°'´¸„»°'´`'°«„¸Scientia Potentia est  ¸„»°'´`'°«„¸`'°«„¸¸„»°'´

Link to comment
Share on other sites

Link to post
Share on other sites

  • 3 weeks later...

Haha this made me laugh, was just browsing through the search results for Laravel.

Just watched like 2 hours of setting up and beginning with Laravel, first framework and meeting OOP.

 

I must say from what i have seen now with routers, using blade and setting up databases also retrieving and updating information it is seems really clean and nice.

This might be the way out of spaghetti code for me :D

Quote or mention me if not feel ignored 

Link to comment
Share on other sites

Link to post
Share on other sites

Btw, i did visit your Site URL on your profile, and i read this.

Quote

 I played about with a few things such Laravel but ended up just created it from scratch. 

So did you stop using Laravel and if yes why? or you decided not to use it for that project?

Quote or mention me if not feel ignored 

Link to comment
Share on other sites

Link to post
Share on other sites

1 hour ago, Cruorzy said:

Btw, i did visit your Site URL on your profile, and i read this.

So did you stop using Laravel and if yes why? or you decided not to use it for that project?

 

I felt that a framework wasn't needed for such a small site. It is twitter post style but my host also doesn't support Laravel sites and I really can't be bothered moving it xD

                     ¸„»°'´¸„»°'´ Vorticalbox `'°«„¸`'°«„¸
`'°«„¸¸„»°'´¸„»°'´`'°«„¸Scientia Potentia est  ¸„»°'´`'°«„¸`'°«„¸¸„»°'´

Link to comment
Share on other sites

Link to post
Share on other sites

Ah okay i loved what i have seen from it so far, i use digitalocean. Cheap and more then enough to also get some setup expierence.

Quote or mention me if not feel ignored 

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×