Zapisywanie wydrukowanej notatki do pamięci. #56
@@ -75,6 +75,20 @@ class Paper
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function saveToHistory($title, $text, $textSource, $image)
|
||||||
|
{
|
||||||
|
DB::table('history')
|
||||||
|
->insertGetId([
|
||||||
|
'topic' => $title,
|
||||||
|
'topic_slug' => str_slug($title, '_'),
|
||||||
|
'text' => $text,
|
||||||
|
'text_source' => $textSource,
|
||||||
|
'icon' => $image,
|
||||||
|
'created_at' => time(),
|
||||||
|
'updated_at' => time()
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public function sendPrint($title, $text = '', $image = false, $imageLocal = true)
|
public function sendPrint($title, $text = '', $image = false, $imageLocal = true)
|
||||||
{
|
{
|
||||||
@@ -82,6 +96,9 @@ class Paper
|
|||||||
$this->sendHeaderPrint($title);
|
$this->sendHeaderPrint($title);
|
||||||
$htmlToPos = new HtmlToPos();
|
$htmlToPos = new HtmlToPos();
|
||||||
$convertedData = $htmlToPos->convert($text);
|
$convertedData = $htmlToPos->convert($text);
|
||||||
|
|
||||||
|
//zapisuje do pamięci dane o drukowanej notatce, jesli obrazek nie jest ikoną to nie zapisuje go
|
||||||
|
$this->saveToHistory($title, $convertedData, $text, $imageLocal ? $image : '');
|
||||||
if (is_array($convertedData)) {
|
if (is_array($convertedData)) {
|
||||||
$this->printer->text($convertedData['text']);
|
$this->printer->text($convertedData['text']);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ class Traficar
|
|||||||
|
|
||||||
private $traficarJson;
|
private $traficarJson;
|
||||||
//dystans w kilometrach w którym auta brane są pod uwagę
|
//dystans w kilometrach w którym auta brane są pod uwagę
|
||||||
const CLOSEST_DISTANCE = 2;
|
const CLOSEST_DISTANCE = 2.5;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $lat1
|
* @param $lat1
|
||||||
|
|||||||
Reference in New Issue
Block a user