Laravel error: Call to a member function format() on string

In your Article class add following property:

From Laravel 10.x

/**
 * The attributes that should be mutated to dates.
 *
 * @var array
 */


protected $casts = [ 'expired_at'=>'datetime'];

Laravel 10 Upgrade

Before Laravel 10.x you could use

/**
 * The attributes that should be mutated to dates.
 *
 * @var array
 */
protected $dates = ['expired_at'];

Docs

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)