This repository has been archived by the owner on Mar 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Уведомления для упоминаний, вакансии, Ссылки и листалка
- Loading branch information
1 parent
a6a405a
commit 82a4a8b
Showing
13 changed files
with
350 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
<?php | ||
|
||
namespace App\Notifications; | ||
|
||
use App\Models\Comment; | ||
use App\Models\IdeaKey; | ||
use App\Models\Post; | ||
use App\Models\User; | ||
use App\Notifications\Channels\SiteChannel; | ||
use App\Notifications\Channels\SiteMessage; | ||
use Illuminate\Bus\Queueable; | ||
use Illuminate\Contracts\Queue\ShouldQueue; | ||
use Illuminate\Notifications\Notification; | ||
use NotificationChannels\WebPush\WebPushChannel; | ||
use NotificationChannels\WebPush\WebPushMessage; | ||
|
||
class MentionNotification extends Notification implements ShouldQueue | ||
{ | ||
use Queueable; | ||
|
||
private Comment $comment; | ||
|
||
/** | ||
* FriendlyHugs constructor. | ||
* | ||
* @param IdeaKey $ideaKey | ||
*/ | ||
public function __construct(Comment $comment) | ||
{ | ||
$this->comment = $comment; | ||
} | ||
|
||
/** | ||
* Get the notification's delivery channels. | ||
* | ||
* @param mixed $notifiable | ||
* | ||
* @return array | ||
*/ | ||
public function via(User $user) | ||
{ | ||
return [ | ||
SiteChannel::class, | ||
WebPushChannel::class | ||
]; | ||
} | ||
|
||
/** | ||
* Get the app representation of the notification. | ||
* | ||
* @param mixed $user | ||
* | ||
* @return \Illuminate\Notifications\Messages\MailMessage | ||
*/ | ||
public function toSite(User $user) | ||
{ | ||
$url = route('post.show',$this->comment->post).'#'.dom_id($this->comment); | ||
return (new SiteMessage()) | ||
->title(' упомянул вас в комментарии к публикации') | ||
->setCommentAuthor($this->comment->author->name) | ||
->img($this->comment->author->avatar) | ||
->action($url, $this->comment->post->title); | ||
} | ||
|
||
/** | ||
* @param \App\Models\User $user | ||
* | ||
* @return \NotificationChannels\WebPush\WebPushMessage | ||
*/ | ||
public function toWebPush(User $user) | ||
{ | ||
$url = route('post.show', $this->comment->post) . '#' . dom_id($this->comment); | ||
|
||
return (new WebPushMessage) | ||
->title('Вас упомянули') | ||
->icon($this->comment->author->avatar) | ||
->body('Пользователь '.$this->comment->author->name." упомянул вас в комментарии") | ||
->action('посмотреть',$url) | ||
->vibrate([300, 200, 300]) | ||
->options([ | ||
'TTL' => 86400, // in seconds - 24 hours, | ||
'urgency' => 'high', | ||
]); | ||
} | ||
|
||
/** | ||
* Get the array representation of the notification. | ||
* | ||
* @param mixed $notifiable | ||
* | ||
* @return array | ||
*/ | ||
public function toArray($notifiable) | ||
{ | ||
return [ | ||
// | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<turbo-frame id="latest-positions"> | ||
<div class="row"> | ||
@forelse($positions as $position) | ||
<div class="col-4 position-relative" id="@domid($position)"> | ||
<div | ||
class="bg-body-secondary p-4 rounded"> | ||
|
||
<div class="d-flex align-items-center d-md-block"> | ||
<span class="badge bg-secondary rounded-pill">{{$position->schedule->text()}}</span> | ||
|
||
</div> | ||
|
||
<div class="mt-2"> | ||
|
||
<a href="{{route('position.show', $position)}}" | ||
class="h5 link-body-emphasis stretched-link text-decoration-none">{{$position->title}}</a> | ||
|
||
</div> | ||
|
||
<div class="d-flex flex-column gap-2 mt-3"> | ||
<span class="opacity-50 d-flex align-items-center"> | ||
<x-icon path="bs.geo-alt-fill" class="me-2"/> | ||
{{$position->location}} | ||
</span> | ||
</div> | ||
<div class="d-flex fw-medium mt-3 h5"> | ||
|
||
@if (!is_null($position->salary_min) && !is_null($position->salary_max)) | ||
{{ $position->salary_min }} - {{ $position->salary_max }} ₽ | ||
@elseif (!is_null($position->salary_min)) | ||
от {{ $position->salary_min }} ₽ | ||
@elseif (!is_null($position->salary_max)) | ||
до {{ $position->salary_max }} ₽ | ||
@endif | ||
|
||
</div> | ||
|
||
</div> | ||
</div> | ||
|
||
@empty | ||
<div class="col-12"> | ||
<div class="bg-body-tertiary rounded p-4 p-md-5 align-items-center justify-content-between | ||
position-relative"> | ||
|
||
<div class="text-center"> | ||
Здесь еще нет публикаций | ||
</div> | ||
|
||
</div> | ||
</div> | ||
@endforelse | ||
</div> | ||
</turbo-frame> |
Oops, something went wrong.