diff --git a/app/Models/Actor.php b/app/Models/Actor.php index 196f02c..37fcd31 100644 --- a/app/Models/Actor.php +++ b/app/Models/Actor.php @@ -57,6 +57,11 @@ class Actor extends Model return $this->belongsTo (User::class); } + public function profile_attachment () + { + return $this->hasMany (ProfileAttachment::class); + } + public function get_pinned_posts () { $pinned = $this->hasMany (ProfilePin::class, "actor_id")->orderBy ("created_at", "desc")->get (); diff --git a/app/Models/ProfileAttachment.php b/app/Models/ProfileAttachment.php new file mode 100644 index 0000000..715a75f --- /dev/null +++ b/app/Models/ProfileAttachment.php @@ -0,0 +1,19 @@ +belongsTo (Actor::class); + } +} diff --git a/app/Types/TypeActor.php b/app/Types/TypeActor.php index 1ee9edd..e0828dd 100644 --- a/app/Types/TypeActor.php +++ b/app/Types/TypeActor.php @@ -4,6 +4,7 @@ namespace App\Types; use App\Models\User; use App\Models\Actor; +use App\Models\ProfileAttachment; use App\Models\Instance; use App\Models\ProfilePin; @@ -205,6 +206,16 @@ class TypeActor { $instance->save (); } + ProfileAttachment::where ("actor_id", $actor->id)->delete (); + foreach ($request ["attachment"] as $attachment) + { + $profile_attachment = ProfileAttachment::create ([ + "actor_id" => $actor->id, + "name" => $attachment ["name"], + "content" => $attachment ["value"] + ]); + } + $featured_items = TypeActor::actor_process_featured ($actor); ProfilePin::where ("actor_id", $actor->id)->delete (); diff --git a/database/migrations/2025_01_09_020558_alter_fields_in_users_table.php b/database/migrations/2025_01_09_020558_alter_fields_in_users_table.php new file mode 100644 index 0000000..396e40f --- /dev/null +++ b/database/migrations/2025_01_09_020558_alter_fields_in_users_table.php @@ -0,0 +1,38 @@ +text ("interests_general")->nullable ()->change (); + $table->text ("interests_music")->nullable ()->change (); + $table->text ("interests_movies")->nullable ()->change (); + $table->text ("interests_television")->nullable ()->change (); + $table->text ("interests_books")->nullable ()->change (); + $table->text ("interests_heroes")->nullable ()->change (); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('users', function (Blueprint $table) { + $table->string ("interests_general")->nullable ()->change (); + $table->string ("interests_music")->nullable ()->change (); + $table->string ("interests_movies")->nullable ()->change (); + $table->string ("interests_television")->nullable ()->change (); + $table->string ("interests_books")->nullable ()->change (); + $table->string ("interests_heroes")->nullable ()->change (); + }); + } +}; diff --git a/database/migrations/2025_01_09_020935_create_profile_attachments_table.php b/database/migrations/2025_01_09_020935_create_profile_attachments_table.php new file mode 100644 index 0000000..690dd66 --- /dev/null +++ b/database/migrations/2025_01_09_020935_create_profile_attachments_table.php @@ -0,0 +1,32 @@ +id(); + + $table->foreignId ("actor_id")->constrained()->onDelete("cascade"); + $table->text ("name")->nullable (); + $table->text ("content")->nullable (); + + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('profile_attachments'); + } +}; diff --git a/resources/views/users/profile.blade.php b/resources/views/users/profile.blade.php index c58c012..dd44f25 100644 --- a/resources/views/users/profile.blade.php +++ b/resources/views/users/profile.blade.php @@ -169,7 +169,33 @@ @endif - @if ($user != null) + @if ($user == null) +
+ {{ $attachment->name }} + |
+
+
+ {!! $attachment->content !!} + |
+