mercredi 13 décembre 2017

Laravel checkbox change layout

I'm trying create a blade view Laravel where the user can decide the way the layout is displayed by clicking a checkbox. Can someone walk me trough how to do it? I suppose the checkbox have to send some ajax call and the controller have to process it and re-render?

So far what I have is:

client/newclient.blade.php

...


//defining the variable manually just for testing purpose
@php 
    $layout = false;
@endphp

  @if ($layout == True)
    <div id="Div_accordion">@include('client.accordion')</div>
  @else
    <div id="Div_tab">@include('client.tab')</div>
  @endif

NewClientController.php

...
public function index()
    {
return view('client.newclient');
    }

Or if there's a better way to achieve this, please let me know, php, ajax and laravel are all new for me. Thanks




Aucun commentaire:

Enregistrer un commentaire