首页 > 解决方案 > 语法错误,意外的 '__data' (T_STRING),需要 ',' 或 ')' (查看:C:\xampp\htdocs\boxe\resources\views\utenteShow.blade.php)

问题描述

我需要解决这个问题,当我按下记录按钮时,程序应该把我带到刚刚注册的用户的页面上,但我得到这个错误:

错误:

语法错误,意外的 '__data' (T_STRING),需要 ',' 或 ')' (查看:C:\xampp\htdocs\boxe\resources\views\utenteShow.blade.php)

路线:

Route::post('/registrazione/store','RegistrazioniController@store')->name('registrazione.store');

Route::get('/registrazione/{utente}','RegistrazioniController@show')->name('utente.show');

控制器:

public function store(tabella_utenti $utente)
{
    $this->validate (request(),[
        'email' => 'required',
        'password' => 'required',
        'NomeUtente' => 'required'
    ]);
    $utente=tabella_utenti::create(request(['email','password','NomeUtente']));

    //comando che gli passa l'id
    $utente=tabella_utenti::all();
    $utenteId=$utente->id;
    return redirect(route('utente.show',compact('utenteId')));

}

public function show(tabella_utenti $utente)
{
    return view('utenteShow',compact('utente'));
}

看法:

@extends('layouts.layout)

@section('body')
    <h1>Pagina Utente</h1>

        @foreach($utente as $value)
        Nome:{{$value->NomeUtente}}

        @endforeach

@endsection

标签: php

解决方案


您在视图的扩展参数中缺少结束引号。

它应该是@extends('layouts.layout')


推荐阅读