How to automatically delete all related rows in Laravel Eloquent?

When I delete a user I want to delete all his records, for example, notifications, photos, posts, etc.
In my User model, I have hasMany relationship so how can I delete all the records automatically just by deleting the user?
Here is the user model

<?php

class User extends Eloquent
{
    public function notifications()
    {
        return $this->hasMany('Notification');
    }
    public function photos()
    {
        return $this->hasMany('Photo');
    }
    public function posts()
    {
        return $this->hasMany('Post');
    }
}

Here is the delete method.

$user = User::where('id', '=', $user_id);
if ( $user ->exists() ) {
    $user->delete();
}

Write the delete function in your user model and this should work.

class User extends Eloquent
{
    public function notifications(){
        return $this->hasMany('Notification');
    }
    public function photos(){
        return $this->hasMany('Photo');
    }
    public function posts(){
        return $this->hasMany('Post');
    }

    // delete all related records
    public function delete() {
        $this->notifications()->delete();
        $this->photos()->delete();
        $this->posts()->delete();

        // delete the user
        return parent::delete();
    }
}