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)]); } }
public function index() { // show all $records = Crop::all(); return $records; }