-
-
Notifications
You must be signed in to change notification settings - Fork 15
feat: LAR-175 upgrade the approbation system #340
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
StevyMarlino
merged 2 commits into
develop
from
feature/lar-175-article-ameliorer-le-systeme-dapprobation-et-de-refus
Mar 10, 2025
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,31 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Actions\Article; | ||
|
||
use App\Models\Article; | ||
use App\Notifications\ArticleDeclinedNotification; | ||
use Carbon\Carbon; | ||
use Illuminate\Support\Facades\DB; | ||
|
||
final class DeclineArticleAction | ||
{ | ||
public function execute(string $reason, Article $article): Article | ||
{ | ||
return DB::transaction(function () use ($reason, $article) { | ||
|
||
$article->update([ | ||
'declined_at' => Carbon::now(), | ||
'reason' => $reason, | ||
'submitted_at' => null, | ||
]); | ||
|
||
$article->user->notify(new ArticleDeclinedNotification($article)); | ||
|
||
$article->refresh(); | ||
|
||
return $article; | ||
}); | ||
} | ||
} |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,29 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Notifications; | ||
|
||
use App\Models\Article; | ||
use Illuminate\Bus\Queueable; | ||
use Illuminate\Notifications\Messages\MailMessage; | ||
use Illuminate\Notifications\Notification; | ||
|
||
final class ArticleDeclinedNotification extends Notification | ||
{ | ||
use Queueable; | ||
|
||
public function __construct(public Article $article) {} | ||
|
||
public function via(mixed $notifiable): array | ||
{ | ||
return ['mail']; | ||
} | ||
|
||
public function toMail(mixed $notifiable): MailMessage | ||
{ | ||
return (new MailMessage) | ||
->subject(__('emails/article.article_declined.subject')) | ||
->markdown('emails.article_declined', ['article' => $this->article]); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
database/migrations/2025_02_20_112613_add_reason_field_to_articles_table.php
This file contains hidden or 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,17 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
return new class extends Migration | ||
{ | ||
public function up(): void | ||
{ | ||
Schema::table('articles', static function (Blueprint $table): void { | ||
$table->longText('reason')->nullable()->after('canonical_url'); | ||
StevyMarlino marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}); | ||
} | ||
}; |
This file contains hidden or 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,20 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
return [ | ||
|
||
'article_declined' => [ | ||
'subject' => 'Your article has been declined', | ||
'head' => 'Your article :title has been declined for the following reason:', | ||
'recommandation_body' => 'Don\'t be discouraged! You can:', | ||
'recommandation_1' => '1. Review your article and the reason for the decline', | ||
'recommandation_2' => '2. Make the necessary changes', | ||
'recommandation_3' => '3. Resubmit your article once the corrections are made', | ||
'help' => 'Our team is here to help you improve your content.', | ||
'closing' => 'Best regards,', | ||
'team' => 'The Laravel Cameroon Team', | ||
'button_update_article' => 'Edit my article', | ||
], | ||
|
||
]; |
This file contains hidden or 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,20 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
return [ | ||
|
||
'article_declined' => [ | ||
'subject' => 'Votre article a été décliné', | ||
'head' => 'Votre article :title a été décliné pour la raison suivante :', | ||
'recommandation_body' => 'Ne vous découragez pas ! Vous pouvez :', | ||
'recommandation_1' => '1. Consulter votre article et la raison du refus', | ||
'recommandation_2' => '2. Apporter les modifications nécessaires', | ||
'recommandation_3' => '3. Re-soumettre votre article une fois les corrections effectuées', | ||
'help' => 'Notre équipe est là pour vous aider à améliorer votre contenu.', | ||
'closing' => 'Cordialement,', | ||
'team' => 'L\'équipe Laravel Cameroun', | ||
'button_update_article' => 'Modifier mon article', | ||
], | ||
|
||
]; |
This file contains hidden or 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,28 @@ | ||
<x-mail::message> | ||
|
||
<x-mail::panel> | ||
|
||
{{ __('emails/article.article_declined.head', ['title' => $article->title]) }} | ||
|
||
{!! $article->reason !!} | ||
StevyMarlino marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
{{ __('emails/article.article_declined.recommandation_body') }} | ||
|
||
{{ __('emails/article.article_declined.recommandation_1') }} | ||
{{ __('emails/article.article_declined.recommandation_2') }} | ||
{{ __('emails/article.article_declined.recommandation_3') }} | ||
|
||
<x-mail::button :url="route('articles.show', $article)"> | ||
{{ __('emails/article.article_declined.button_update_article') }} | ||
</x-mail::button> | ||
|
||
{{ __('emails/article.article_declined.help') }} | ||
|
||
</x-mail::panel> | ||
|
||
<p> | ||
{{ __('emails/article.article_declined.closing') }} <br> | ||
{{ __('emails/article.article_declined.team') }} | ||
</p> | ||
|
||
</x-mail::message> |
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.