Skip to content

Feature/lar 32 admin filament listing des articles #158

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
9dafac9
Add github sponsor link
mckenziearts Dec 27, 2023
e9dc3cf
Update layout components (#139)
mckenziearts Jan 9, 2024
7e5ffa3
Update padding on article layout
mckenziearts Jan 10, 2024
ef0ecff
Migrate to livewire v3 (#140)
mckenziearts May 1, 2024
611d8a4
Remove dependabot
mckenziearts May 1, 2024
0c8cc1b
refactoring: Drop laravel world dependencies and apply refactoring to…
mckenziearts Aug 17, 2024
7fafa3a
fix filename
fabriceyopa May 1, 2024
771fb80
:arrow_up: Bump actions/checkout from 3 to 4 (#142)
dependabot[bot] Aug 17, 2024
05cea15
:arrow_up: Bump actions/cache from 2 to 4 (#143)
dependabot[bot] Aug 17, 2024
6e34994
:arrow_up: Bump dependabot/fetch-metadata from 1.4.0 to 2.2.0 (#145)
dependabot[bot] Aug 17, 2024
eb2e4a8
:arrow_up: Bump stefanzweifel/git-auto-commit-action from 4 to 5 (#141)
dependabot[bot] Aug 17, 2024
b723494
refactor: Update github actions
mckenziearts Aug 17, 2024
cb09517
feat: sending notification after creation of a discussion
mckenziearts Oct 7, 2024
b0ffba1
fix: app env key on phpunit.xml
mckenziearts Oct 7, 2024
df41c36
Merge pull request #147 from laravelcm/feature/lar-9-notification-cre…
cybersoldattech Oct 7, 2024
bba404f
Feature/lar 8 notification soumission darticle (#148)
cybersoldattech Oct 9, 2024
bc5d375
Feature/lar 6 migrate tailwind 4 (#149)
mckenziearts Oct 11, 2024
3ed8dbc
chore: rebase main
mckenziearts Oct 11, 2024
250e3e4
chore: rebase main
mckenziearts Oct 11, 2024
2dba99e
chore: add unnecessary files to gitignore
mckenziearts Oct 11, 2024
75f48d7
Feature/lar 13 modification navigation (#155)
mckenziearts Oct 14, 2024
8196a78
feat:[lar-32] Add article list in cpanel with action
Oct 15, 2024
79eebde
Fix code styling
cybersoldattech Oct 15, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
custom: https://laravel.cm/sponsors
github: laravelcm

33 changes: 33 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
version: 2

updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
- package-ecosystem: composer
directory: "/"
schedule:
interval: weekly
day: friday
groups:
php-dependencies:
update-types:
- "minor"
- "patch"
allow:
- dependency-type: direct
versioning-strategy: increase-if-necessary
- package-ecosystem: npm
directory: "/"
schedule:
interval: weekly
day: thursday
groups:
js-dependencies:
update-types:
- "minor"
- "patch"
allow:
- dependency-type: direct
versioning-strategy: increase-if-necessary
7 changes: 0 additions & 7 deletions .github/dependabot.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/coding-standards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand All @@ -24,6 +24,6 @@ jobs:
run: pint

- name: Commit linted files
uses: stefanzweifel/git-auto-commit-action@v4
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Fix code styling
12 changes: 5 additions & 7 deletions .github/workflows/dependabot-auto-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,18 @@ jobs:

- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v1.4.0
uses: dependabot/fetch-metadata@v2.2.0
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"

- name: Auto-merge Dependabot PRs for semver-minor updates
if: ${{steps.metadata.outputs.update-type == 'version-update:semver-minor'}}
run: gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Auto-merge Dependabot PRs for semver-patch updates
if: ${{steps.metadata.outputs.update-type == 'version-update:semver-patch'}}
run: gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
12 changes: 5 additions & 7 deletions .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,14 @@ jobs:
strategy:
fail-fast: false
matrix:
php: [8.2]
laravel: [9.*]
php: [8.2, 8.3]
laravel: [10.*]
dependency-version: [prefer-stable]
include:
- laravel: 9.*
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Cache dependencies
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ~/.composer/cache/files
key: dependencies-laravel-${{ matrix.laravel }}-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
Expand All @@ -32,4 +30,4 @@ jobs:
- name: Install dependencies
run: composer install --prefer-dist --no-interaction
- name: Run PHPStan
run: composer stan
run: ./vendor/bin/phpstan
7 changes: 2 additions & 5 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,15 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v3

uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite
tools: composer:v2
coverage: none

- name: Install Composer dependencies
run: composer install --prefer-dist --no-interaction

- name: Execute tests
run: composer pest
run: ./vendor/bin/pest
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
npm-debug.log
yarn-error.log
yarn.lock
package-lock.json

/vendor
composer.phar
Expand All @@ -15,11 +14,13 @@ composer.phar

# Laravel Exclude
#
/.phpunit.cache
.phpunit.result.cache
/public/build
/public/hot
/public/storage
/public/media
/public/**/filament
/public/sitemap.xml
/storage/*.key
/storage/framework/cache
Expand Down
7 changes: 7 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
node_modules
/vendor
/public
.git
package-lock.json
yarn.lock
composer.lock
22 changes: 22 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"printWidth": 120,
"semi": false,
"singleQuote": true,
"tabWidth": 4,
"tailwindConfig": "./tailwind.config.js",
"trailingComma": "all",
"plugins": [
"prettier-plugin-blade",
"prettier-plugin-tailwindcss"
],
"overrides": [
{
"files": [
"*.blade.php"
],
"options": {
"parser": "blade"
}
}
]
}
21 changes: 10 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<p align="center">
<a href="https://laravel.com">
<img alt="Laravel v9.x" src="https://img.shields.io/badge/Laravel-v9.x-FF2D20">
<img alt="Laravel v10.x" src="https://img.shields.io/badge/Laravel-v10.x-FF2D20">
</a>
<a href="https://github.com/laravelcm/laravel.cm/actions">
<img src="https://github.com/laravelcm/laravel.cm/workflows/Tests/badge.svg" alt="Build Status" />
Expand All @@ -29,10 +29,9 @@ Vous pouvez rejoindre la communauté ou nous suivre via nos différentes platefo
## Sponsors
Nous tenons à remercier ces **entreprises extraordinaires** pour leur parrainage. Si vous souhaitez devenir sponsor, veuillez visiter <a href="https://laravel.cm/sponsors">la page Laravel.cm de Sponsoring</a>.

- **[Laravel Shopper](https://laravelshopper.io)**
- **[Laravel Shopper](https://laravelshopper.dev)**
- [GDG Douala](https://gdg.community.dev/gdg-douala)
- [NotchPay](https://notchpay.co)
- [Dark Code](https://dark-code.cm)
- [Sharuco](https://sharuco.lndev.me)

## Caractéristiques Serveur
Expand All @@ -55,12 +54,12 @@ The following tools are required in order to start the installation.

Vous pouvez maintenant visiter l'application dans votre navigateur en visitant [http://laravel.cm.test](http://laravel.cm.test). Si vous avez amorcé la base de données, vous pouvez vous connecter à un compte de test avec ** `johndoe` ** & **` password` **.

Une fois que vous avez installé et configuré, pour avoir des dummy data vous devez exécuter la commande
Une fois que vous avez installé et configuré, pour avoir des dummy data, vous devez exécuter la commande
```shell
php artisan db:seed --class=DummyDatabaseSeeder
```

### Github Authentication (optionnel)
### GitHub Authentication (optionnel)
Pour que l'authentification Github fonctionne localement, vous devez [enregistrer une nouvelle application OAuth sur Github](https://github.com/settings/applications/new). Utilisez `http://laravel.cm.test` pour l'URL de la page d'accueil et `http://laravel.cm.test/auth/github` pour l'URL de rappel. Lorsque vous avez créé l'application, remplissez l'ID et le secret dans votre fichier `.env` dans les variables d'environnement ci-dessous. Vous devriez maintenant pouvoir vous authentifier avec Github.

```shell
Expand Down Expand Up @@ -90,11 +89,11 @@ TELEGRAM_CHANNEL=
```

## Commands
Command | Description
--- | ---
**`composer pest`** | Exécuter les tests
`php artisan migrate:fresh --seed` | Reset la base de données
`yarn run watch` | Surveillez les changements dans les fichiers CSS et JS
| Command | Description |
|------------------------------------|--------------------------------------------------------|
| **`composer test`** | Exécuter les tests |
| `php artisan migrate:fresh --seed` | Reset la base de données |
| `yarn && yarn watch` | Surveillez les changements dans les fichiers CSS et JS |

## Maintainers

Expand All @@ -110,7 +109,7 @@ Veuillez lire notre [Code de conduite](CODE_OF_CONDUCT.md) avant de contribuer o

## Vulnérabilités de sécurité

Si vous découvrez une faille de sécurité dans Laravel.cm, veuillez envoyer un e-mail immédiatement à [contact@arthurmonney.me](mailto:contact@arthurmonney.me). **Ne créez pas de problème pour la vulnérabilité.**
Si vous découvrez une faille de sécurité dans Laravel.cm, veuillez envoyer un e-mail immédiatement à [support@laravel.cm](mailto:support@laravel.cm). **Ne créez pas de problème pour la vulnérabilité.**

## License

Expand Down
59 changes: 59 additions & 0 deletions app/Actions/Article/CreateArticleAction.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?php

declare(strict_types=1);

namespace App\Actions\Article;

use App\Data\Article\CreateArticleData;
use App\Gamify\Points\ArticleCreated;
use App\Models\Article;
use App\Notifications\PostArticleToTelegram;
use Carbon\Carbon;
use DateTimeInterface;
use Illuminate\Support\Facades\Auth;

final class CreateArticleAction
{
public function execute(CreateArticleData $articleData): Article
{
if ($articleData->publishedAt && ! ($articleData->publishedAt instanceof DateTimeInterface)) {
$articleData->publishedAt = new Carbon(
time: $articleData->publishedAt,
tz: config('app.timezone')
);
}

/** @var Article $article */
$article = Article::query()->create([
'title' => $articleData->title,
'slug' => $articleData->title,
'body' => $articleData->body,
'published_at' => $articleData->publishedAt,
'submitted_at' => $articleData->submittedAt,
'approved_at' => $articleData->approvedAt,
'show_toc' => $articleData->showToc,
'canonical_url' => $articleData->canonicalUrl,
'user_id' => Auth::id(),
]);

if (collect($articleData->tags)->isNotEmpty()) {
$article->syncTags(tags: $articleData->tags);
}

if ($articleData->file) {
$article->addMedia($articleData->file->getRealPath())->toMediaCollection('media');
}

if ($article->isAwaitingApproval()) {
// Envoi de la notification sur le channel Telegram pour la validation de l'article.
Auth::user()?->notify(new PostArticleToTelegram($article));
session()->flash('status', __('notifications.article.created'));
}

if (Auth::user()?->hasAnyRole(['admin', 'moderator'])) {
givePoint(new ArticleCreated($article));
}

return $article;
}
}
35 changes: 35 additions & 0 deletions app/Actions/Discussion/CreateDiscussionAction.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

declare(strict_types=1);

namespace App\Actions\Discussion;

use App\Data\Discussion\CreateDiscussionData;
use App\Gamify\Points\DiscussionCreated;
use App\Models\Discussion;
use App\Notifications\PostDiscussionToTelegram;
use Illuminate\Support\Facades\Auth;

final class CreateDiscussionAction
{
public function execute(CreateDiscussionData $discussionData): Discussion
{
/** @var Discussion $discussion */
$discussion = Discussion::query()->create([
'title' => $discussionData->title,
'slug' => $discussionData->title,
'body' => $discussionData->body,
'user_id' => Auth::id(),
]);

if (collect($discussionData->tags)->isNotEmpty()) {
$discussion->syncTags($discussionData->tags);
}

givePoint(new DiscussionCreated($discussion));

Auth::user()?->notify(new PostDiscussionToTelegram($discussion));

return $discussion;
}
}
2 changes: 1 addition & 1 deletion app/Console/Commands/CreateAdminUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
namespace App\Console\Commands;

use App\Models\User;
use Exception;
use Illuminate\Console\Command;
use Illuminate\Database\QueryException;
use Illuminate\Support\Facades\Hash;
use Exception;

final class CreateAdminUser extends Command
{
Expand Down
26 changes: 26 additions & 0 deletions app/Console/Commands/NotifyPendingArticles.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

declare(strict_types=1);

namespace App\Console\Commands;

use App\Models\Article;
use App\Notifications\PendingArticlesNotification;
use Illuminate\Console\Command;
use Illuminate\Notifications\AnonymousNotifiable;

final class NotifyPendingArticles extends Command
{
protected $signature = 'lcm:notify-pending-articles';

protected $description = 'Send a Telegram notification for articles that are submitted but neither approved nor declined';

public function handle(AnonymousNotifiable $notifiable): void
{
$pendingArticles = Article::awaitingApproval()->get();

if ($pendingArticles->isNotEmpty()) {
$notifiable->notify(new PendingArticlesNotification($pendingArticles));
}
}
}
1 change: 1 addition & 0 deletions app/Console/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ protected function schedule(Schedule $schedule): void
$schedule->command('lcm:post-article-to-telegram')->everyFourHours();
$schedule->command('lcm:send-unverified-mails')->weeklyOn(1, '8:00');
$schedule->command('sitemap:generate')->daily();
$schedule->command('lcm:notify-pending-articles')->days(2);
}
}

Expand Down
Loading
Loading