public function record(Model $model = null, $name, $user = null)
    {
        if ( ! $this->isEnabled())
        {
            return false;
        }

        $activity = $this->initActivity();

        // Auto determine user if none is supplied
        $user = $this->getUserId($user);

        $data = [
            'name'    => $name,
            'user_id' => $user
        ];

        if ($model)
        {
            $data['subject_id'] = $model->getKey();
            $data['subject_type'] = get_class($model);
        }

        $activity->fill($data);

        $activity->save();

        return $activity;
    }
public function record(Model $model = null, $name, $user = null)
    {
        if ( ! $this->isEnabled())
        {
            return false;
        }

        $activity = $this->initActivity();

        // Auto determine user if none is supplied
        $user = $this->getUserId($user);

        $data = [
            'name'    => $name,
            'user_id' => $user
        ];

        if ($model)
        {
            $data['subject_id'] = $model->getKey();
            $data['subject_type'] = get_class($model);
        }

        $activity->fill($data);

        $activity->save();

        return $activity;
    }
public function record ( Model $ model = null , $ name , $ user = null ) { if ( ! $ this -> isEnabled ( ) ) { return false ; } $ activity = $ this -> initActivity ( ) ; // Auto determine user if none is supplied $ user = $ this -> getUserId ( $ user ) ; $ data = [ 'name' => $ name , 'user_id' => $ user ] ; if ( $ model ) { $ data [ 'subject_id' ] = $ model -> getKey ( ) ; $ data [ 'subject_type' ] = get_class ( $ model ) ; } $ activity -> fill ( $ data ) ; $ activity -> save ( ) ; return $ activity ; }
Records an activity

@param Model $model
@param string $name
@param Model|int $user
@return Model
Records an activity