mirror of
https://bitbucket.org/studiotem/jandl-taskmanager-app.git
synced 2026-10-21 06:20:21 +00:00
Merge branch 'main' of bitbucket.org:studiotem/jandl-taskmanager-app
This commit is contained in:
commit
64d63e453a
9 files changed
+183
-3
No files matched your search
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace App\Events;
|
||||
|
||||
use App\Models\SubTask;
|
||||
use Illuminate\Broadcasting\Channel;
|
||||
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||
use Illuminate\Broadcasting\PresenceChannel;
|
||||
use Illuminate\Broadcasting\PrivateChannel;
|
||||
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
|
||||
use Illuminate\Foundation\Events\Dispatchable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class SubTaskCreated
|
||||
{
|
||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
|
||||
public $subtask;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Subtask $subtask)
|
||||
{
|
||||
$this->subtask = $subtask;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the channels the event should broadcast on.
|
||||
*
|
||||
* @return \Illuminate\Broadcasting\Channel|array
|
||||
*/
|
||||
public function broadcastOn()
|
||||
{
|
||||
return new PrivateChannel('channel-name');
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Events\SubTaskCreated;
|
||||
use App\Http\Resources\BlockerResource;
|
||||
use App\Http\Resources\SubTaskResource;
|
||||
use App\Models\Attachment;
|
||||
|
||||
@@ -42,9 +42,9 @@ class UserController extends Controller {
|
||||
}
|
||||
|
||||
$token = $user->createToken( 'password-reset', [ 'password-reset' ] )->plainTextToken;
|
||||
$url = env( 'APP_URL_FE' ) . '#/auth/reset-password?token=' . $token . '&email=' . $user->email;
|
||||
$url = env( 'APP_URL_FE' ) . '/#/auth/reset-password?token=' . $token . '&email=' . $user->email;
|
||||
|
||||
Mail::to( 'michal.feher@gmail.com' )->send( new PasswordReset( $url ) );
|
||||
Mail::to( $user->email )->send( new PasswordReset( $url ) );
|
||||
|
||||
return [ 'message' => 'Email sent.' ];
|
||||
}
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Listeners;
|
||||
|
||||
use App\Events\SubTaskCreated;
|
||||
use App\Mail\NewTask;
|
||||
use App\Mail\PasswordReset;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
|
||||
class SendNewTaskEmailNotification implements ShouldQueue
|
||||
{
|
||||
/**
|
||||
* Create the event listener.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the event.
|
||||
*
|
||||
* @param \App\Events\SubTaskCreated $event
|
||||
* @return void
|
||||
*/
|
||||
public function handle(SubTaskCreated $event)
|
||||
{
|
||||
//Mail::to( $event->subtask->user->email )->send( new NewTask( $event->subtask ) );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace App\Mail;
|
||||
|
||||
use App\Models\SubTask;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Mail\Mailables\Content;
|
||||
use Illuminate\Mail\Mailables\Envelope;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class NewTask extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
public $subtask;
|
||||
|
||||
/**
|
||||
* Create a new message instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Subtask $subtask)
|
||||
{
|
||||
$this->subtask = $subtask;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the message envelope.
|
||||
*
|
||||
* @return \Illuminate\Mail\Mailables\Envelope
|
||||
*/
|
||||
public function envelope()
|
||||
{
|
||||
return new Envelope(
|
||||
subject: 'New Task',
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the message content definition.
|
||||
*
|
||||
* @return \Illuminate\Mail\Mailables\Content
|
||||
*/
|
||||
public function content()
|
||||
{
|
||||
return new Content(
|
||||
view: 'emails.task.new_task_created',
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the attachments for the message.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function attachments()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Observers;
|
||||
|
||||
use App\Events\SubTaskCreated;
|
||||
use App\Models\SubTask;
|
||||
|
||||
class SubTaskObserver
|
||||
@@ -14,7 +15,7 @@ class SubTaskObserver
|
||||
*/
|
||||
public function created(SubTask $subTask)
|
||||
{
|
||||
//
|
||||
SubTaskCreated::dispatch($subTask);
|
||||
}
|
||||
|
||||
public function updating(SubTask $subTask)
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use App\Events\SubTaskCreated;
|
||||
use App\Listeners\SendNewTaskEmailNotification;
|
||||
use App\Models\MasterTask;
|
||||
use App\Models\SubTask;
|
||||
use App\Observers\MasterTaskObserver;
|
||||
@@ -22,6 +24,10 @@ class EventServiceProvider extends ServiceProvider
|
||||
Registered::class => [
|
||||
SendEmailVerificationNotification::class,
|
||||
],
|
||||
SubTaskCreated::class => [
|
||||
SendNewTaskEmailNotification::class,
|
||||
//LogEvent::class,
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('jobs', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->string('queue')->index();
|
||||
$table->longText('payload');
|
||||
$table->unsignedTinyInteger('attempts');
|
||||
$table->unsignedInteger('reserved_at')->nullable();
|
||||
$table->unsignedInteger('available_at');
|
||||
$table->unsignedInteger('created_at');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('jobs');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1 @@
|
||||
New task created: {{ $subtask->mastertask->title }}
|
||||
Reference in new issue
Block a user