New stuff pertaining to the import procedure and user registration.

This commit is contained in:
James Cole
2014-07-05 16:19:15 +02:00
parent c3254c2351
commit a0c0dc288d
23 changed files with 305 additions and 63 deletions

View File

@@ -0,0 +1,40 @@
<?php
namespace Firefly\Storage\Component;
class EloquentComponentRepository implements ComponentRepositoryInterface
{
public $validator;
public function __construct()
{
}
public function count()
{
return \Auth::user()->accounts()->count();
}
public function store($data)
{
if (!isset($data['component_type'])) {
throw new \Firefly\Exception\FireflyException('No component type present.');
}
$component = new \Component;
$component->componentType()->associate($data['component_type']);
$component->name = $data['name'];
$component->user()->associate(\Auth::user());
try {
$component->save();
} catch (\Illuminate\Database\QueryException $e) {
\Log::error('DB ERROR: ' . $e->getMessage());
throw new \Firefly\Exception\FireflyException('Could not save component ' . $data['name']);
}
return $component;
}
}