You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
702 B
PHTML
34 lines
702 B
PHTML
9 months ago
|
<?php
|
||
|
|
||
|
namespace Database\Factories;
|
||
|
|
||
|
use App\Models\Photo;
|
||
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
||
|
|
||
|
class PhotoFactory extends Factory
|
||
|
{
|
||
|
protected $model = Photo::class;
|
||
|
|
||
|
public function definition(): array
|
||
|
{
|
||
|
$rand = rand(0,2);
|
||
|
switch (rand(0,2)) {
|
||
|
case 0:
|
||
|
$src = '/images/vancouver.jpg';
|
||
|
break;
|
||
|
case 1:
|
||
|
$src = '/images/toronto.webp';
|
||
|
break;
|
||
|
case 2:
|
||
|
$src = '/images/quebec.webp';
|
||
|
break;
|
||
|
}
|
||
|
|
||
|
return [
|
||
|
'image_src' => $src,
|
||
|
'alt_text' => '',
|
||
|
'description' => ''
|
||
|
];
|
||
|
}
|
||
|
}
|