mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-18 16:22:14 +00:00
- added folder, file factories
This commit is contained in:
@@ -15,7 +15,7 @@ use Kyslik\ColumnSortable\Sortable;
|
|||||||
|
|
||||||
class Folder extends Model
|
class Folder extends Model
|
||||||
{
|
{
|
||||||
use Searchable, SoftDeletes , Sortable;
|
use Searchable, SoftDeletes, Sortable;
|
||||||
|
|
||||||
protected $guarded = [
|
protected $guarded = [
|
||||||
'id'
|
'id'
|
||||||
|
|||||||
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
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
36
database/factories/FolderFactory.php
Normal file
36
database/factories/FolderFactory.php
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Database\Factories;
|
||||||
|
|
||||||
|
use App\Folder;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||||
|
|
||||||
|
class FolderFactory extends Factory
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The name of the factory's corresponding model.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $model = Folder::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,
|
||||||
|
'user_scope' => $this->faker->randomElement(
|
||||||
|
['master', 'editor', 'visitor']
|
||||||
|
),
|
||||||
|
'created_at' => $this->faker->dateTimeBetween(
|
||||||
|
$startDate = '-36 months', $endDate = 'now', $timezone = null
|
||||||
|
),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -25,13 +25,17 @@ class UserFactory extends Factory
|
|||||||
public function definition()
|
public function definition()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'role' => $this->faker->randomElement(['user', 'admin']),
|
'role' => $this->faker->randomElement(
|
||||||
|
['user', 'admin']
|
||||||
|
),
|
||||||
'name' => $this->faker->name(),
|
'name' => $this->faker->name(),
|
||||||
'email' => $this->faker->unique()->safeEmail,
|
'email' => $this->faker->unique()->safeEmail,
|
||||||
'email_verified_at' => now(),
|
'email_verified_at' => now(),
|
||||||
'password' => Hash::make('secret'),
|
'password' => Hash::make('secret'),
|
||||||
'remember_token' => Str::random(10),
|
'remember_token' => Str::random(10),
|
||||||
'created_at' => $this->faker->dateTimeBetween($startDate = '-36 months', $endDate = 'now', $timezone = null),
|
'created_at' => $this->faker->dateTimeBetween(
|
||||||
|
$startDate = '-36 months', $endDate = 'now', $timezone = null
|
||||||
|
),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,9 +56,13 @@ class UserFactory extends Factory
|
|||||||
'state' => $this->faker->state,
|
'state' => $this->faker->state,
|
||||||
'city' => $this->faker->city,
|
'city' => $this->faker->city,
|
||||||
'postal_code' => $this->faker->postcode,
|
'postal_code' => $this->faker->postcode,
|
||||||
'country' => $this->faker->randomElement(['SK', 'CZ', 'DE', 'FR']),
|
'country' => $this->faker->randomElement(
|
||||||
|
['SK', 'CZ', 'DE', 'FR']
|
||||||
|
),
|
||||||
'phone_number' => $this->faker->phoneNumber,
|
'phone_number' => $this->faker->phoneNumber,
|
||||||
'timezone' => $this->faker->randomElement(['+1.0', '+2.0', '+3.0']),
|
'timezone' => $this->faker->randomElement(
|
||||||
|
['+1.0', '+2.0', '+3.0']
|
||||||
|
),
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user