Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

cugurel's avatar

Use of undefined constant warning

Hi friend. I want to create a blade provides to import and export but when i click the page it says

Use of undefined constant warning - assumed 'warning' (this will throw an Error in a future version of PHP) (View: /home/vagrant/code/excel/resources/views/customers.blade.php)

And my Form is like this;

    @extends('layouts.app')

    @section('content')
    <div class="panel-heading">Import and Export Data Into Excel File</div>

    <div class="panel-body">
    {!!Form::open(array('route'=>'customer.import','method'=>'POST','files'=>'true')) !!}
    <div class="row">
        <div class="col-xs-10 col-sm-10 col-md-10">
            @if(Session::has('success'))
                <div class="alert alert-success">
                    {{Session :: get('message')}}
                </div>
            @endif
            @if(Session::has(warning))
                <div class="alert alert-warning">
                    {{Session::get('message')}}
                </div>
            @endif
            <div class="form-group">
                {!! Form::label('sample_file','Select File to Import:',['class'=>'col-md-3']) !!}
                <div class="col-md-9">
                    {!! Form::file('customers',array('class'=>'form-control')) !!}
                    {!! $errors->first('products','<p class="alert alert-danger">:message</p') !!}
                </div>
            </div>
        </div>
        <div class="col-xs-2 col-sm-2 col-md-2 text-center">
            {!! Form::submit('Upload',['class'=>'btn btn-success']) !!}
        </div>
    </div>
    {!! Form::close() !!}
</div>
@endsection

Can you please help me how can i correct this error?

0 likes
2 replies
AlexDemin's avatar
Level 16

Very simple :)

@if(Session::has(warning)) -> @if(Session::has('warning'))

Please or to participate in this conversation.