samedi 9 septembre 2017

How do I extend views properly in laravel 5?

I have a project which has 2 login forms, one for consumers and one for creators.
Both have different "post-login" areas.

But the view should look pretty similar, so I thought why not DRY-it™.
QUESTION: Here is my solution, but I am sure there is a more elegant solution, please enlighten me if there is.

login.blade.php (master template)

@extends('layout.app')

@section('styles')
     // This also looks deprecated, how do I have a specific css only for this page?
@stop

@section('content')
<div class="container">

      <form class="form-signin" action=""> //smells really bad
        <h2 class="form-signin-heading">Login </h2>
...
@endsection

login_consumer.blade.php

@extends('layout.login', [
    'loginTitle' => 'Consumer',
    'loginAction' => 'login_consumers'
    ])

login_creator.blade.php

@extends('layout.login', [
    'loginTitle' => 'Creators',
    'loginAction' => 'login_creators' 
    ])

Thanks in advance



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire