Profile.php 538 B

123456789101112131415161718192021222324252627
  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Database\Eloquent\Factories\HasFactory;
  4. use Illuminate\Database\Eloquent\Model;
  5. class Profile extends Model
  6. {
  7. protected $guarded = [];
  8. public function profileImage()
  9. {
  10. $imagePath = ($this->image) ? $this->image : 'profile/57O4X5QgQJLM5zXBiMpwprcdprSeCVdw14DxW7kL.png';
  11. return '/storage/' . $imagePath;
  12. }
  13. public function followers()
  14. {
  15. return $this->belongsToMany(User::class);
  16. }
  17. public function user()
  18. {
  19. return $this->belongsTo(User::class);
  20. }
  21. }