我提交编辑后的表格后,数据库中没有任何变化,我想进一步解释,但是对我来说英语很难,希望您能理解。 好吧,我想对个人资料进行更新:
这是我的看法:
<div class="row contact_form_row">
<div class="col">
<div class="contact_form_container">
<form method="PUT" action="{{ route('profile.update',auth()->id()) }}" class="contact_form text-center" id="contact_form">
{{ csrf_field() }}
{{ method_field('PUT') }}
<div class="row">
@foreach ($infos as $infos)
<div class="col-lg-6">
<div class="col-lg-12">
<label> Nom : </label>
<input type="text" class="contact_input" name="name" value="{{$infos->name}}" required="required">
</div>
<label> E-mail : </label>
<div class="col-lg-12">
<input type="text" class="contact_input" name="email" value="{{$infos->email}}" required="required">
</div>
<div class="col-lg-12">
<label> Numero de telephone : </label>
<input type="text" class="contact_input" name="tele_user" value="{{$infos->tele_user}}" required="required">
</div>
<div class="col-lg-12">
<label> Adresse personnalisée : </label>
<input type="text" class="contact_input" name="adresse" value="{{$infos->adresse}}" required="required">
</div>
</div>
<div class="col-lg-12">
<label> Presentation : </label>
<textarea class="contact_textarea contact_input" name="presentation" placeholder="presentation" required="required">{{$infos->presentation}}</textarea>
</div>
@endforeach
<button class="contact_button right" type="submit">Valider!</button>
</div>
</form>
</div>
</div>
</div>
这是我的控制器:
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use DB;
use App\User;
use App\users;
use App\http_request;
class ProfileController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
//
$infos = DB::table('users')
->where('users.id',auth()->user()->id)
->join('ville','ville.ID_Ville','=','users.ID_Ville')
->join('region','region.ID_REGION','=','ville.ID_REGION')
->get();
return view('profile')->with('infos',$infos);
}
public function update(Request $request, $id)
{
//$user = users::find($id);
$user = DB::table('users')
->select('users.*')
->where('user.id', $id);
$user->nom =$request->input('nom');
$user->email =$request->input('email');
$user->tele_user =$request->input('tele_user');
$user->adresse =$request->input('adresse');
$user->presentation =$request->input('presentation');
$user->save();
$infos = DB::table('users')
->where('users.id',auth()->user()->id)
->join('ville','ville.ID_Ville','=','users.ID_Ville')
->join('region','region.ID_REGION','=','ville.ID_REGION')
->get();
return view('/profile')->with('infos',$infos);
}
}
提交后,我得到的是白页,而不是带有/ url的视图/ profile:
http://localhost/testprojet/public/profile/1?_token=R4cTYZuLPX9shqkg0i2JKoCwx7g23PbRc5Vhke5A&_method=PUT&name=Othmaneee&email=othmane.messaoud%40gmail.com&tele_user=642213124&adresse=Maroc%2C+Rabat+Al+Irfan+ENSIAS&presentation=je+m%27appelle+othmane+
表示信息已传递,但数据库中没有任何变化 请帮忙
答案 0 :(得分:0)
您缺少一个 } 在文件末尾关闭课程
PHP Syntax Check: Parse error: syntax error, unexpected end of file, expecting function (T_FUNCTION) or const (T_CONST) in your code on line 49