Using laravel to create a website for readers and authors to post and discuss books. Working on a My accounts page where users can update their details. Was working until i added the about you section, now everything updates ok to the database but brings this error. I will add the respected code snippets, if you could help me out would be great.
use Auth;
use Session;
class ProfileController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
return view('admin.users.profile')->with('user', Auth::user());
}
public function update(Request $request)
{
$this->validate($request, ['name' => 'required','email' => 'required|email']);
$user = Auth::user();
$user->name = $request->name;
$user->email = $request->email;
$user->about = $request->about;
$user->save();
if($request->has('password' == 'confirmPassword'))
{
$user->password = bcrypt($request->password);
$user->save();
}
Session::flash('success', 'Profile updated.');
return redirect()->back();
}
<div class="form-group">
<label for="about">About You</label>
<textarea name="about" value="" id="about" cols="6" rows="6" class="form-control"></textarea>
</div>
<div class="form-group">
<div class="text-centre">
<button class="btn btn-success" type="submit">
Save Changes
</button>
class User extends Authenticatable
{
use Notifiable;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'name', 'email', 'password', 'about'
];
/**
* The attributes that should be hidden for arrays.
*
* @var array
*/
protected $hidden = [
'password', 'remember_token',
];
class UsersController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
$user = users::all();
$name = 'name';
$email = 'email';
$password = 'password';
$about = 'about';
return view('admin.users.index');
}
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2WwP55T
via IFTTT
Aucun commentaire:
Enregistrer un commentaire