Example #1
0
 public function index(Manager $fractal, CropTransformer $cropTransformer)
 {
     // show all
     $records = Crop::all();
     $collection = new Collection($records, $cropTransformer);
     $data = $fractal->createData($collection)->toArray();
     return $this->respond($data);
 }
 public function handle(LoanWasCreated $event)
 {
     if ((int) $event->loan->loan_type_id < 4) {
         return;
     }
     $crops = Crop::all();
     foreach ($crops as $crop) {
         Plannedcrop::create(['loan_id' => $event->loan->id, 'crop_id' => $crop->id, 'crop' => $crop->name, 'acres' => 0, 'tea' => (double) getPlannedCropTea($crop->id)]);
     }
 }
Example #3
0
 public function index()
 {
     // show all
     $records = Crop::all();
     return $records;
 }