<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\History;
use Carbon\Carbon;
use DataTables;
class ManageHistory extends Controller
{
	public function index()
	{
		return view('manage.history.index');
	}

    public function getHistories()
    {
    	$histories = History::latest()->get();
    	return Datatables::of($histories)
    		->editColumn('user_id', function($history) {
    			if (count($history->user)) {
    				return $history->user->name;
    			}
    		})
	    	->addindexColumn()
	    	->make(true);
    }
}
