Created
October 29, 2021 14:26
-
-
Save NandoKstroNet/9e5359cc4f51e2699b16cee55a863305 to your computer and use it in GitHub Desktop.
ContentFactory, segundo projeto bloco 2, do curso Laravel Mastery em https://laravelmastery.com.br
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Database\Factories; | |
use App\Models\Content; | |
use Illuminate\Database\Eloquent\Factories\Factory; | |
class ContentFactory extends Factory | |
{ | |
/** | |
* The name of the factory's corresponding model. | |
* | |
* @var string | |
*/ | |
protected $model = Content::class; | |
/** | |
* Define the model's default state. | |
* | |
* @return array | |
*/ | |
public function definition() | |
{ | |
$title = $this->faker->sentence; | |
return [ | |
'title' => $title, | |
'description' => $this->faker->sentence, | |
'body' => $this->faker->paragraphs(5, true), | |
'slug' => \Illuminate\Support\Str::slug($title), | |
'type' => rand(1, 2), | |
'cover' => $this->faker->imageUrl(1920, 1080) | |
]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment