How can I add title and sum value of column in laravel excel version 3?

|
Jomitz 2020-12-01 06:01:09
Ok
EczRidvan 2020-12-01 11:58:18
laravel_discuss-60757.jpg

EczRidvan 2020-12-01 11:58:33
what could be the problem pdf parse?
Jomitz 2020-12-01 12:02:32
Show pdf render or return code
EczRidvan 2020-12-01 12:22:03
show pdf render
EczRidvan 2020-12-01 12:24:11
$pdf_document_path = storage_path(‘app/’.$pdfPath);
$xml_map = array();
$yabanci = false;
$pdf = new Pdf();

switch ($type) {
case “0”:
# a,b,c
$number_of_pages = $this->get_number_of_pages($pdf_document_path);

try {
$pdf->setPdf($pdf_document_path);
} catch (SpatiePdfToTextExceptionsPdfNotFound $e) {

echo $e->getMessage();

}

$pdf->setOptions([‘simple’, ‘-enc UTF-8’, ‘-f ‘.$number_of_pages, ‘-l ‘.$number_of_pages]);
$arr = explode(“n”, $pdf->text());

$arr = $this->regulate_spaces($arr);
$arr = array_values(array_filter($arr, array($this,’remove_blanks’)));
$group = trim(explode(‘Grubu’, $arr[3])[0]);
$splittedLine = explode(‘Döküm Numarası:’, $arr[5]);
$splittedEczaneBilgi = trim(explode(‘:’, $splittedLine[0])[1]);
$splittedAdDokumNumarasi = explode(‘/’, $splittedEczaneBilgi);
$eczane_adi = trim($splittedAdDokumNumarasi[1]);
$eczane_sicil_numarasi = trim($splittedAdDokumNumarasi[0]);

$dokum_numarasi = trim($splittedLine[1]);

// Remove header
$arr = array_slice($arr, 4);

// Remove footer
$arr = array_slice($arr, 0, count($arr)-5);
break;
case “1”:
# geçici koruma kapsamı
$number_of_pages = $this->get_number_of_pages($pdf_document_path);

try {
$pdf->setPdf($pdf_document_path);
} catch (SpatiePdfToTextExceptionsPdfNotFound $e) {
echo $e->getMessage();
}

$pdf->setOptions([‘simple’, ‘-enc UTF-8’, ‘-f ‘.$number_of_pages, ‘-l ‘.$number_of_pages]);
$arr = explode(“n”, $pdf->text());

$arr = $this->regulate_spaces($arr);
$arr = array_values(array_filter($arr, array($this,’remove_blanks’)));
$group = trim(explode(‘Grubu’, $arr[1])[0]);
$splittedLine = explode(‘Döküm Numarası:’, $arr[4]);
$splittedEczaneBilgi = trim(explode(‘:’, $splittedLine[0])[1]);
$splittedAdDokumNumarasi = explode(‘/’, $splittedEczaneBilgi);
$eczane_adi = trim($splittedAdDokumNumarasi[1]);
$eczane_sicil_numarasi = trim($splittedAdDokumNumarasi[0]);

$dokum_numarasi = trim($splittedLine[1]);

// Remove header
$arr = array_slice($arr, 3);

// Remove footer
$arr = array_slice($arr, 0, count($arr)-4);
$yabanci = true;
break;

case “2”:
// Medikal
try {
$pdf->setPdf($pdf_document_path);
} catch (SpatiePdfToTextExceptionsPdfNotFound $e) {
echo $e->getMessage();
}
$pdf->setOptions([‘table’, ‘-enc UTF-8’, ‘-l 1′]);
$arr = explode(“n”, $pdf->text());

//$arr = regulate_spaces($arr);
$arr = array_values(array_filter($arr, array($this,’remove_blanks’)));
$cut_index = 0;

$xml_map[‘EczaneAdi’] = str_replace(‘ ‘, ”, $arr[3]);
$xml_map[‘EczaneSicilNumarasi’] = str_replace(‘ ‘, ”, $arr[4]);

foreach ($arr as $line) {
if ($this->contains(‘sıra’, mb_strtolower($line, ‘UTF-8’))){
break;
}
$cut_index += 1;
}

$number_of_headers = 0;

$first_line = $arr[0];

foreach ($arr as $line) {
if ($this->contains(‘:’, $line)){
break;
}
$number_of_headers += 1;
}

// Remove the headers
$arr = array_slice($arr, $number_of_headers, $cut_index-$number_of_headers);

$number_of_parsed_lines = 0;

foreach($arr as $line) {
if (substr_count($line,’:’) > 1) {
preg_match_all(‘/[s]+/’, $line, $spaces);
$spaces = $spaces[0];
$spaces = array_map(‘strlen’, $spaces);
$max_index = array_keys($spaces, max($spaces))[0];
preg_match_all(‘/[S]+/’, $line, $words);
$words = $words[0];
$entries = array();
array_push($entries, join(‘ ‘, array_slice($words, 0, $max_index+1)));
array_push($entries, join(‘ ‘, array_slice($words, $max_index+1)));

foreach ($entries as $entry) {
$splittedEntry = explode(‘:’, $entry);
$key = $this->cleanXMLTag($splittedEntry[0]);
$value = trim($splittedEntry[1]);
$xml_map[$key] = $value;
}
$number_of_parsed_lines += 1;
} else if(substr_count($line,’:’) == 1) {
$splittedEntry = explode(

EczRidvan 2020-12-01 12:24:21
‘:’, $line);
$key = $this->cleanXMLTag($splittedEntry[0]);
$value = trim($splittedEntry[1]);
$xml_map[$key] = $value;
$number_of_parsed_lines += 1;
}
}

if ($number_of_parsed_lines != count($arr)) {
$xml_map[‘PDFTipi’] = trim($arr[count($arr)-1]);
} else {
$xml_map[‘PDFTipi’] = trim($first_line);
}

return $xml_map;
break;

case “3”:
# a,b,c 1 satır kaymış

$number_of_pages = $this->get_number_of_pages($pdf_document_path);

try {
$pdf->setPdf($pdf_document_path);
} catch (SpatiePdfToTextExceptionsPdfNotFound $e) {
echo $e->getMessage();
}

$pdf->setOptions([‘simple’, ‘-enc UTF-8’, ‘-f ‘.$number_of_pages, ‘-l ‘.$number_of_pages]);
$arr = explode(“n”, $pdf->text());

$arr = $this->regulate_spaces($arr);
$arr = array_values(array_filter($arr, array($this,’remove_blanks’)));
$group = trim(explode(‘Grubu’, $arr[4])[0]);
$splittedLine = explode(‘Döküm Numarası:’, $arr[7]);
$splittedEczaneBilgi = trim(explode(‘:’, $splittedLine[0])[1]);
$splittedAdDokumNumarasi = explode(‘/’, $splittedEczaneBilgi);
$eczane_adi = trim($splittedAdDokumNumarasi[1]);
$eczane_sicil_numarasi = trim($splittedAdDokumNumarasi[0]);

$dokum_numarasi = trim($splittedLine[1]);

// Remove header
$arr = array_slice($arr, 6);

// Remove footer
$arr = array_slice($arr, 0, count($arr)-5);
break;

default:
# default
$group = trim(explode(‘Grubu’, $arr[3])[0]);
$splittedLine = explode(‘Döküm Numarası:’, $arr[5]);
$splittedEczaneBilgi = trim(explode(‘:’, $splittedLine[0])[1]);
$splittedAdDokumNumarasi = explode(‘/’, $splittedEczaneBilgi);
$eczane_adi = trim($splittedAdDokumNumarasi[1]);
$eczane_sicil_numarasi = trim($splittedAdDokumNumarasi[0]);

$dokum_numarasi = trim($splittedLine[1]);

// Remove header
$arr = array_slice($arr, 4);

// Remove footer
$arr = array_slice($arr, 0, count($arr)-5);
break;
}

foreach ($arr as $entry) {
// Parse regular entries
if (substr_count($entry, ‘:’) == 1) {
$splittedLine = explode(‘:’, $entry);
$key = $this->normalize_tag($splittedLine[0]);
$key = self::cleanXMLTag($key);
$value = $splittedLine[1];
$xml_map[$key] = $value;
// Parse, or skip, faulty entries
} else if (substr_count($entry, ‘:’) == 0) {
if (substr_count($entry, ‘ ‘) > 0) {
$splittedLine = explode(‘ ‘, $entry);
$len = count($splittedLine);
$value = $splittedLine[$len-1]; // last element is the value
$key = implode(‘ ‘, array_slice($splittedLine, 0, $len-1));
$key = self::cleanXMLTag($key);
}
$xml_map[$key] = $value;
}
}

$size = count($arr);
// Static parse irregular entries
$titles = array_map(‘trim’, explode(‘:’, $arr[$size-4]));

for ($i = 0; $i < count($titles); $i++) {
$titles[$i] = self::cleanXMLTag($titles[$i]);
$xml_map[$titles[$i]] = array();
}

for ($line_index = $size-3; $line_index < $size; $line_index++) {
preg_match_all(‘/([S]+([s]+[^s:]+)):[s]([S]+)/’, $arr[$line_index], $entries);
$keys = $entries[1];
$values = $entries[3];

for ($i = 0; $i < count($keys); $i++) {
$keys[$i] = self::cleanXMLTag($keys[$i]);
}

$xml_map[$titles[0]][$keys[0]] = $values[0]; // elden tahsil
$xml_map[$titles[1]][$keys[1]] = $values[1]; // maaştan kesilen
if (count($keys) >= 3) {
$xml_map[$titles[2]][$keys[3]] = $values[3]; // kesilen fatura
$xml_map[$keys[2]] = $values[2]; // reçete adedi ve psf miktarı
}
}

$xml_map[‘Grubu’] = $group;
$xml_map[‘DokumNumarasi’] = $dokum_numarasi;
$xml_map[‘EczaneAdi’] = $eczane_adi;
$xml_map[‘EczaneSicilNumarasi’] = $eczane_sicil_numarasi;
$xml_map[‘Yaban

Relaxed Guy 2020-12-01 15:00:46
$this->validate($request, [
‘title’=>’required’,
‘title.*’=>’mimes:doc,pdf,docx,csv,xls’
]);

dd($request->title);

if($request->hasfile(‘title’))
{
foreach($request->file(‘title’) as $file)
{
$name = time().’.’.$file->extension();
$file->move(public_path().’/files/’, $name);
$file= new Report();
$file->title=$name;
$file->save();
}

}

Relaxed Guy 2020-12-01 15:01:01
how do i validate a form clone
Relaxed Guy 2020-12-01 15:02:51
m getting an error of title feild required
pappu_019 2020-12-01 15:05:46
Any have any idea about ? Mongo db connection error with laravel.
I am getting this error
No suitable servers found (serverSelectionTryOnce set): [connection refused calling ismaster on ‘127.0.0.1:27017’]

Please help me to resolve the issue, it was working before but today i got tis issue.

adityaa_codes 2020-12-01 15:34:49
How to get the sum of columns using Laravel-excel library
In Laravel!
o_sayfullayev 2020-12-01 15:44:55
adityaa_codes 2020-12-01 15:34:49
How to get the sum of columns using Laravel-excel library
In Laravel!

https://stackoverflow.com/questions/51685886/how-can-i-add-title-and-sum-value-of-column-in-laravel-excel-version-3

How can I add title and sum value of column in laravel excel version 3?Stack Overflow
I get reference from here : https://laravel-excel.maatwebsite.nl/docs/3.0/getting-started/basics

So I use version 3

My controller like this :

public function exportToExcel(Request $request)
{
$

adityaa_codes 2020-12-01 15:45:47
i did go through this, not useful
adityaa_codes 2020-12-01 15:45:57
the links given in this are broken
hypernxf 2020-12-01 16:52:03
Do you know what is the format returned by the library?
Aliaksandr 2020-12-01 17:06:07
https://medium.com/@sentiasa/query-100k-records-in-wherein-laravel-b3b18cda5a3a

laravel csv wherein

🔥Query +100k records in whereIn() — LaravelMedium
If you are tinkering with a big data (say are trying to export a huge CSV), you may end up needing to query +100k ids in a whereIn().
2020-12-01 17:43:47
Can someone tell me if there’s an easy way to generate qr codes in laravel?
amirvalhalla 2020-12-01 18:09:29
2020-12-01 17:43:47
Can someone tell me if there’s an easy way to generate qr codes in laravel?

Here you go bro

https://github.com/werneckbh/laravel-qr-code

GitHub – werneckbh/laravel-qr-codeGitHub
Contribute to werneckbh/laravel-qr-code development by creating an account on GitHub.
amirvalhalla 2020-12-01 18:56:30
You’re welcome
israa2912 2020-12-01 19:19:02
Hi,

In Nova dashboard, can I make the notification,
when excite the api and change value in database?

Senario :
In the driver app, the driver send request api to change his status to Accept the order… Finish the tripe…

So, every time the change happen I want to see the notification in my Nova dashboard

Can any one help me?

theman_behind 2020-12-01 19:31:13
How to access a laravel website in mobile
Jomitz 2020-12-01 19:33:00
Put it in a server and type url in your browser
Jomitz 2020-12-01 19:33:17
Or what
theman_behind 2020-12-01 19:37:53
It’s saying cannot assign requested address
2020-12-01 20:15:47
Anybody who has an idea how i can get phone number from this json data {
“Body”:{
“stkCallback”:{
“MerchantRequestID”:”998″,
“CheckoutRequestID”:”ws_CO_301120202034374244″,
“ResultCode”:0,
“ResultDesc”:”The service request is processed successfully.”,
“CallbackMetadata”:{
“Item”:[
{
“Name”:”Amount”,
“Value”:1
},
{
“Name”:”ReceiptNumber”,
“Value”:”OKU”
},

{
“Name”:”PhoneNumber”,
“Value”:934234
}
]
}
}
}
}

natghi2010 2020-12-01 20:22:41
2020-12-01 20:15:47
Anybody who has an idea how i can get phone number from this json data {
“Body”:{
“stkCallback”:{
“MerchantRequestID”:”998″,
“CheckoutRequestID”:”ws_CO_301120202034374244″,
“ResultCode”:0,
“ResultDesc”:”The service request is processed successfully.”,
“CallbackMetadata”:{
“Item”:[
{
“Name”:”Amount”,
“Value”:1
},
{
“Name”:”ReceiptNumber”,
“Value”:”OKU”
},

{
“Name”:”PhoneNumber”,
“Value”:934234
}
]
}
}
}
}

how did you get this?

2020-12-01 20:27:12
natghi2010 2020-12-01 20:22:41
how did you get this?

It is a callback from a url so i need to extract that data

natghi2010 2020-12-01 20:27:26
2020-12-01 20:27:12
It is a callback from a url so i need to extract that data

i mean is it string?

natghi2010 2020-12-01 20:28:00
like if you echo it out does it display?
natghi2010 2020-12-01 20:28:48
or is it an array returned to the view?
2020-12-01 20:30:04
natghi2010 2020-12-01 20:28:48
or is it an array returned to the view?

yap it is only that I have converted it to json readable format

natghi2010 2020-12-01 20:30:54
so $body[‘stkCallback][‘CallbackMetadata’][‘item’][2]
amirvalhalla 2020-12-01 20:32:28
2020-12-01 20:15:47
Anybody who has an idea how i can get phone number from this json data {
“Body”:{
“stkCallback”:{
“MerchantRequestID”:”998″,
“CheckoutRequestID”:”ws_CO_301120202034374244″,
“ResultCode”:0,
“ResultDesc”:”The service request is processed successfully.”,
“CallbackMetadata”:{
“Item”:[
{
“Name”:”Amount”,
“Value”:1
},
{
“Name”:”ReceiptNumber”,
“Value”:”OKU”
},

{
“Name”:”PhoneNumber”,
“Value”:934234
}
]
}
}
}
}

first of all you have to json decode this json file to use as array , use this method json_decode(json file)

natghi2010 2020-12-01 20:34:53
amirvalhalla 2020-12-01 20:32:28
first of all you have to json decode this json file to use as array , use this method json_decode(json file)

he said that it was orginally an array but when he returned it to the view, it became an json

amirvalhalla 2020-12-01 20:35:34
natghi2010 2020-12-01 20:34:53
he said that it was orginally an array but when he returned it to the view, it became an json

it’s weird isn’t it?

natghi2010 2020-12-01 20:36:03
amirvalhalla 2020-12-01 20:35:34
it’s weird isn’t it?

yes. But laravel has a wierd conversion logic

amirvalhalla 2020-12-01 20:38:14
natghi2010 2020-12-01 20:36:03
yes. But laravel has a wierd conversion logic

i’m not agree with you in this case

natghi2010 2020-12-01 20:38:59
amirvalhalla 2020-12-01 20:38:14
i’m not agree with you in this case

why?

2020-12-01 20:39:32
Okay am getting that data already from this $response = json_decode($request->getContent()); so i now need to capture phone number
|