Changes to documents able to edit them now, also support for auto mail attechemnts
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Document>
|
||||
*/
|
||||
class DocumentFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
$ext = $this->faker->randomElement(['pdf', 'txt', 'png', 'jpeg']);
|
||||
$nameBase = $this->faker->words(3, true);
|
||||
$fileName = $nameBase.'.'.$ext;
|
||||
|
||||
return [
|
||||
'name' => $nameBase,
|
||||
'description' => $this->faker->optional()->sentence(),
|
||||
'user_id' => User::factory(),
|
||||
'disk' => 'public',
|
||||
'path' => 'cases/'.$this->faker->uuid().'/documents/'.$fileName,
|
||||
'file_name' => $fileName,
|
||||
'original_name' => $fileName,
|
||||
'extension' => $ext,
|
||||
'mime_type' => match ($ext) {
|
||||
'pdf' => 'application/pdf',
|
||||
'txt' => 'text/plain',
|
||||
'png' => 'image/png',
|
||||
'jpeg' => 'image/jpeg',
|
||||
default => 'application/octet-stream',
|
||||
},
|
||||
'size' => $this->faker->numberBetween(1000, 1000000),
|
||||
'checksum' => null,
|
||||
'is_public' => $this->faker->boolean(10),
|
||||
];
|
||||
}
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('email_templates', function (Blueprint $table) {
|
||||
if (! Schema::hasColumn('email_templates', 'allow_attachments')) {
|
||||
$table->boolean('allow_attachments')->default(false)->after('entity_types');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('email_templates', function (Blueprint $table) {
|
||||
if (Schema::hasColumn('email_templates', 'allow_attachments')) {
|
||||
$table->dropColumn('allow_attachments');
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user