语法错误,意外的文件结尾(查看:/opt/lampp/htdocs/stdproject/smarttd/resources/views/admin/company/index.blade.php)“
我附上了index.blade.php的源代码
@extends('admin.layouts.inc.master')
@section('title','Company Information')
@push('css')
@endpush
@section('content')
<div class="col-12">
@include('admin.alert')
</div>
<div class="col-md-12">
<div class="card card-primary card-outline">
<div class="card-header">
<h5 class="m-0" id="heading">
@if(count($companies) >0)
Edit existing company
@else
Add new company
@endif
</h5>
</div>
<form action="" id="company-form" method="POST" enctype="multipart/form-data">
@if(count($companies) >0)
@method('PUT')
@endif
@csrf
<div class="card-body">
<div class="row">
<div class="col-6 mt-3">
<label for="company_name">Company Name</label>
<input type="text" class="form-control" id="company_name" name="company_name">
@error('company_name')
<small class="text-danger">{{ $message }}</small>
@enderror
</div>
<div class="col-6 mt-3">
<label for="company_logo">Company Logo</label>
<input type="file" class="form-control" id="company_logo" name="company_logo">
@error('company_logo')
<small class="text-danger">{{ $message }}</small>
@enderror
</div>
<div class="col-12 mt-3">
<label for="company_address">Company Address</label>
<textarea name="company_address" id="company_address" rows="4" class="form-control"></textarea>
@error('company_address')
<small class="text-danger">{{ $message }}</small>
@enderror
</div>
<div class="col-6 mt-3">
<label for="company_country">Company Country</label>
<input type="text" class="form-control" id="company_country" name="company_country">
@error('company_country')
<small class="text-danger">{{ $message }}</small>
@enderror
</div>
<div class="col-6 mt-3">
<label for="company_phone">Company Phone</label>
<input type="tel" class="form-control" id="company_phone" name="company_phone">
@error('company_phone')
<small class="text-danger">{{ $message }}</small>
@enderror
</div>
<div class="col-6 mt-3">
<label for="company_email">Company Email</label>
<input type="Email" class="form-control" id="company_email" name="company_email">
@error('company_email')
<small class="text-danger">{{ $message }}</small>
@enderror
</div>
<div class="col-6 mt-3" >
<label for="company_gst">Company GST</label>
<input type="text" class="form-control" id="company_gst" name="company_gst">
@error('company_gst')
<small class="text-danger">{{ $message }}</small>
@enderror
</div>
</div>
</div>
<div class="card-footer">
<div class="row">
<div class="col-6">
<button onclick="companyFormSubmit()" class="btn btn-primary">Save Company Details</button>
</div>
<div class="col-6 text-right">
<a href="{{ route('admin.dashboard') }}" class="btn btn-secondary">Back</a>
</div>
</div>
</div>
</form>
</div>
</div>
@stop
@push('js')
<script>
function companyFormSubmit() {
var heading =$('#heading').val();
@if(heading=='Add new Company')
{
$('#company-form').attr('action','{{ route('admin.company.store') }}').submit();
}
@@endif
}
</script>
@endpush
问题是在@push('js')
中有@@endif
而不是@endif
。
在刀片中,@@
用于输出单个@
,因此@@endif
不会被解释为@if
块的结尾。
请参阅刀片文档。