tengo una vista que me trae los datos de mi db
entonces lo que quiero ahora es actualizar mi db
<div class="col-10" id="side2">
<div class="container" style="background-color: #e3e6e9; margin-top: 1rem; height:95%; padding: 2rem 1rem 1rem 1rem;">
<div class="container" style="background-color: #f0f3f5; height: 100%; border-radius: 5px 5px 0px 0px;">
<!-- TITLO -->
<div class="row justify-content-between" style="box-shadow: 0px 0px 10px 1px rgba(0, 0, 0, 0.47);
border-radius: 5px;
background: #f0f3f5;
padding: 0.7rem 0.2rem 0.2rem 0.2rem;">
<div class="col-6">
<h4 style="color: #0b4650;"><strong>HOME/EDIT</strong></h4>
</div>
<div class="col-6" style="text-align: right; padding-right: 3rem;">
<p style="color:gray;">ÚLTIMA EDICIÓN {{ $sectionInfo->updated_at }}</p>
</div>
</div>
<!-- ___________________FORMULARIO___________________ -->
<form method="POST" action="{{ route('home') }}">
<!-- BOTONES GUARDAR / CERRAR -->
<div class="row" style=" text-align: right;
margin-top: 1rem;
margin-bottom: 1rem;">
<div class="col-12">
<button type="button" class="btn" style="background: #065e6e; color: white; width: 7rem;">CERRAR</button>
<button type="SUBMIT" class="btn" style="background: #00a751; color: white; width: 7rem;">ACTUALIZAR</button>
</div>
</div>
<!-- TITULOS -->
<div class="row">
<div class="col-6" style="padding-left: 3px; margin-bottom: 1rem;">
<input type="text" value="{{ $sectionInfo->titu_1_ing }}" style=" width: 100%; padding: 0.3rem; background: #e3e6e9;
border: solid 1px #8181825c;" text="PRIVATE ESCRUSSION IN SANTIAGO DE CHILE">
</div>
<div class="col-6" style="padding-right: 3px; margin-bottom: 1rem;">
<input type="text" value="{{ $sectionInfo->titu_1_esp }}" style="width: 100%; padding: 0.3rem; background: #e3e6e9;
border: solid 1px #8181825c;">
</div>
</div>
<!-- DESCRIPCION -->
<div class="row">
<div class="col-6" style="padding-left: 3px; margin-bottom: 1rem;">
<textarea name="message" rows="30" cols="80" style=" width: 100%; padding: 0.8rem; height: 10rem; background: #e3e6e9; border: solid 1px #8181825c;">{{ $sectionInfo->desc_1_ing }}</textarea>
</div>
<div class="col-6" style="padding-right: 3px; margin-bottom: 1rem;">
<textarea name="message" rows="30" cols="80" style=" width: 100%; padding: 0.8rem; height: 10rem; background: #e3e6e9; border: solid 1px #8181825c;">{{ $sectionInfo->desc_1_esp }}</textarea>
</div>
</div>
<hr/>
<!-- CARGAR IMAGENES -->
<div class="row">
<div class="col-6">
<h4>IMÁGENES DESKTOP</h4>
</div>
<div class="col-6">
<h4>IMÁGENES MÓVIL</h4>
</div>
</div>
<div class="row">
<div class="col-6">
<input type="file" id="files" name="files[]" />
<br />
<div style="width: 5rem; height: 5rem;">
<output id="list"></output>
</div>
</div>
<div class="col-6">
<input type="file" id="files" name="files[]" />
<br />
<output id="list"></output>
</div>
</div>
y este es mi controlador
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Section;
class HomeController extends Controller
{
public function index()
{
$sectionInfo = Section::find(1);
// let hora = $sectionInfo->updated_at;
// hora = hora[9];
// $sectionInfo->updated_at = hora;
return view("home", compact('sectionInfo'));
}
Ignoren la parte de las imagenes aun estoy trabajando en ello, lo que necesito saber es como actualizar mis campos en la db ????
**
ACTUALIZACION
** Hice lo siguiente, desde mi vista hice el formulario normal con los input que se llaman igual que mis columnas,
<form method="POST" action="{{ route('home_update') }}">
{{ csrf_field() }}
<!-- TITULO -->
<div class="row justify-content-between" style="box-shadow: 0px 0px 10px 1px rgba(0, 0, 0, 0.47);
border-radius: 5px;
background: #f0f3f5;
padding: 0.7rem 0.2rem 0.2rem 0.2rem;">
<div class="col-6">
<h4 style="color: #0b4650;"><strong>HOME/EDIT</strong></h4>
</div>
<div class="col-6" style="text-align: right; padding-right: 3rem;">
<input style="color: gray; border: none; width: 17rem; background: none;" value="ÚLTIMA EDICIÓN {{ $sectionInfo->updated_at }}" class="field left" readonly="readonly" name="updated_at">
</div>
</div>
<!-- BOTONES GUARDAR / CERRAR -->
<div class="row" style=" text-align: right;
margin-top: 1rem;
margin-bottom: 1rem;">
<div class="col-12">
<button type="button" class="btn" style="background: #065e6e; color: white; width: 7rem;">CERRAR</button>
<button type="SUBMIT" class="btn" style="background: #00a751; color: white; width: 7rem;">ACTUALIZAR</button>
</div>
</div>
<!-- TITULOS -->
<div class="row">
<div class="col-6" style="padding-left: 3px; margin-bottom: 1rem;">
<input type="text" name="titu_1_ing" value="{{ $sectionInfo->titu_1_ing }}" style=" width: 100%; padding: 0.3rem; background: #e3e6e9;
border: solid 1px #8181825c;">
</div>
<div class="col-6" style="padding-right: 3px; margin-bottom: 1rem;">
<input type="text" name="titu_1_esp" value="{{ $sectionInfo->titu_1_esp }}" style="width: 100%; padding: 0.3rem; background: #e3e6e9;
border: solid 1px #8181825c;">
</div>
</div>
<!-- DESCRIPCION -->
<div class="row">
<div class="col-6" style="padding-left: 3px; margin-bottom: 1rem;">
<textarea name="desc_1_ing" rows="30" cols="80" style=" width: 100%; padding: 0.8rem; height: 10rem; background: #e3e6e9; border: solid 1px #8181825c;">{{ $sectionInfo->desc_1_ing }}</textarea>
</div>
<div class="col-6" style="padding-right: 3px; margin-bottom: 1rem;">
<textarea name="desc_1_esp" rows="30" cols="80" style=" width: 100%; padding: 0.8rem; height: 10rem; background: #e3e6e9; border: solid 1px #8181825c;">{{ $sectionInfo->desc_1_esp }}</textarea>
</div>
</div>
<hr/>
<!-- CARGAR IMAGENES -->
<div class="row">
<div class="col-6">
<h4>IMÁGENES DESKTOP</h4>
</div>
<div class="col-6">
<h4>IMÁGENES MÓVIL</h4>
</div>
</div>
<div class="row">
<div class="col-6">
<input type="file" id="files" name="files[]" />
<br />
<div>
<output id="list"></output>
</div>
</div>
<div class="col-6">
<input type="file" id="files" name="files[]" />
<br />
<div>
<output id="list"></output>
</div>
</div>
</div>
</form>
todo bien hasta ahi, luego ese formulario llama la ruta Route::POST('home_update', 'HomeController@update')->name('home_update');
y en ese metodo tengo lo siguiente :
public function update(Request $request)
{
$sectionInfo = Section::find(1);
$section->titu_1_ing = request('titu_1_ing');
$section->titu_1_esp = request('titu_1_esp');
$section->desc_1_ing = request('desc_1_ing');
$section->desc_1_esp = request('desc_1_esp');
$section->save();
return "Ok";
}
Siento que falta algo poruqe me sale el siguiente error: "Parse error: syntax error, unexpected 'Section' (T_STRING), expecting ')'"
y apunta a la siguiente linea: public function update(Request $request Section $sectionInfo)
y si le quito el Section y el $sectionInfo me dice lo siguiente: "Creating default object from empty value"
y apunta a la linea
$section->titu_1_ing = request('titu_1_ing');