mercredi 15 février 2017

Laravel 5 How to submit dates to SQL database

I've been stuck for days, I can't get my dates to save to my database and having issue after issue. Can someone recommend a video/article or just plain explain on how to fully deal with dates?

Migration

    $table->dateTime('start_date');
    $table->dateTime('end_date');

Controller

public function store(Request $request)
{
  $this->validate(request(), [

    'name' => 'required',
    'description' => 'required',
    'status' => 'required',
    'startdate' => 'required',
    'enddate' => 'required'

  ]);

 Event::create(request(['name', 'description', 'status', 'start_date', 'end_date']));

    return redirect('/events');
}

Model

THIS IS OBVIOUSLY THE ISSUE and I would paste things but theres multiple things I've put here and nothing works.

This is the dd of the request

 +request: ParameterBag {#40 ▼
#parameters: array:6 [▼
  "_token" => "yjU5A0Z5dpRES7KWK82fRMbHMRQkaooe27vYKlo7"
  "name" => "My first event"
  "status" => "Inquery"
  "description" => "this is my desc"
  "start_date" => "02/16/2017 6:36 PM"
  "end_date" => "02/24/2017 6:37 PM"
]



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2kzFUuE
via IFTTT

Aucun commentaire:

Enregistrer un commentaire