public static function document($type, $data)
{
if ($type == 'id') {
return Document::findOrFail($data);
}
return Document::where($type, $data)->first();
}
public static function checkDocumentOwner($type, $data) { if (Auth::user()->id == Laralum::document($type, $data)->author->id) { return true; } else { return false; } }