Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Audit presentation #206

Closed
hafizhassan opened this issue Mar 14, 2017 · 6 comments
Closed

Audit presentation #206

hafizhassan opened this issue Mar 14, 2017 · 6 comments

Comments

@hafizhassan
Copy link

i tried to display the record.

this is my model.
namespace App;
use OwenIt\Auditing\Models\Audit as AuditModel;
class Audit extends AuditModel
{ }

this is my controller
public function index()
{
$audits = Audit::all();
return view('audit.index', compact('audits'));
}

this is the blade

    @forelse ($audits as $audit)
  • @lang('post.updated.metadata', $audit->getMetadata())
        @foreach ($audit->getModified() as $attribute => $modified)
        <ul>
            <li>@lang('post.'.$audit->event.'.modified.'.$attribute, $modified)</li>
        </ul>
        @endforeach
    </li>
    @empty
    <p>@lang('post.unavailable_audits')</p>
    @endforelse
    

when run it show
FatalErrorException in Audit.php line 167:
Call to a member function hasGetMutator() on null

what did i miss?
thank for the attention. thank you.

@quetzyg
Copy link
Contributor

quetzyg commented Mar 15, 2017

Have a look at the documentation, more specifically the Getting Audits section.

@quetzyg
Copy link
Contributor

quetzyg commented Mar 15, 2017

Basically, you should get Audit records through a Model:

$audits = $someModel->audits();

rather than calling all() from the Audit model itself.

@hafizhassan
Copy link
Author

thank. ive miss something.

@mikebronner
Copy link
Contributor

I was running into the same issue. Is there a way to get all audit entries? I have an admin page that show all updates, regardless of model.

mikebronner added a commit to mikebronner/laravel-auditing that referenced this issue May 16, 2017
Possible fix for owen-it#206, not tested for side-effects, but seems to run OK with local dataset.
@amendozaaguiar
Copy link

i tried to display the record.

this is my model.
namespace App;
use OwenIt\Auditing\Models\Audit as AuditModel;
class Audit extends AuditModel
{ }

this is my controller
public function index()
{
$audits = Audit::all();
return view('audit.index', compact('audits'));
}

this is the blade

@forelse ($audits as $audit)

  • @lang('post.updated.metadata', $audit->getMetadata())
        @foreach ($audit->getModified() as $attribute => $modified)
        <ul>
            <li>@lang('post.'.$audit->event.'.modified.'.$attribute, $modified)</li>
        </ul>
        @endforeach
    </li>
    @empty
    <p>@lang('post.unavailable_audits')</p>
    @endforelse
    

when run it show
FatalErrorException in Audit.php line 167:
Call to a member function hasGetMutator() on null

what did i miss?
thank for the attention. thank you.

Gracias, andaba buscando un error, pero con tu post ya se como puedo solucionarlo, muchas gracias.

@hafizhassan
Copy link
Author

i tried to display the record.
this is my model.
namespace App;
use OwenIt\Auditing\Models\Audit as AuditModel;
class Audit extends AuditModel
{ }
this is my controller
public function index()
{
$audits = Audit::all();
return view('audit.index', compact('audits'));
}
this is the blade
@forelse ($audits as $audit)

  • @lang('post.updated.metadata', $audit->getMetadata())
        @foreach ($audit->getModified() as $attribute => $modified)
        <ul>
            <li>@lang('post.'.$audit->event.'.modified.'.$attribute, $modified)</li>
        </ul>
        @endforeach
    </li>
    @empty
    <p>@lang('post.unavailable_audits')</p>
    @endforelse
    

when run it show
FatalErrorException in Audit.php line 167:
Call to a member function hasGetMutator() on null
what did i miss?
thank for the attention. thank you.

Gracias, andaba buscando un error, pero con tu post ya se como puedo solucionarlo, muchas gracias.

i dont understand ;D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants