added support for profile attachment
This commit is contained in:
parent
3d5b146467
commit
318716b2e3
@ -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 ();
|
||||
|
19
app/Models/ProfileAttachment.php
Normal file
19
app/Models/ProfileAttachment.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ProfileAttachment extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
"actor_id",
|
||||
"name",
|
||||
"content"
|
||||
];
|
||||
|
||||
public function actor ()
|
||||
{
|
||||
return $this->belongsTo (Actor::class);
|
||||
}
|
||||
}
|
@ -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 ();
|
||||
|
||||
|
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->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 ();
|
||||
});
|
||||
}
|
||||
};
|
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('profile_attachments', function (Blueprint $table) {
|
||||
$table->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');
|
||||
}
|
||||
};
|
@ -169,7 +169,33 @@
|
||||
@endif
|
||||
</div>
|
||||
|
||||
@if ($user != null)
|
||||
@if ($user == null)
|
||||
<div class="table-section">
|
||||
<div class="heading">
|
||||
<h4>{{ $actor->name }}'s Information</h4>
|
||||
</div>
|
||||
|
||||
<div class="inner">
|
||||
<table class="details-table" cellspacing="3" cellpadding="3">
|
||||
<tbody>
|
||||
|
||||
@foreach ($actor->profile_attachment as $attachment)
|
||||
<tr>
|
||||
<td>
|
||||
<p>{{ $attachment->name }}</p>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<p>{!! $attachment->content !!}</p>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
@else
|
||||
<div class="table-section">
|
||||
<div class="heading">
|
||||
<h4>{{ $user->name }}'s Interests</h4>
|
||||
|
Loading…
x
Reference in New Issue
Block a user