<?php

namespace App\Http\Controllers\Api;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Spatie\Activitylog\Models\Activity;

class LogActivityController extends Controller
{
    public function getByModel($model,$id)
    {
        $model ="App\Models\\".ucfirst($model);
        $subject = $model::findOrFail($id);
        $items = Activity::forSubject($subject)->with('causer')->get();
        return $items;
    }
}
