1: <?php
2:
3: namespace Laravella\Crud;
4:
5: class Log {
6:
7: const SUCCESS = "success";
8: const INFO = "info";
9: const IMPORTANT = "important";
10:
11: /**
12: *
13: * @param type $severity
14: * @param type $message
15: */
16: public static function write($severity, $message)
17: {
18: echo $message."\n";
19: $id = null;
20: try
21: {
22: if (\Schema::hasTable('_db_logs'))
23: {
24:
25: $entry = array("severity" => 0 /*$severity*/, "message" => $message);
26: $id = \DB::table('_db_logs')->insertGetId($entry);
27: }
28: }
29: catch (Exception $e)
30: {
31: //
32: }
33: return $id;
34: }
35:
36: /**
37: * Getter for $log
38: *
39: * @return type
40: */
41: public static function getLog()
42: {
43: return DB::table('_db_log')->get();
44: }
45:
46: }
47:
48: ?>
49: