I have an issue I cannot update my user table . I don't know where he problem is.Whenever I submit my updated info it cannot updated. It Does not show any error. But the table is not updated. Please Help me guys. My Controller is
public function getUpdate() {
$profile = Auth::user();
return view('admin.article.edit')
->with('profile',$profile);
}
public function postUpdate(Request $request ) {
$profile = Auth::user();
$this->validate($request, [
'name' => 'required|max:120',
'username' => 'required|max:80',
'email' => 'required',
'password' => 'required'
]);
// save users table
$profile = Auth::user();
// $user = new App\User;
$profile->name = $request->input('name');
$profile->email = $request->input('email');
$profile->username = $request->input('username');
$profile->password = $request->input('password');
$profile->update();
}
My edit.blade.php page is
<?php $active="profile"; ?>
@extends('admin.dashboard')
@section('content')
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
User Profile
</h1>
<ol class="breadcrumb">
<li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
<li class="active">User profile</li>
</ol>
</section>
<!-- Main content -->
<section class="content">
<div class="row">
<!-- left column -->
<div class="col-md-10">
<!-- general form elements -->
<div class="box box-primary">
<div class="box-header with-border">
<h3 class="box-title">Quick Example</h3>
</div>
<!-- /.box-header -->
<!-- form start -->
<form action="" role="form" method="post" enctype="multipart/form-data">
<div class="box-body">
<div class="form-group">
<label for="name">Name</label>
<input type="text" class="form-control" name="name" id="name" value="">
</div>
<div class="form-group">
<label for="username">User Name</label>
<input type="text" class="form-control" name="institute" id="institute" value="">
</div>
</div>
<!-- /.box-body -->
<div class="box-footer">
<button type="submit" class="btn btn-primary">Submit</button>
<input type="hidden" name="_token" value="">
<input type="hidden" name="id" value="">
</div>
</form>
</div>
<!-- /.box -->
</div>
<!--/.col (left) -->
</div>
<!-- /.row -->
</section>
<!-- /.content -->
@endsection
My route file is
Route::get('/profile/edit', [
'uses' => 'ProfileController@getUpdate',
'as' => 'edit'
]);
Route::post('profile/update', [
'uses' => 'ProfileController@postUpdate',
'as' => 'update'
]);
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire