diff --git a/laravel_app/app/Mail/ReportMailer.php b/laravel_app/app/Mail/ReportMailer.php index d74efe6..7a130ef 100644 --- a/laravel_app/app/Mail/ReportMailer.php +++ b/laravel_app/app/Mail/ReportMailer.php @@ -56,10 +56,8 @@ public function content(): Content public function attachments(): array { return $this->mailing->attachments()->get()->map(function (ProjectMailingAttachment $attachment) { -// $projectPath = $attachment->mailing->project->path; - return Attachment::fromStorage( - path: "chemba/".$attachment->path + path: $attachment->mailing->project->download_path.$attachment->path ) ->as($attachment->name) ->withMime('application/pdf'); diff --git a/laravel_app/app/Models/ProjectMailing.php b/laravel_app/app/Models/ProjectMailing.php index 03254a4..909a8c5 100644 --- a/laravel_app/app/Models/ProjectMailing.php +++ b/laravel_app/app/Models/ProjectMailing.php @@ -39,7 +39,7 @@ public function addAttachment($name, UploadedFile $file) public function project() { - return $this->belongsTo(Project::class); + return $this->belongsTo(Project::class, 'project_id', 'id'); } public function recipients() diff --git a/laravel_app/app/Models/ProjectMailingAttachment.php b/laravel_app/app/Models/ProjectMailingAttachment.php index 2303fdb..9c931ca 100644 --- a/laravel_app/app/Models/ProjectMailingAttachment.php +++ b/laravel_app/app/Models/ProjectMailingAttachment.php @@ -16,6 +16,6 @@ class ProjectMailingAttachment extends Model public function mailing() { - return $this->belongsTo(ProjectMailing::class); + return $this->belongsTo(ProjectMailing::class, 'project_mailing_id', 'id'); } } diff --git a/laravel_app/database/factories/ProjectBoundingBoxFactory.php b/laravel_app/database/factories/ProjectBoundingBoxFactory.php new file mode 100644 index 0000000..d93a3f1 --- /dev/null +++ b/laravel_app/database/factories/ProjectBoundingBoxFactory.php @@ -0,0 +1,23 @@ + + */ +class ProjectBoundingBoxFactory extends Factory +{ + /** + * Define the model's default state. + * + * @return array + */ + public function definition(): array + { + return [ + // + ]; + } +} diff --git a/laravel_app/database/factories/ProjectDownloadFactory.php b/laravel_app/database/factories/ProjectDownloadFactory.php new file mode 100644 index 0000000..2dd7008 --- /dev/null +++ b/laravel_app/database/factories/ProjectDownloadFactory.php @@ -0,0 +1,23 @@ + + */ +class ProjectDownloadFactory extends Factory +{ + /** + * Define the model's default state. + * + * @return array + */ + public function definition(): array + { + return [ + // + ]; + } +} diff --git a/laravel_app/database/factories/ProjectEmailRecipientFactory.php b/laravel_app/database/factories/ProjectEmailRecipientFactory.php new file mode 100644 index 0000000..d681537 --- /dev/null +++ b/laravel_app/database/factories/ProjectEmailRecipientFactory.php @@ -0,0 +1,23 @@ + + */ +class ProjectEmailRecipientFactory extends Factory +{ + /** + * Define the model's default state. + * + * @return array + */ + public function definition(): array + { + return [ + // + ]; + } +} diff --git a/laravel_app/database/factories/ProjectFactory.php b/laravel_app/database/factories/ProjectFactory.php index a35ecf0..f55f43f 100644 --- a/laravel_app/database/factories/ProjectFactory.php +++ b/laravel_app/database/factories/ProjectFactory.php @@ -3,17 +3,22 @@ namespace Database\Factories; use App\Models\Project; -use App\Models\Team; -use App\Models\User; use Illuminate\Database\Eloquent\Factories\Factory; use Illuminate\Support\Str; -use Laravel\Jetstream\Features; /** * @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\User> */ class ProjectFactory extends Factory { + + /** + * The name of the factory's corresponding model. + * + * @var string + */ + protected $model = Project::class; + /** * Define the model's default state. * diff --git a/laravel_app/database/factories/ProjectMailingAttachmentFactory.php b/laravel_app/database/factories/ProjectMailingAttachmentFactory.php new file mode 100644 index 0000000..a8e61d8 --- /dev/null +++ b/laravel_app/database/factories/ProjectMailingAttachmentFactory.php @@ -0,0 +1,23 @@ + + */ +class ProjectMailingAttachmentFactory extends Factory +{ + /** + * Define the model's default state. + * + * @return array + */ + public function definition(): array + { + return [ + // + ]; + } +} diff --git a/laravel_app/database/factories/ProjectMailingFactory.php b/laravel_app/database/factories/ProjectMailingFactory.php new file mode 100644 index 0000000..e292084 --- /dev/null +++ b/laravel_app/database/factories/ProjectMailingFactory.php @@ -0,0 +1,24 @@ + + */ +class ProjectMailingFactory extends Factory +{ + /** + * Define the model's default state. + * + * @return array + */ + public function definition(): array + { + return [ + 'subject' => $this->faker->sentence, + 'message' => $this->faker->paragraph, + ]; + } +} diff --git a/laravel_app/database/factories/ProjectMosaicFactory.php b/laravel_app/database/factories/ProjectMosaicFactory.php new file mode 100644 index 0000000..52ff698 --- /dev/null +++ b/laravel_app/database/factories/ProjectMosaicFactory.php @@ -0,0 +1,23 @@ + + */ +class ProjectMosaicFactory extends Factory +{ + /** + * Define the model's default state. + * + * @return array + */ + public function definition(): array + { + return [ + // + ]; + } +} diff --git a/laravel_app/database/factories/ProjectReportFactory.php b/laravel_app/database/factories/ProjectReportFactory.php new file mode 100644 index 0000000..fbd046d --- /dev/null +++ b/laravel_app/database/factories/ProjectReportFactory.php @@ -0,0 +1,23 @@ + + */ +class ProjectReportFactory extends Factory +{ + /** + * Define the model's default state. + * + * @return array + */ + public function definition(): array + { + return [ + // + ]; + } +}