route('articles.edit', $article)public function __construct()
{
$this->authorizeResource(Article::class, 'article');
} User::withCount(['posts' => function($query) {
$query->whereDate('created_at', '>=', now()->startOfWeek());
}])
->orderByDesc('posts_count')
->take(3)
->get(); Article::whereYear('created_at', now()->year)
->whereMonth('created_at', now()->month)
->orWhere(function ($query) {
$query->whereYear('created_at', now()->subYear()->year)
->whereMonth('created_at', now()->month);
})
->get()
->groupBy(function($article) {
return Carbon::parse($article->created_at)
->format('m-Y');
}); return $file->user_id === $user->id;$this->authorize('download', $file);
return Storage::disk($disk)->download($path);$user->posts()
->latest()
->get(); return !$post->isPaid or optional($user)->hasSubscription;Gate::allows('view', $this)return $this->membership_ends_at >= now();\DB::table('users')
->where('active', true)
->whereDate('updated_at', '<=', now()->subMonths(3))
->update(['active' => false]);