private static function log($action, Logable $model) {
		$modelId = $model->getLogName();
		if (empty($modelId)) :
			throw new \InvalidArgumentException("model_id must be set, it is currently {$model->getLogName()}");
		endif;

		$obj = Model\Action::where('name', '=', $action)->limit(1)->get();
		if ($obj->isEmpty()) :
			throw new \InvalidArgumentException("{$action} is not a valid action");
		endif;

		$message = new Model\Message;
		$message->action()->associate($obj[0]);
		$message->model = get_class($model);
		$message->model_id = $modelId;
		$message->save();

		return $message;
	}
private static function log($action, Logable $model) {
		$modelId = $model->getLogName();
		if (empty($modelId)) :
			throw new \InvalidArgumentException("model_id must be set, it is currently {$model->getLogName()}");
		endif;

		$obj = Model\Action::where('name', '=', $action)->limit(1)->get();
		if ($obj->isEmpty()) :
			throw new \InvalidArgumentException("{$action} is not a valid action");
		endif;

		$message = new Model\Message;
		$message->action()->associate($obj[0]);
		$message->model = get_class($model);
		$message->model_id = $modelId;
		$message->save();

		return $message;
	}
private static function log ( $ action , Logable $ model ) { $ modelId = $ model -> getLogName ( ) ; if ( empty ( $ modelId ) ) : throw new \ InvalidArgumentException ( "model_id must be set, it is currently {$model->getLogName()}" ) ; endif ; $ obj = Model \ Action :: where ( 'name' , '=' , $ action ) -> limit ( 1 ) -> get ( ) ; if ( $ obj -> isEmpty ( ) ) : throw new \ InvalidArgumentException ( "{$action} is not a valid action" ) ; endif ; $ message = new Model \ Message ; $ message -> action ( ) -> associate ( $ obj [ 0 ] ) ; $ message -> model = get_class ( $ model ) ; $ message -> model_id = $ modelId ; $ message -> save ( ) ; return $ message ; }
Log a message to the database
@param String $action ACTION_* constant
@param \Log\Logable $model
@return \Log\Message Logged message
Log a message to the database