jeudi 28 janvier 2016

Has Blade Templating Changed from Laravel 4 to Laravel 5?

Issue: Converting my Laravel 4 code to Laravel 5. Nothing appears on the screen in between the @section('container') & @stop.

Notes: I am using the Laravel Collective HTML Facades. I have severely shortened the master.blade.php file for brevity.

Request: Please assist in figuring out why nothing is showing up in the browser and let me know in detail what I am doing wrong with examples, if possible.

Error & Debug: There is none. The page is just blank.

Attempts: If I add anything outside the @section('container') & @stop then it shows up on the screen.

composer.json

"require": {
    "php": ">=5.5.9",
    "laravelcollective/html": "5.2.*"
},

app.php

Providers Array
        Collective\Html\HtmlServiceProvider::class,

Alias Array
        'Form'      => Collective\Html\FormFacade::class,
        'Html'      => Collective\Html\HtmlFacade::class,

master.blade.php

  <body>
        <!--[if lt IE 7]>
            <p class="chromeframe">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> or <a href="http://ift.tt/VVsZ3e">activate Google Chrome Frame</a> to improve your experience.</p>
        <![endif]-->

        <!-- Add your site or application content here -->
        @yield('container')
    </body>

index.blade.php

 @section('container')
  <!--[if gte IE 9]>
  <style type="text/css">
    .gradient {
       filter: none;
    }
  </style>
<![endif]-->
<div style="margin: 10px 0 0 20px;border: 0px black dashed;width: 410px;float:left;">
        {!! Form::open(array('action' => 'ContractController@store')) !!}
        {!! Form::token() !!}
<dl style="list-style-type:none;">
    <fieldset>
        <legend>General Information</legend>
            <dd>
                {!! Form::label('contractterm','Contract Term', array('class' => 'label')) !!}
                {!! Form::select('contractterm_id', $contracttermlist) !!}
            </dd>
            <dd>
                {!! Form::label('businesstype','Business Type', array('class' => 'label')) !!}
                {!! Form::select('businesstype_id', $businesstypelist) !!}
            </dd>
            <dd>
                {!! Form::label('contract_date','Contract Starting Date', array('class' => 'label')) !!}
                {!! Form::text('contract_date', date('m/d/Y'), array(
                    'size'=>'16',
                    'id' =>'datepicker'))
                !!}
            </dd>
            <dd>
                {!! Form::label('service_credit','Previous Service', array('class' => 'label')) !!}
                <div style="float:right;width:140px;height:29px;"><span>Yes</span><span style="float:right;width:20px;padding-top:4px;padding-right:90px;">{!! Form::checkbox('prevcredit', 'credityes', false, array('class' => 'creditcheckbox','id' => 'prevcredit')); !!}</span></div>
            </dd>
            <dd>
                {!! Form::label('credit_amount','Credit Amount', array('class' => 'label','id' => 'credit_amount')) !!}
                {!! Form::text('credit_amount','0.00',array('id' => 'credit_amount2')) !!}
            </dd>
            <dd>
                {!! Form::label('addtpcs','Additional PCs', array('class' => 'label')) !!}
                {!! Form::select('addtpcs', $addtpcs) !!}
            </dd>
            <div id="inputs" style="margin:0;">
            </div>
    </fieldset>
    <fieldset>
        <legend>Personal Information</legend>
            <dd>
                {!! Form::label('firstname','First Name', array('class' => 'label')) !!}
                {!! Form::text('firstname') !!}
            </dd>
            <dd>
                {!! Form::label('lastname','Last Name', array('class' => 'label')) !!}
                {!! Form::text('lastname') !!}
            </dd>
            <dd>
                {!! Form::label('hstraddr','Home Address', array('class' => 'label')) !!}
                {!! Form::text('hstraddr') !!}
            </dd>
            <dd>
                {!! Form::label('hcity','Home City', array('class' => 'label')) !!}
                {!! Form::text('hcity') !!}
            </dd>
            <dd>
                {!! Form::label('hstate','Home State', array('class' => 'label')) !!}
                {!! Form::text('hstate', 'Florida') !!}
            </dd>
            <dd>
                {!! Form::label('hzip','Home Zip Code', array('class' => 'label')) !!}
                {!! Form::text('hzip') !!}
            </dd>
            <dd>
                {!! Form::label('hphone','Home Phone', array('class' => 'label')) !!}
                {!! Form::text('hphone') !!}
            </dd>
            <dd>
                {!! Form::label('mobile','Mobile Phone', array('class' => 'label')) !!}
                {!! Form::text('mobile') !!}
            </dd>
    </fieldset>
    <fieldset>
        <legend>Business Information</legend>
            <dd>
                {!! Form::label('company','Company Name', array('class' => 'label')) !!}
                {!! Form::text('company') !!}
            </dd>
            <dd>
                {!! Form::label('bstraddr','Business Address', array('class' => 'label')) !!}
                {!! Form::text('bstraddr') !!}
            </dd>
            <dd>
                {!! Form::label('bcity','Business City', array('class' => 'label')) !!}
                {!! Form::text('bcity') !!}
            </dd>
            <dd>
                {!! Form::label('bstate','Business State', array('class' => 'label')) !!}
                {!! Form::text('bstate', 'Florida') !!}
            </dd>
            <dd>
                {!! Form::label('bzip','Business Zip', array('class' => 'label')) !!}
                {!! Form::text('bzip') !!}
            </dd>
            <dd>
                {!! Form::label('bphone','Business Phone', array('class' => 'label')) !!}
                {!! Form::text('bphone') !!}
            </dd>
            <dd>
            <div class="submitbutton">
                    {!! Form::submit('Submit') !!}
            </div>
            </dd>
    </fieldset>
</dl>
        {!! Form::close() !!}
</div>
<div style="clear:both;"></div>
@stop

IndexController.php

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Library\additionalPCs;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use View;
use App\Models\businesstype;
use App\Models\contractterm;


class IndexController extends BaseController
{
    Protected $layout = 'master';
    /**
     * Display a listing of the resource.
     *
     * @return Response
     */
    public function index()
    {
        /** Wayne - 03-02-2014 - Moved for loop to a method within its own class. */
        $numberofpcs = new additionalPCs();
        $addtpcs=$numberofpcs->display();
        //$this->layout->content = View::make('index')->with('addtpcs', $addtpcs)->with('businesstypelist', businesstype::dropdown())->with('contracttermlist',ContractTerm::dropdown());
        return view('index')->with('addtpcs', $addtpcs)->with('businesstypelist', businesstype::dropdown())->with('contracttermlist',ContractTerm::dropdown());
    }
}



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1lXMWd8
via IFTTT

Aucun commentaire:

Enregistrer un commentaire