i have a problem with the vue components.
here's the code from add.blade.php
<div class="col-md-5">
<h4>Detail Produk</h4>
<div v-if="product.name">
<table class="table table-stripped">
<tr>
<th>Kode</th>
<td>:</td>
<td> #{{product.code}}! </td>
</tr>
<tr>
<th width="3%">Produk</th>
<td width="2%">:</td>
<td> #{{product.name}}! </td>
</tr>
<tr>
<th>Harga</th>
<td>:</td>
<td> #{{product.price | currency}} </td>
</tr>
here's the code from transaksi.js
el: '#dw',
data: {
product: {
id: '',
price: '',
name: '',
photo: ''
},
here's the result from add.blade.php
update :
here's the full code of section #dw in add.blade.php
<section class="content" id="dw">
<div class="container-fluid">
<div class="row">
<div class="col-md-8">
<x-card>
#slot('title')
#endslot
β
<div class="row">
<div class="col-md-4">
<form action="#" #submit.prevent="addToCart" method="post">
<div class="form-group">
<label for="">Produk</label>
<select name="product_id" id="product_id" v-model="cart.product_id" class="form-control" required width="100%">
<option value="">Pilih</option>
#foreach ($products as $product)
<option value="{{ $product->id }}">{{ $product->code }} - {{ $product->name }}</option>
#endforeach
</select>
</div>
<div class="form-group">
<label for="">Qty</label>
<input type="number" name="qty" v-model="cart.qty" id="qty" value="1" min="1" class="form-control">
</div>
<div class="form-group">
<button class="btn btn-primary btn-sm" :disabled="submitCart">
<i class="fa fa-shopping-cart"></i>#{{ submitCart ? 'Loading...':'Ke Keranjang' }}
</button>
</div>
</form>
</div>
<div class="col-md-5">
<h4>Detail Produk</h4>
<div v-if="product.name">
<table class="table table-stripped">
<tr>
<th>Kode</th>
<td>:</td>
<td> #{{product.code}}! </td>
</tr>
<tr>
<th width="3%">Produk</th>
<td width="2%">:</td>
<td> #{{product.name}}! </td>
</tr>
<tr>
<th>Harga</th>
<td>:</td>
<td> #{{product.price | currency}} </td>
</tr>
</table>
</div>
</div>
<div class="col-md-3" v-if="product.photo">
<img :src="'/uploads/product/' + product.photo" height="150px" width="150px" :alt="product.name">
</div>
</div>
#slot('footer')
β
#endslot
</x-card>
</div>
#include('orders.cart')
</div>
</div>
</section>
Related
For a calculation I need to select the listed data and send the id values ββvia the button. In the method I tried, when I switch pages, it only calculates the data I selected on that page. When I did research, I learned that it is necessary to keep the session. I tried something but no result. How can I reach the conclusion?
public function index(Request $request){
$selectedCheckboxes = session('selected_checkboxes', []);
$games = Game::orderBy('create_time', 'desc')->paginate(10);
return view('admin.games.index', compact('games','selectedCheckboxes'));
}
public function calculate(Request $request)
{
$request->session()->put('selected_checkboxes',json_encode($request>input('selected_checkboxes')));
$games = $request->input('selected_checkboxes');
dd($games);
}
<div class="col-xl-12 col-lg-12 col-sm-12 layout-spacing">
<div class="widget-content widget-content-area br-6 box-border">
<div class="mb-4 mt-4">
<form action="{{ route('admin.games.calculate') }}" method="POST">
#csrf
<div class="col-lg-4">
<input id="tea-submit" type="submit" class="btn btn-primary" name="submit"
value="Calculate">
</div>
<br>
<table class="table table-hover" style="width:100%">
<thead class="text-center">
<tr>
<th>Game ID</th>
</tr>
</thead>
<tbody>
<input type="hidden" name="selected_checkboxes" id="selected_checkboxes">
#foreach ($games as $game)
<tr>
<td scope="row" style="padding:20px">
<label class="control control--checkbox">
<input type="checkbox" name="checkbox[]" value="{{ $game>id}}">
<div class="control__indicator"></div>
</label>
{{ $game->id }}
</td>
</tr>
#endforeach
</tbody>
<tfoot class="text-center">
<tr>
<th>Game ID</th>
</tr>
</tfoot>
</table>
</form>
<div class="row">
<div class="col-lg-12 d-flex justify-content-center">
{{ $games->onEachSide(2)->links() }}
</div>
</div>
</div>
</div>
</div>
<script>
let selectedCheckboxes = [];
$(':checkbox').on('change', function() {
selectedCheckboxes = $('input[name="checkbox[]"]:checked').map(function() {
return this.value;
}).get();
$('#selected_checkboxes').val(selectedCheckboxes);
});
</script>
My Livewire Component
public $productId;
public $allTariff = [];
public $rowProducts = [];
public function mount()
{
$this->rowProducts = Products::all();
$this->allTariff = [
['productId' => '', 'basicCharge' => '', 'additionalCharge' => '']
];
}
public function addProduct()
{
$this->allTariff[] = ['productId' => '', 'basicCharge' => '', 'additionalCharge' => ''];
}
public function render()
{
$rowProducts = Products::all();
return view('livewire.admin.admin-add-tariffs-component', ['rowProducts'=>$rowProducts)->layout('layouts.admin.base');
}
My View File
<!-- Begin Page Content -->
<div class="container-fluid">
<!-- Page Heading -->
<div class="row">
<div class="col-lg-8">
<div class="card shadow mb-4">
<div class="card-header py-3">
<h6 class="m-0 font-weight-bold text-primary">Add Tariff</h6>
</div>
<div class="card-body">
<form wire:submit.prevent="storeTariff">
#csrf
<div class="form-row">
<!-- Default input -->
<div class="form-group col-md-8">
<input type="text" class="form-control" placeholder="Enter Tariff Name" wire:model="tariffName" >
</div>
</div><hr>
<div class="card">
<div class="card-header">
<h6 class="text-primary">Products, Basic and Weight Charges</h6>
</div>
<div class="card-body">
<table class="table" id="products_table">
<thead>
<tr>
<th>Product</th>
<th>Basic Charge</th>
<th>Weight Charge</th>
<th></th>
</tr>
</thead>
<tbody>
#foreach ($allTariff as $index => $value)
<tr>
<td>
<select name="allTariff[{{$index}}][productId]"
wire:model="allTariff.{{ $index }}.productId"
class="custom-select custom-select-sm form-control form-control-sm">
#foreach ($rowProducts as $product)
<option value="{{ $product->id }}">
{{ $product->product_name }}
</option>
#endforeach
</select>
</td>
<td>
<input type="text" class="form-control form-control-user" name="allTariff[{{$index}}][basicCharge]" placeholder="Basic Charge" wire:model="allTariff.{{ $index }}.basicCharge" required>
</td>
<td>
<input type="text" class="form-control form-control-user" name="allTariff[{{$index}}][additionalCharge]" placeholder="Weight Charge" wire:model="allTariff.{{ $index }}.additionalCharge" required>
</td>
</tr>
#endforeach
</tbody>
</table>
<div class="row">
<div class="col-md-12">
<button class="btn btn-sm btn-secondary"
wire:click.prevent="addProduct">+ Add Another Product</button>
</div>
</div>
</div>
</div>
<hr>
{{-- <div class="form-row">
<div class="form-group col-md-3"> --}}
<button type="submit" class="form-control btn btn-small btn-primary">Add
Tariff</button>
{{-- </div>
</div> --}}
</form>
</div>
</div>
</div>
</div>
</div>
<!-- /.container-fluid -->
Every time I click on the add tariff button this photo it give the blank page on this photo, but on console an html response is given.
I have tried a couple methods and tricks still no way out, just stuck for days
I have already include the livewire #livewireStyles and #livewireScripts, and i can't find an answer anywhere else cause i don't see any question that match my problem, and i'm kinda new to livewire
When using Livewire, there are a few things you need to be aware of. Due to the nature of how Livewire updates the page, there are some structural rules you need to follow.
The first and probably most important thing here, is that every Livewire-component view should only consist of one root element. And this includes comments!
If we count the root elements in your view, there are three - a comment, a div, and then another comment. So the first thing I did here, was to move the comments inside that div.
<div class="container-fluid">
<!-- Begin Page Content -->
<!-- Page Heading -->
<div class="row">
<div class="col-lg-8">
<div class="card shadow mb-4">
<div class="card-header py-3">
<h6 class="m-0 font-weight-bold text-primary">Add Tariff</h6>
</div>
<div class="card-body">
<form wire:submit.prevent="storeTariff">
#csrf
<div class="form-row">
<!-- Default input -->
<div class="form-group col-md-8">
<input type="text" class="form-control" placeholder="Enter Tariff Name"
wire:model="tariffName">
</div>
</div>
<hr>
<div class="card">
<div class="card-header">
<h6 class="text-primary">Products, Basic and Weight Charges</h6>
</div>
<div class="card-body">
<table class="table" id="products_table">
<thead>
<tr>
<th>Product</th>
<th>Basic Charge</th>
<th>Weight Charge</th>
<th></th>
</tr>
</thead>
<tbody>
#foreach ($allTariff as $index => $value)
<tr>
<td>
<select name="allTariff[{{ $index }}][productId]"
wire:model="allTariff.{{ $index }}.productId"
class="custom-select custom-select-sm form-control form-control-sm">
#foreach ($rowProducts as $product)
<option value="{{ $product->id }}">
{{ $product->product_name }}
</option>
#endforeach
</select>
</td>
<td>
<input type="text" class="form-control form-control-user"
name="allTariff[{{ $index }}][basicCharge]"
placeholder="Basic Charge"
wire:model="allTariff.{{ $index }}.basicCharge" required>
</td>
<td>
<input type="text" class="form-control form-control-user"
name="allTariff[{{ $index }}][additionalCharge]"
placeholder="Weight Charge"
wire:model="allTariff.{{ $index }}.additionalCharge"
required>
</td>
</tr>
#endforeach
</tbody>
</table>
<div class="row">
<div class="col-md-12">
<button class="btn btn-sm btn-secondary" wire:click.prevent="addProduct">+ Add Another Product</button>
</div>
</div>
</div>
</div>
<hr>
{{-- <div class="form-row">
<div class="form-group col-md-3"> --}}
<button type="submit" class="form-control btn btn-small btn-primary">Add
Tariff</button>
{{-- </div>
</div> --}}
</form>
</div>
</div>
</div>
</div>
<!-- /.container-fluid -->
</div>
Then another thing I would recommend that you look into is using wire:key on the tr element inside your table-loop, and on the option element inside your inner loop. The value to wire:key should always be unique to that particular row, so using $loop->index is not generally advised. You can generate a dummy-ID for each record that you add to your array, which sole purpose is to track the individual row. Here's how, see the wire:key I added in the template,
<div class="container-fluid">
<!-- Begin Page Content -->
<!-- Page Heading -->
<div class="row">
<div class="col-lg-8">
<div class="card shadow mb-4">
<div class="card-header py-3">
<h6 class="m-0 font-weight-bold text-primary">Add Tariff</h6>
</div>
<div class="card-body">
<form wire:submit.prevent="storeTariff">
#csrf
<div class="form-row">
<!-- Default input -->
<div class="form-group col-md-8">
<input type="text" class="form-control" placeholder="Enter Tariff Name"
wire:model="tariffName">
</div>
</div>
<hr>
<div class="card">
<div class="card-header">
<h6 class="text-primary">Products, Basic and Weight Charges</h6>
</div>
<div class="card-body">
<table class="table" id="products_table">
<thead>
<tr>
<th>Product</th>
<th>Basic Charge</th>
<th>Weight Charge</th>
<th></th>
</tr>
</thead>
<tbody>
#foreach ($allTariff as $index => $value)
<tr wire:key="tariff-{{ $value->wireKey }}">
<td>
<select name="allTariff[{{ $index }}][productId]"
wire:model="allTariff.{{ $index }}.productId"
class="custom-select custom-select-sm form-control form-control-sm">
#foreach ($rowProducts as $product)
<option value="{{ $product->id }}" wire:key="product-{{ $product->id }}">
{{ $product->product_name }}
</option>
#endforeach
</select>
</td>
<td>
<input type="text" class="form-control form-control-user"
name="allTariff[{{ $index }}][basicCharge]"
placeholder="Basic Charge"
wire:model="allTariff.{{ $index }}.basicCharge" required>
</td>
<td>
<input type="text" class="form-control form-control-user"
name="allTariff[{{ $index }}][additionalCharge]"
placeholder="Weight Charge"
wire:model="allTariff.{{ $index }}.additionalCharge"
required>
</td>
</tr>
#endforeach
</tbody>
</table>
<div class="row">
<div class="col-md-12">
<button class="btn btn-sm btn-secondary" wire:click.prevent="addProduct">+ Add Another Product</button>
</div>
</div>
</div>
</div>
<hr>
{{-- <div class="form-row">
<div class="form-group col-md-3"> --}}
<button type="submit" class="form-control btn btn-small btn-primary">Add
Tariff</button>
{{-- </div>
</div> --}}
</form>
</div>
</div>
</div>
</div>
<!-- /.container-fluid -->
</div>
And then in your component, just generate a unique string
class AdminAddTariffsComponent
{
public $productId;
public $allTariff = [];
public $rowProducts = [];
public function mount()
{
$this->rowProducts = Products::all();
$this->addProduct();
}
public function addProduct()
{
$this->allTariff[] = [
'productId' => '',
'basicCharge' => '',
'additionalCharge' => '',
'wireKey' => \Str::uuid(),
];
}
public function render()
{
return view('livewire.admin.admin-add-tariffs-component')
->layout('layouts.admin.base');
}
}
Hi I have some more issues in my coding.when i have to changed my coding structure from div to table add to cart button not working.when it is working when it is in div but i have change to table cart button not working please help me to resolve my issue..
Code below is the old one (div) thats working fine here..
<?php if($microproduct['nr']){?>
<div class="product-box">
<div class="list" id="micropro">
<?php foreach ($microproduct['result'] as $resultmicroproduct){ ?>
<div class="row">
<div class="col-md-3">
<img src="images/feature-two-one.png" class="img-fluid mx-auto d-block">
</div>
<div class="col-md-7">
<div class="pro-desc">
<h5><?php echo $conn->stripval($resultmicroproduct['microsoft_product_legalname']);?></h5>
<p>Part number: <?php echo $conn->stripval($resultmicroproduct['microsoft_product_partnumber']);?></p>
<p>Item Name: <?php echo $conn->stripval($resultmicroproduct['microsoft_product_name']);?></p>
<p>Product family: <?php echo $conn->stripval($resultmicroproduct['microsoft_product_family']);?></p>
<h4><i class="fa fa-rupee"></i> <?php echo $conn->stripval($resultmicroproduct['microsoft_product_price']);?></h4>
</div>
</div>
<div class="col-md-2">
<div class="wrapper-div">
<input min="1" type="number" name="quantity<?php echo $resultmicroproduct['microsoft_product_id'] ?>" class="form-control" id="quantity" value="1" autocomplete="off">
<br>
<?php $postvalue = base64_encode(json_encode($resultmicroproduct)); ?>
<input type="hidden" name="type" value="microsoft_product">
<button class="btn btn-dark btn-sm add_to_cart" id="<?php echo $resultmicroproduct['microsoft_product_id'] ?>" >Add to Cart</button>
</div>
</div>
</div>
<?php } ?>
</div>
</div>
<?php } ?>
Code Below is the new one (table) cart button not working..
<table id="example" class="table table-striped table-bordered" style="width:100%">
<thead>
<tr>
<th>Image</th>
<th>Product Description</th>
<th>Quantity & Cart</th>
</tr>
</thead>
<?php if($microproduct['nr']){?>
<tbody>
<?php foreach ($microproduct['result'] as $resultmicroproduct){ ?>
<tr class="product-box">
<td><img src="images/feature-two-one.png" class="img-fluid mx-auto d-block"></td>
<td>
<div class="pro-desc">
<h5><?php echo $conn->stripval($resultmicroproduct['microsoft_product_legalname']);?></h5>
<p>Part number: <?php echo $conn->stripval($resultmicroproduct['microsoft_product_partnumber']);?></p>
<p>Item Name: <?php echo $conn->stripval($resultmicroproduct['microsoft_product_name']);?></p>
<p>Product family: <?php echo $conn->stripval($resultmicroproduct['microsoft_product_family']);?></p>
<h4><i class="fa fa-rupee"></i> <?php echo $conn->stripval($resultmicroproduct['microsoft_product_price']);?></h4>
</div>
</td>
<td>
<div class="wrapper-div">
<input min="1" type="number" name="quantity<?php echo $resultmicroproduct['microsoft_product_id'] ?>" class="form-control" id="quantity" value="1" autocomplete="off">
<br>
<input type="hidden" name="type" value="microsoft_product">
<button class="btn btn-dark btn-sm add_to_cart" id="<?php echo $resultmicroproduct['microsoft_product_id'] ?>">Add to Cart</button>
</div>
</td>
</tr>
<?php } ?>
</tbody>
<?php } ?>
<tfoot>
<th>Image</th>
<th>Product Description</th>
<th>Quantity & Cart</th>
</tfoot>
</table>
You don't even have a form.
<form action ="?" method="?">
//your inputs and submit
</form>
What do you expect to happen if you don't define what to do?
I'm kinda new here, just need help with small code.
I need to print specific area with a Print Payment Record that I've already added, I've added a new button, tried with another tutorial but I couldn't do it, with my other code print the entire page.
I know I can highlight the table and hit print but having a button is easier mostly when the record is like 50 payments.
Start in Deposit Fee in Details.
Help with these please!
This is my code:
#extends('branch.layout.main')
#section('title') Manage Fee #endsection
#section('content')
<div class="container">
<div class="section">
#section('button')
Deposit Fee
#endsection
<div class="row">
<div class="col s12 m12 l12">
<div class="card-panel">
<div class="row">
<h4 class="header2" style="color:#00bcd4"><i class="mdi-social-person" style="font-size:20px"></i> Fee Detail of {{ $student->first_name." ".$student->last_name }}</h4>
<table class="striped" >
<thead>
<tr>
<th>Current Course</th>
<th>Course Fee</th>
<th>Discount</th>
<th>Any Extra</th>
<th>Total Payable</th>
<th>Deposited Fee</th>
<th>Balance</th>
</tr>
<tr>
<td width="20%">{{ $course->courseName }}</td>
<td width="13%">{{ IMS::currency().$course->course_fee }}</td>
<td width="13%">{{ IMS::currency().$course->discount }}</td>
<td width="13%">{{ IMS::currency().$extra }}</td>
<td width="13%">{{ IMS::currency().$payable }}</td>
<td width="13%">{{ IMS::currency().$deposited }}</td>
<td width="13%"><span style="color:red">{{ IMS::currency().$balance }}</span></td>
</tr>
</thead>
</table>
</div>
</div>
</div>
</div>
</div>
<!--Deposited Fee in Detail-->
#if(count($fees) > 0)
<div class="row">
<div class="col s12 m12 l12">
<div class="card-panel">
<div class="row">
<h4 class="header2" style="color:#00bcd4"><i class="mdi-content-add" style="font-size:20px"></i> Deposited Fee of {{ $student->first_name." ".$student->last_name }}</h4>
<button onclick="printContent('row')">Print Payment Record </button>
<table class="striped" >
<thead>
<tr>
<th>Date Added</th>
<th>Amount</th>
<th>Course</th>
<th>Due Date</th>
<th>Option</th>
</tr>
#foreach($fees as $fee)
<tr>
<td width="20%">{{ date('d-M-Y',strtotime($fee->date_added)) }}</td>
<td width="20%">{{ IMS::currency().$fee->amount }}</td>
<td width="20%">{{ $fee->courseName }}</td>
<td width="20%">#if($fee->due_date) {{ date('d-M-Y',strtotime($fee->due_date)) }} #else --- #endif</td>
<td width="20%">
<i class="mdi-maps-local-print-shop"></i>
<i class="mdi-maps-local-print-shop"></i>
#if($delete)
<i class="mdi-content-clear"></i>
#endif
</td>
</tr>
#endforeach
</thead>
</table>
</div>
</div>
</div>
</div>
</div>
#endif
<!--End Deposited Fee in Detail-->
<!--Add New Fee-->
<div id="AddNew" class="modal modal-fixed-footer">
<div class="modal-content">
<h4 class="header2">Deposit Fee For {{ $student->first_name }} {{ $student->last_name }}</h4>
<form action="{{ Asset('fee/'.$student->id) }}" method="post">
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<div class="row">
<div class="input-field col s6">
<i class="mdi-editor-insert-invitation prefix"></i>
{!! Form::date('date_added',date('Y-m-d'),['id' => 'date_added','class' => 'datepicker']) !!}
<label for="date_added">Date Added *</label>
</div>
<div class="input-field col s6">
<i class="mdi-editor-attach-money prefix"></i>
{!! Form::number('amount',null,['id' => 'amount','required' => 'required','pattern' => '[0-9]{10}']) !!}
<label for="amount">Amount *</label>
</div>
</div>
<div class="row">
<div class="input-field col s6">
<select name="payment_mode">
<option>Please select Payment Type</option>
<option>Cash</option>
<option>Cheque</option>
<option>Card</option>
<option>Credit or Discount</option>
</select>
</div>
<div class="input-field col s6">
{!! Form::text('cheque_Card_Number', null, ['id' => 'cheque_Card_Number']) !!}
</div>
</div>
<p style="color:red"><i class="fa fa-bell"></i> If you want fee due reminder then select fee due date,if not then leave empty</p>
<div class="row">
<div class="input-field col s12">
<i class="mdi-editor-insert-invitation prefix"></i>
{!! Form::date('due_date',null,['id' => 'due_date','class' => 'datepicker']) !!}
<label for="due_date">Due Date</label>
</div>
</div>
<div class="modal-footer">
Close
<button type="submit" class="btn blue modal-action modal-close">Save</button>
</div>
</form>
</div>
</div>
<!--End Add New Fee-->
#endsection
I am new to Laravel and I am creating content management system as practice to get familiar with the framework. Currently, I am working on the feature for the user to preview the information they have entered for updating the new page they want to create and here is code for the view:
<div ng-controller="PagesController">
<form action="{{url('admin/page/preview')}}" method="post" name="pageForm">
<div class="col-md-9">
<div class="panel-body">
<div class="row">
<div class="form-group">
<label>Title</label>
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<input type="text" class="form-control input-md" name="title" ng-model="page.title">
</div>
<!-- <input type="submit" value="Preview"> -->
</div>
<div class="row">
<div class="form-group">
<fieldset style="border: 1px solid #E4E4E4; padding-top: 5px; padding-bottom: 5px;">
<div class="form-group">
<div class="col-md-5">
<label>Add File</label>
<input type="file" name="upload" nv-file-select uploader="updateUploader" value="Select Picture" ng-model="page.upload" >
</div>
<div class="col-md-6">
<table class="table">
<thead>
<tr>
<th>Name</th>
<th>Progress</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="item in updateUploader.queue">
<td style="max-width: 170px; word-wrap: break-word;" ng-cloak><strong>#{{ item.file.name}}</strong></td>
<td><div class="col-md-12"><progressbar value="item.progress"></progressbar></div></td>
<td nowrap ng-cloak>
<button type="button" class="btn btn-danger btn-xs" ng-click="item.remove()">
<span class="glyphicon glyphicon-trash"></span> Remove
</button>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</fieldset>
</div>
</div><br>
<div class="row">
<div class="form-group">
<label>Body</label>
<input type="hidden" name="body" value="#{{page.body}}"/>
<summernote name="body" ng-model="page.body" config="options" height="300"></summernote>
<div ng-messages="pageForm.body.$error" ng-if="pageForm.body.$dirty">
<div ng-message="required">
<span class="error-msgs">Please enter page information</span>
</div>
</div>
</div>
</div>
<br/>
<div class="row">
<div class="form-group">
<div class="col-md-12 text-left">
</div>
</div>
</div>
</div>
<div class="row">
<div class="form-group">
<div class="checkbox col-md-12 text-left">
<label><input type="checkbox" value="" ng-model"page.serivice" ng-false-value="0" ng-true-value="1" ><strong>Update page to services</strong></label>
</div>
</div>
</div>
<div class="row">
<div class="form-group">
<div class="col-md-12 text-left">
<button type="button" class="btn btn-success" name="update" ng-disabled="pageForm.$invalid" ng-click="update()">Update</button>
<input type="submit" class="btn btn-default btn-md" value="Preview">
</div>
</div>
</div>
</div>
<div class="col-md-3">
<div class="panel panel-default general-panel publish" style="margin-top: 35px;">
<div class="panel-heading">
<div class="title">Navigation</div>
</div>
<div class="panel-body">
<span class="">
<i></i><strong>Parent pages</strong>
<div class="btn-group">
<select class="form-control" name="publish_period" ng-model="page.parent_nav">
<option value="">No Parent Navigation</option>
<option value="about-us">About Us</option>
<option value="media">Media</option>
<option value="publication">Publication</option>
<option value="law">Law</option>
<option value="legislation">Legislation</option>
<option value="compliance">Compliance</option>
<option value="license">Applying For License</option>
</select>
</div><br><br>
</span>
</div>
</div>
<div class="panel panel-default general-panel general-summary">
<div class="panel-body">
<table class="table">
<thead>
<tr>
<th colspan="3"><h5>Uploaded Documents</h5></th>
</tr>
</thead>
<tbody>
<tr ng-repeat="document in documents">
<td style="max-width: 100px; word-wrap: break-word;">#{{document.file_path}}</td>
<td>
<i class="fa fa-download fa-fw"></i>Download
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</form>
</div>
Here is the code for the route for previewing the page:
Route::post('page/preview','PagesController#preview');
and the controller method for the preview function:
public function preview(Request $request)
{
return view('admin.pages.preview')->with('title',$request->input('title'))->with('body',$request->input('body'));
}
This works for me, but when I refreshed the preview page it would generate an error saying BadMethodCallException. So I am wondering how can eliminate this from happening? and thanks in advance.