getAmountFromText($file); $amounts[] = $amount; } } dd($amounts); } /** * Gets the ffs amount requested from a file * * @param string $filename * @return array * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException */ public function getAmountFromText($filename = 'additional-gui-dev.md') { $input = Storage::get($filename); $lines = preg_split('/\r\n|\r|\n/', $input); $values = []; $flag = false; $isPayoutLine = false; foreach($lines as $line) { if ($line === '---') { if ($flag === true) { break; } $flag = true; continue; } $details = explode(':', $line); if (count($details) < 2) { continue; } if ($details[0] === 'payouts') { $isPayoutLine = true; continue; } if ($isPayoutLine) { $name = trim(str_replace('-','', $details[0])); $values['payouts'][][$name] = ltrim($details[1]); continue; } $values[$details[0]] = ltrim($details[1]); } return $values; } }