3
Good afternoon. I have the following code that saves perfectly.
public function store(Request $request)
{
$this->validate($request, [
'servidor' => 'required|unique:servidors|max:255',
// 'dtprotocolo' => 'date|date_format:Y-m-d',
]);
Servidor::create($request->all());
Session::flash('create_servidor', 'Servidor cadastrado com sucesso!');
return redirect(route('servidor.index'));
}
However I would like to change the value $request->server to uppercase. How to proceed?
$comUpper = strtoupper($request->server); not right?
– Anderson Henrique
From, $request->server= strtoupper($request->server), but when I save to the database, Server::create($request->all()), it goes back to the original.
– Juliano
Juliano the answer was the answer to his question accepted as an answer
– novic
Try this: $data = $request->all(); $data['server'] = strtoupper($data['server']); Server::create($data);
– Marcos Xavier