I installed Jeylabs/AuditLogs and tried to use it. Saving, updating and deleting of records are working as expected and all this logs are being saved in the audit_log table. Now I'm trying to use the auditlog retrieve data. As instructed in the Github page it says that I just need to use AuditLog::all()->last()
to retrieve the data. But it's giving me an error that the AuditLog class is not found. I'm not sure what I'm doing wrong. I tried to use this function in the Controller
, CustomRepositoryClass
and Model
but none is working. Not sure what do I do. Below is my code for retrieving the data
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Carbon\Carbon;
use DB;
use Jeylabs\AuditLog\Traits\LogsAudit;
use Jeylabs\AuditLog\Traits\CausesAudit;
class Booking extends Model
{
use SoftDeletes, LogsAudit, CausesAudit;
public function scopeGetLogs()
{
$auditlog = AuditLog::all()->last();
dd($auditlog);
}
}
In my controller
<?php
namespace App\Http\Controllers\Admin;
use Illuminate\Http\Request;
use Auth;
use App\Http\Controllers\Controller;
use App\Booking;
use Gate;
use Jeylabs\AuditLog\Traits\LogsAudit;
use Jeylabs\AuditLog\Traits\CausesAudit;
class LogsController extends Controller
{
use SoftDeletes, LogsAudit, CausesAudit;
public function index()
{
Booking::getLogs();
}
}
But this can't read the model AuditLog
any idea on how to make this work?
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2BVjgZ0
via IFTTT
Aucun commentaire:
Enregistrer un commentaire