Skip to content

Patch fix features issues #65

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
merged 7 commits into from
Aug 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/Console/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class Kernel extends ConsoleKernel
*/
protected function schedule(Schedule $schedule)
{
// $schedule->command('media-library:delete-old-temporary-uploads')->daily();
$schedule->command('media-library:delete-old-temporary-uploads')->daily();
$schedule->command('lcm:delete-old-unverified-users')->daily();
$schedule->command('lcm:post-article-to-twitter')->everyFourHours();
$schedule->command('lcm:post-article-to-telegram')->everyFourHours();
Expand Down
12 changes: 7 additions & 5 deletions app/Http/Controllers/HomeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ public function index()
{
$latestArticles = Cache::remember('latestArticles', now()->addHour(), function () {
return Article::with('tags')
->published()
->orderByDesc('sponsored_at')
->orderByDesc('submitted_at')
->orderByDesc('published_at')
->orderByViews()
->published()
->trending()
->limit(4)
->get();
Expand All @@ -44,6 +44,8 @@ public function index()
seo()
->description('Laravel Cameroun est le portail de la communauté de développeurs PHP & Laravel au Cameroun, On partage, on apprend, on découvre et on construit une grande communauté.')
->twitterDescription('Laravel Cameroun est le portail de la communauté de développeurs PHP & Laravel au Cameroun, On partage, on apprend, on découvre et on construit une grande communauté.')
->image(asset('/images/socialcard.png'))
->twitterSite('laravelcm')
->withUrl();

return view('home', compact('latestArticles', 'latestThreads', 'latestDiscussions'));
Expand All @@ -54,14 +56,14 @@ public function slack(Request $request)
$request->validate(['email' => 'required|email']);

$client = new Client();
$team = env('SLACK_TEAM_NAME', 'Laravel Cameroun');
$team = config('lcm.slack.team');
$email = $request->input('email');

try {
$client->request(
'POST',
env('SLACK_TEAM_URL').'/api/users.admin.invite?t='
.time().'&email='.$email.'&token='.env('SLACK_API_TOKEN')
config('lcm.slack.url').'/api/users.admin.invite?t='
.time().'&email='.$email.'&token='.config('lcm.slack.token')
.'&set_active=true&_attempts=1'
);

Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/User/SettingController.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function update(UpdateProfileRequest $request)
]);

if ($request->avatar) {
$user->addMediaFromRequest('avatar')
$user->addFromMediaLibraryRequest($request->avatar)
->toMediaCollection('avatar');
$user->avatar_type = 'storage';
$user->save();
Expand Down
7 changes: 6 additions & 1 deletion app/Http/Requests/UpdateProfileRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@

use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Auth;
use Spatie\MediaLibraryPro\Rules\Concerns\ValidatesMedia;

class UpdateProfileRequest extends FormRequest
{
use ValidatesMedia;

/**
* Determine if the user is authorized to make this request.
*
Expand All @@ -32,7 +35,9 @@ public function rules(): array
'github_profile' => 'max:255|nullable|unique:users,github_profile,'.Auth::id(),
'bio' => 'nullable|max:160',
'website' => 'nullable|url',
'avatar' => 'nullable|image|max:2048',
'avatar' => $this->validateSingleMedia()
->extension(['png', 'jpg', 'jpeg', 'gif'])
->maxItemSizeInKb(1024),
];
}
}
2 changes: 1 addition & 1 deletion app/Models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public function registerMediaCollections(): void
{
$this->addMediaCollection('avatar')
->singleFile()
->acceptsMimeTypes(['image/jpg', 'image/jpeg', 'image/png']);
->acceptsMimeTypes(['image/jpg', 'image/jpeg', 'image/png', 'image/gif']);
}

public static function findByUsername(string $username): self
Expand Down
11 changes: 11 additions & 0 deletions auth.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"http-basic": {
"satis.spatie.be": {
"username": "monneylobe@gmail.com",
"password": "Jao8zKnIoRci24cErttBE7tgrjpwUYqOvbQh9y1e4DA41K2x7TJaioTD8P7oQWd4"
}
},
"github-oauth": {
"github.com": "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"
}
}
10 changes: 8 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
"spatie/laravel-feed": "^4.1",
"spatie/laravel-google-fonts": "^1.2",
"spatie/laravel-health": "^1.11",
"spatie/laravel-medialibrary": "^9.0.0",
"spatie/laravel-medialibrary": "^10.4.3",
"spatie/laravel-medialibrary-pro": "^2.0.0",
"spatie/laravel-permission": "^5.1",
"spatie/laravel-sitemap": "^6.1",
"stevebauman/location": "^6.2",
Expand Down Expand Up @@ -120,5 +121,10 @@
},
"minimum-stability": "dev",
"prefer-stable": true,
"repositories": []
"repositories": [
{
"type": "composer",
"url": "https://satis.spatie.be"
}
]
}
119 changes: 100 additions & 19 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions config/filesystems.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
'driver' => 'local',
'root' => public_path('media'),
'url' => env('APP_URL').'/media',
'visibility' => 'public',
],

],
Expand Down
6 changes: 6 additions & 0 deletions config/lcm.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,10 @@
],
],

'slack' => [
'team' => env('SLACK_TEAM_NAME', 'Laravel Cameroun'),
'url' => env('SLACK_TEAM_URL', 'https://laravelcm.slack.com'),
'token' => env('SLACK_API_TOKEN', null),
],

];
Loading