diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php index ad88339..304a87c 100644 --- a/app/Http/Controllers/UserController.php +++ b/app/Http/Controllers/UserController.php @@ -39,11 +39,6 @@ public function get($username, $format=false) { "mediaType" => "image/jpeg", "url" => env('APP_URL')."/storage/images/".$user->username.".jpg", ], - // "image" => [ - // "type" => "Image", - // "mediaType" => "image/jpeg", - // "url" => env('APP_URL')."/images/cover-photo.jpg", - // ], "inbox" => env('APP_URL').$user->inboxPath(), "outbox" => env('APP_URL').$user->outboxPath(), "featured" => env('APP_URL').$user->featuredPath(), @@ -54,6 +49,18 @@ public function get($username, $format=false) { ] ]; + if($user->photo) { + $profile['icon']['url'] = $user->photo; + } + + if($user->banner) { + $profile['image'] = [ + 'type' => 'image', + 'mediaType' => 'image/jpeg', + 'url' => $user->banner, + ]; + } + if($user->external_domain) { // Override some of the properties $profile['url'] = 'https://' . $user->external_domain; diff --git a/database/migrations/2018_09_01_232403_user_images.php b/database/migrations/2018_09_01_232403_user_images.php new file mode 100644 index 0000000..adce0fe --- /dev/null +++ b/database/migrations/2018_09_01_232403_user_images.php @@ -0,0 +1,34 @@ +string('photo', 512)->nullable(); + $table->string('banner', 512)->nullable(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('users', function (Blueprint $table) { + $table->dropcolumn('photo'); + $table->dropcolumn('banner'); + }); + } +}