syntax error, unexpected token "<" (View: /Users/pathparakh/Projects/store/resources/views/product.blade.php) in laravel?

All we need is an easy explanation of the problem, so here it is.

There are an error showing when i add @if ({{Auth::user()->utype}} == "ADM") Line of code in product.blade.php.

@if ({{Auth::user()->utype}} == "ADM")



This is my controller named ProductController.

public function index()
    $products = Product::all();
    return view('product', compact('products'));

public function create()
    return view('product');

public function store(Request $request)
        'name' => 'required',
        'brand' => 'required',
        'detail' => 'required',
        'size' => 'required',
        'type' => 'required',
        'price' => 'required',
        'image' => 'required',
    $image = $request->file('image');
    $new_name = rand().'.'.$image->getClientOriginalExtension();
    $image->move(public_path('images'), $new_name);
    $form_data = array(
        'image' => $new_name,
        'name' => $request->input('name'),
        'size' => $request->input('size'),
        'type' => $request->input('type'),
        'price' => $request->input('price'),
        'detail' => $request->input('detail'),
        'brand' => $request->input('brand'),

    return redirect()->route('product.index')->withSuccess('Done');

enter image description here
Please help me to solve the mistake.

How to solve :

I know you bored from this bug, So we are here to help you! Take a deep breath and look at the explanation of your problem. We have many solutions to this problem, But we recommend you to use the first method because it is tested & true method that will 100% work for you.

Method 1

You are already using blade directive, so no need to put {{}}, inside @if or any other directive try this

@if (Auth::user()->utype == "ADM")



Note: Use and implement method 1 because this method fully tested our system.
Thank you 🙂

Leave a Reply