public function select() { World::where('id', '>', 0)->update(array('name' => 'Hello World!')); for ($i = 0; $i < 2; $i++) { $rnd = mt_rand(1, 10000); $result = World::find($rnd); } $result = World::find($result->id); return $result->name; }
<?php require_once __DIR__ . '/src/bootstrap.php'; use App\World; use App\XmlProvider; $xmlProvider = new XmlProvider(); $state = $xmlProvider->createWorldStateFromXmlFile(__DIR__ . "/in.xml"); $world = new World(new \App\CellManager($state->worldWidth)); $lastState = $world->run($state); $xmlProvider->saveWorldStateToFile($lastState, __DIR__ . "/out.xml");
/** * Run the database seeds. * * @return void */ public function run() { World::create(['name' => 'Test World 1']); World::create(['name' => 'Test World 2']); }