Laravel Classroom image

CiliSp
 
To post your Question Join Classroom
 
Lesson Topics's No:-  First|1 | 2 | 3 | 4 | 5 | 6 | 7 | 8|Last
Lessons:-The Blog Tutorial

15.5 Views
Let’s start by creating a blade layout as a wrapper for our application.
templates/main.blade.php
1 <!DOCTYPE HTML>
2 <html lang="en-GB">
3 <head>
4 <meta charset="UTF-8">
5 <title>Wordpush</title>
6 {{ HTML::style('css/style.css') }}
7 </head>
8 <body>
9 <div class="header">
10 <h1>Wordpush</h1>
11 <h2>Code is Limmericks</h2>
12 </div>
13
14 <div class="content">
15 @yield('content')
16 </div>
17 </body>
18 </html>
As you can see we have a very simple HTML5 template, with a CSS style-sheet (which we will
not be covering, by all means use it to make your blog pretty.. but this is not a design book) and
a yielded content area for our page content.We are going to need a login form so that our post authors can create new entries. I am going to
steal this view from the last tutorial and hack it a bit to work with blade layouts. This is actually
good practice. Re-use anything you can and eventually you will have built up your own Laravel
development toolkit.
pages/login.blade.php
1 @layout('templates.main')
2
3 @section('content')
4 {{ Form::open('login') }}
5
6 <!-- check for login errors flash var -->
7 @if (Session::has('login_errors'))
8 <span class="error">Username or password incorrect.</span>
9 @endif
10
11 <!-- username field -->
12 <p>{{ Form::label('username', 'Username') }}</p>
13 <p>{{ Form::text('username') }}</p>
14
15 <!-- password field -->
16 <p>{{ Form::label('password', 'Password') }}</p>
17 <p>{{ Form::password('password') }}</p>
18
19 <!-- submit button -->
20 <p>{{ Form::submit('Login') }}</p>
21
22 {{ Form::close() }}
23 @endsection
As you can see, our login form is using our newly created blade layout. Let’s also create our
‘Create New Post’ form.
pages/new.blade.php
1 <?php
2
3 @layout('templates.main')
4
5 @section('content')
6 {{ Form::open('admin') }}
7
8 <!-- title field -->
9 <p>{{ Form::label('title', 'Title') }}</p>
10 {{ $errors->first('title', '<p class="error">:message</p>') }}
11 <p>{{ Form::text('title', Input::old('title')) }}</p>12
13 <!-- body field -->
14 <p>{{ Form::label('body', 'Body') }}</p>
15 {{ $errors->first('body', '<p class="error">:message</p>') }}
16 <p>{{ Form::textarea('body', Input::old('body')) }}</p>
17
18 <!-- submit button -->
19 <p>{{ Form::submit('Create') }}</p>
20
21 {{ Form::close() }}
22 @endsection

 

 

 
 
 

CiliSp

Skills    Laravel

Qualifications :-
Location :-,,,
Description:-
Explore
 

  Students (0)