This is a weird error. I can add a new record to the database fine with a new UserEdit method, but if I try to update a record. Nothing. It doesn't even file a blank value, or issue an error.
What am I missing? To try to eliminate issues, I tried running the core update method in the documentation like so:
protected function create()
{
$save = UserEdit::find(715);
$save->First_Name = 'Jeffrey';
$save->Last_Name = 'Way';
$save->save();
$id = UserEdit::find(715)->toArray();
return view('NewUser', compact('id'));
//return $array;
}
This problem is the same as my earlier question here , but I didn't think it appropriate to double up the questions and this is technically a different problem. My blade just prints an array of the user data at the moment so I know if it's working or not:
@extends('layout')
@section('content')
<h1> Add Your Information {{ $id['name'] }}</h1>
<div class="col-md-6">
@foreach ($id as $key=>$value)
{{ $value }}<br>
@endforeach
</div>
@stop
The Routes:
<?php
Route::get('/', function () {
return view('welcome');
});
Auth::routes();
Route::get('/home', 'HomeController@index');
Route::get('NewUser', 'UserEntryController@create');
Route::post('NewUser', 'UserEntryController@UserForm');
Route::post('NewUser', 'UserEntryController@UserForm')->name('submit');
I'm assuming I'm missing some crucial minor detail, but for the life of me, can't find what. Anybody got an idea where to look?
public function store(Request $request)
{
$user = new UserEdit;
//$user->name = $request->name;
$user->First_Name = "foo";
$user->Last_Name = "bar";
$user->save();
return $user;
}
Try this function, maybe you had a mistake in your code.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.