-
database/factories/PackageFactory.php
Open in GitHubuse App\Collaborator; use App\Package; use Illuminate\Database\Eloquent\Factories\Factory; class PackageFactory extends Factory { public function definition() { return [ 'name' => $this->faker->sentence, 'url' => "{$this->faker->url}/{$this->faker->slug}", 'picture_url' => 'https://picsum.photos/380/220/?random', 'description' => markdown('# '.$this->faker->sentence()."\n\n" .implode(' ', $this->faker->sentences(2))."\n\n" .implode(' ', $this->faker->sentences(4))), 'instructions' => markdown('```'.implode(' ', $this->faker->sentences(4)).'```'), 'author_id' => Collaborator::factory(), 'composer_name' => $this->faker->slug.'/'.$this->faker->slug, 'is_disabled' => false, 'abstract' => $this->faker->text(190), 'readme' => markdown('# '.$this->faker->sentence."\n\n" .implode(' ', $this->faker->sentences(2))."\n\n" .implode(' ', $this->faker->sentences(4))), ]; } }
-
database/seeders/DatabaseSeeder.php
Open in GitHubuse App\Tag; use Illuminate\Database\Seeder; class DatabaseSeeder extends Seeder { public function run() { User::factory()->times(500)->create(); foreach (Tag::PROJECT_TYPES as $name) { Tag::create(['name' => $name, 'slug' => Str::slug($name)]); } // non-type tags foreach (collect(['chart', 'form', 'nova']) as $name) { Tag::create(['name' => $name, 'slug' => Str::slug($name)]); } $packages = [ null, Package::factory()->make([ 'name' => 'Nova Package Discovery', 'abstract' => 'Discover new and popular Nova Packages', 'composer_name' => 'tightenco/nova-package-discovery', 'url' => 'https://github.com/tightenco/nova-package-discovery', 'readme_source' => 'github', 'readme_format' => 'md', 'readme' => "# Nova Package Discovery package\n\nDiscover new packages! Check out the ten most recent and most popular packages on NovaPackages.com, and also check out some stats about the number of packages submitted and more.\n \n<img width=\"474\" alt=\"image\" src=\"https://user-images.githubusercontent.com/151829/44622253-14538480-a883-11e8-896c-55b08a5c1280.png\">\n\n \n ## Installation\n\nYou can install the package in to a Laravel app that uses [Nova](https://nova.laravel.com) via composer:\n\n```bash\ncomposer require tightenco/nova-package-discovery\n```\n\nNext, you must register the card with Nova. This is typically done in the `cards` method of the `NovaServiceProvider`.\n\n```php\n// in app/Providers/NovaServiceProvider.php\n\n// ...\npublic function cards()\n{\n return [\n // ...\n new \\Tightenco\\NovaPackageDiscovery\\NovaPackageDiscovery,\n ];\n}\n```\n", ]), ];