mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-19 00:22:15 +00:00
- added folder, file factories
This commit is contained in:
52
database/factories/FileFactory.php
Normal file
52
database/factories/FileFactory.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\File;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class FileFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = File::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
'id' => $this->faker->uuid,
|
||||
'user_id' => $this->faker->uuid,
|
||||
'name' => $this->faker->name,
|
||||
'type' => $this->faker->randomElement(
|
||||
['image', 'file', 'video', 'audio']
|
||||
),
|
||||
'user_scope' => $this->faker->randomElement(
|
||||
['master', 'editor', 'visitor']
|
||||
),
|
||||
'created_at' => $this->faker->dateTimeBetween(
|
||||
$startDate = '-36 months', $endDate = 'now', $timezone = null
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure the model factory.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function configure()
|
||||
{
|
||||
return $this->afterCreating(function (File $file) {
|
||||
// TODO: add fake files
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user