/** * Run the database seeds. * * @return void */ public function run() { $faker = Faker::create(); $investorIds = App\Models\Investor::all()->lists('id'); //echo('Investor Ids '); //var_dump($investorIds); $campaignIds = App\Models\Campaign::all()->lists('id'); //echo('Campaign Ids '); //var_dump($campaignIds); $numberInvstPerCmpg = 3; foreach ($investorIds as $invtId) { foreach ($campaignIds as $cmpgnId) { DB::table('campaign_investor')->insert(['campaign_id' => $cmpgnId, 'investor_id' => $invtId, 'invst_label' => $faker->sentence(), 'invst_amount' => $faker->randomFloat($nbMaxDecimals = 2, $min = 10.0, $max = 500.0), 'created_at' => \Carbon\Carbon::now(), 'updated_at' => \Carbon\Carbon::now()]); //$numberInvstPerCmpg--; } } //var_dump($pivots); //DB::table('campaign_investor')->insert($pivots); }
public function carousel() { $campaigns = Campaign::all(); return response()->json($campaigns); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $campaigns = Campaign::all(); return $campaigns; }