Commit c926ad45 authored by beardedwarrior's avatar beardedwarrior

updated the process proposals to pull the latest information from the front matter

parent a042be90
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
namespace App\Console\Commands; namespace App\Console\Commands;
use App\Project;
use Illuminate\Console\Command; use Illuminate\Console\Command;
use Illuminate\Support\Facades\Storage; use Illuminate\Support\Facades\Storage;
...@@ -36,20 +37,30 @@ class ProcessProposals extends Command ...@@ -36,20 +37,30 @@ class ProcessProposals extends Command
*/ */
public function handle() public function handle()
{ {
$amounts = []; $projects = Project::whereNull('filename');
$details = [];
$files = Storage::files('ffs-proposals'); $files = Storage::files('ffs-proposals');
foreach ($files as $file) { foreach ($files as $file) {
if (strpos($file,'.md')) { if (strpos($file,'.md')) {
$amount['name'] = $file; $detail['name'] = $file;
$amount['values'] = $this->getAmountFromText($file); $detail['values'] = $this->getAmountFromText($file);
$amounts[] = $amount; $details[] = $detail['values']['title'];
$project = $projects->where('title', $detail['values']['title'])->first();
if ($project) {
$project->filename = $file;
$project->target_amount = $detail['values']['amount'];
$project->save();
}
} }
} }
dd($amounts); foreach ($details as $det) {
$this->line($det);
}
} }
/** /**
* Gets the ffs amount requested from a file * Gets the ffs variables out the top of the file
* *
* @param string $filename * @param string $filename
* @return array * @return array
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment