我无法将数据存储在数据库中。 我在Carbon.php第582行得到了一个' InvalidArgumentException' -error:
我的代码:
public function store(){
$rules = array(
'news_date' => 'required',
'title' => 'required'
);
$validator = Validator::make(Input::all(), $rules);
if ($validator->fails()) {
return Redirect::to('NewsFeed/create')
->withErrors($validator)
->withInput();
}$feed= new Feed;
$feed->title = Input::get('title');
$feed->description = Input::get('description');
$feed->related_links = Input::get('links');
$feed->input_user = Input::get('input_user');
$date = Input::get('news_date');
if($date!="")
{
$res_news_date=explode("-",$date);
$news_date=$res_news_date[2]."-".$res_news_date[1]."-".$res_news_date[0];
$feed->date = $news_date;
}
$expires = Input::get('news_end_date');
if($expires!="")
{
$res_expiry_date=explode("-",$expires);
$expire_date=$res_expiry_date[2]."-".$res_expiry_date[1]."-".$res_expiry_date[0];
$feed->expires_on = $expire_date;
}
$feed->save();
}
我的Feed模式:
class Feed extends Model
{
protected $table = 'feed_news';
use SoftDeletes;
protected $softDelete = true;
protected $dates = ['expires_on'];
}
我做错了什么?