Esempio n. 1
0
 public function byLoan($id, Manager $fractal, AphdbTransformer $aphdbTransformer)
 {
     $records = Aphdb::with('farms', 'inspols', 'loan')->get();
     $collection = new Collection($records, $aphdbTransformer);
     $data = $fractal->createData($collection)->toArray();
     return $this->respond($data);
 }
Esempio n. 2
0
 public function run()
 {
     DB::table('aphdbs')->delete();
     $collection = [['loan_id' => 1, 'inspol_id' => 1, 'farm_id' => 1, 'ins_share' => 80, 'aph' => 200, 'acres' => 1000], ['loan_id' => 1, 'inspol_id' => 2, 'farm_id' => 1, 'ins_share' => 80, 'aph' => 50, 'acres' => 1000], ['loan_id' => 1, 'inspol_id' => 3, 'farm_id' => 1, 'ins_share' => 80, 'aph' => 850, 'acres' => 2350], ['loan_id' => 1, 'inspol_id' => 5, 'farm_id' => 1, 'ins_share' => 80, 'aph' => 925, 'acres' => 1000], ['loan_id' => 1, 'inspol_id' => 8, 'farm_id' => 2, 'ins_share' => 100, 'aph' => 900, 'acres' => 50], ['loan_id' => 1, 'inspol_id' => 11, 'farm_id' => 3, 'ins_share' => 80, 'aph' => 950, 'acres' => 200], ['loan_id' => 1, 'inspol_id' => 11, 'farm_id' => 4, 'ins_share' => 100, 'aph' => 1000, 'acres' => 400], ['loan_id' => 2, 'inspol_id' => 13, 'farm_id' => 5, 'ins_share' => 80, 'aph' => 152, 'acres' => 347.4], ['loan_id' => 2, 'inspol_id' => 14, 'farm_id' => 5, 'ins_share' => 80, 'aph' => 50, 'acres' => 1000], ['loan_id' => 2, 'inspol_id' => 12, 'farm_id' => 5, 'ins_share' => 80, 'aph' => 850, 'acres' => 1000], ['loan_id' => 2, 'inspol_id' => 15, 'farm_id' => 5, 'ins_share' => 80, 'aph' => 135, 'acres' => 1000], ['loan_id' => 2, 'inspol_id' => 16, 'farm_id' => 5, 'ins_share' => 80, 'aph' => 700, 'acres' => 1000]];
     foreach ($collection as $record) {
         Aphdb::create($record);
     }
 }