Server IP : / Your IP : 10.244.4.16 [ Web Server : nginx/1.25.3 System : Linux escuela-portal-app-54f56585bc-kst6g 5.15.0-1084-azure #93-Ubuntu SMP Sat Mar 15 14:12:29 UTC 2025 x86_64 User : root ( 0) PHP Version : 8.2.13 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals, Domains : 0 Domains MySQL : OFF | cURL : ON | WGET : OFF | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /proc/448/cwd/app/vendor/laravel/jetstream/src/ |
Upload File : |
<?php namespace Laravel\Jetstream; use Illuminate\Http\UploadedFile; use Illuminate\Support\Facades\Storage; use Illuminate\Support\Str; use Laravel\Jetstream\Features; trait HasProfilePhoto { /** * Update the user's profile photo. * * @param \Illuminate\Http\UploadedFile $photo * @return void */ public function updateProfilePhoto(UploadedFile $photo) { tap($this->profile_photo_path, function ($previous) use ($photo) { $this->forceFill([ 'profile_photo_path' => $photo->storePublicly( 'profile-photos', ['disk' => $this->profilePhotoDisk()] ), ])->save(); if ($previous) { Storage::disk($this->profilePhotoDisk())->delete($previous); } }); } /** * Delete the user's profile photo. * * @return void */ public function deleteProfilePhoto() { if (! Features::managesProfilePhotos()) { return; } if (is_null($this->profile_photo_path)) { return; } Storage::disk($this->profilePhotoDisk())->delete($this->profile_photo_path); $this->forceFill([ 'profile_photo_path' => null, ])->save(); } /** * Get the URL to the user's profile photo. * * @return string */ public function getProfilePhotoUrlAttribute() { return $this->profile_photo_path ? Storage::disk($this->profilePhotoDisk())->url($this->profile_photo_path) : $this->defaultProfilePhotoUrl(); } /** * Get the default profile photo URL if no profile photo has been uploaded. * * @return string */ protected function defaultProfilePhotoUrl() { $name = trim(collect(explode(' ', $this->name))->map(function ($segment) { return mb_substr($segment, 0, 1); })->join(' ')); return 'https://ui-avatars.com/api/?name='.urlencode($name).'&color=7F9CF5&background=EBF4FF'; } /** * Get the disk that profile photos should be stored on. * * @return string */ protected function profilePhotoDisk() { return isset($_ENV['VAPOR_ARTIFACT_NAME']) ? 's3' : config('jetstream.profile_photo_disk', 'public'); } }