spatie / activitylog

A very simple activity logger to monitor the users of your website or application
https://spatie.be/opensource/laravel
MIT License
582 stars 75 forks source link

Call to undefined method Illuminate\Database\Query\Builder::log() #1

Closed ChristopherDosin closed 9 years ago

ChristopherDosin commented 9 years ago

Hey, great package if it works.

Currently i am getting the above error. I use the log in my controller after the save method

        use Spatie\Activitylog\Models\Activity;

        $report->save();

        Activity::log('Report was saved);

        return Redirect::route('reports.index')->withSuccess(
            'Report erfolgreich angelegt.'
        );

EDIT: I have to use

use Activity;
mohammad6006 commented 8 years ago

where do you use activity? i have same problem

freekmurze commented 8 years ago

@mohammad6006 namespaces must be imported at the top of the file.

For example:

<?php

use Activity;

class BlaBlaBla...
lfrichter commented 7 years ago

This also happens to me when I try to use the log in login event inside my module

namespace Modules\Account\Events\Handlers;

use Activity;
use Illuminate\Auth\Events\Authenticated;

class LogAuthenticated
{
    /**
     * Create the event listener.
     *
     * @return void
     */
    public function __construct()
    {
        //
    }

    /**
     * Handle the event.
     *
     * @param \Modules\Account\Events\Authenticated $event
     * @return void
     */
    public function handle(Authenticated $event)
    {
        Activity::log('User login authenticated');
    }
}

and return [Tue Jul 18 14:42:21 2017] 127.0.0.1:57017 Invalid request (Unexpected EOF)