Laravel Relationships: Touching Parent Timestamps

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Comment extends Model
{
    /**
     * All of the relationships to be touched.
     *
     * @var array
     */
    protected $touches = ['post'];

    /**
     * Get the post that the comment belongs to.
     */
    public function post()
    {
        return $this->belongsTo('App\Post');
    }
}
$comment = App\Comment::find(1);

$comment->text = 'Edit to this comment!';

$comment->save();

Laravel Relationships: Touching Parent Timestamps — Structure map

Clickable & Draggable!

Laravel Relationships: Touching Parent Timestamps — Related pages: