public function run() { NeoEloquent::unguard(); $this->fake = Faker::create('ar_JO'); $this->cache = App::make('AblaFahita\\Caching\\CommentsCache'); $this->service = App::make('AblaFahita\\Services\\CommentsService'); // users $users = $this->seedUsers(); echo "- Seeded " . $this->users_count . " users\n"; $comments_ids = $this->seedComments($users); echo "- Seeded " . count($comments_ids) . " comments\n"; }
/** * Run the database seeds. * * @return void */ public function run() { NeoEloquent::unguard(); // Empty all the nodes before seeding $connection = (new Role())->getConnection(); $client = $connection->getClient(); $batch = $client->startBatch(); // Remove all relationships and related nodes $query = new \Everyman\Neo4j\Cypher\Query($client, 'MATCH (n), (m)-[r]-(c) DELETE n,m,r,c'); $query->getResultSet(); // Remove singular nodes with no relations $query = new \Everyman\Neo4j\Cypher\Query($client, 'MATCH (n) DELETE n'); $query->getResultSet(); $batch->commit(); $this->call('CmsSectionsSeeder'); $this->call('RoleAndPermissionsSeeder'); $this->call('AdminSeeder'); }