hybridword

1820 经验值

是的,我这个是编辑的,属于更新发布时间

还有附上控制器的代码

 public function update($art_id)
    {
        $input = Input::except('_token','_method');
        $re = Article::where('art_id',$art_id)->update($input);
        // return $input['art_schedule'];
        // exit();
        if($re){
            return redirect('admin/draftBox');
        }else{
            return back()->with('errors','文章更新失败,请稍后重试!');
        }
    }

试过这2种方法都不可以呢。附上我model的代码

<?php

namespace App\Http\Model;

use Illuminate\Database\Eloquent\Model;
use Carbon\Carbon;

class Article extends Model
{
    protected $table='article';
    protected $primaryKey='art_id';
    protected $guarded=[];

   public function setArtScheduleAttribute($date)
   {
    $this->attributes['art_schedule'] = Carbon::createFromFormat('Y-m-d',$date)->toDateTimeString();
   }

}

2017-02-22,这样的,那我该怎么获取后面的格式呢?

我直接在model里面定义这方法

 public function setArtScheduleAttribute($art_schedule)
   {
    $this->attributes['art_schedule'] = Carbon::createFromFormat('Y-m-d',$art_schedule);
   }```
然后数据库的格式是这样的
2017-02-22 00:00:00
我blade表单的是这样定义的
```<input type="date" name="art_schedule" value="{$field->art_schedule}">```
是哪里出错了呢

sudo chown -R :www-data /var/www/laravel,还是chown -R www-data:www-data /var/www/testapp?你上面这个命令呢?

Stack trace:
0 /var/www/testapp/vendor/monolog/monolog/src/Monolog/Handler/RotatingFileHandler.php(107): Monolog\Handler\StreamHandler->write(Array) 1 /var/www/testapp/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php(37): Monolog\Handler\RotatingFileHandler->write(Array) 2 /var/www/testapp/vendor/monolog/monolog/src/Monolog/Logger.php(337): Monolog\Handler\AbstractProcessingHandler->handle(Array) 3 /var/www/testapp/vendor/monolog/monolog/src/Monolog/Logger.php(616): Monolog\Logger->addRecord(400, Object(Symfony\Component\Debug\Exception\FatalErrorException), Array) 4 /var/www/testapp/vendor/laravel/framework/src/Illuminate/Log