BirhanGkta Verinin oluşma tarihinden 30 süre geçen verileri nasıl alabilirim Ben şöyle bir kod yazmıştım ama bu yapıyı kullanmak istemiyorum foreach ($gethomefeatured as $homefeatured) { $fixvariable= $homefeatured->created_at; $projetime = time($homefeatured->created_at); $timeplus = strtotime($fixvariable. ' + 30 day'); if ($projetime >= $timeplus ) { DB::table('projects')->where('id', $homefeatured->id)->update(['homefeatured' => 0]); } }
sineld Laravel kullanıyorsanız lütfen tarih objelerinde Carbon nimetinden yararlanın, örneğin son 30 gün içinde kayıt olmuş kullanıcılar listesi: $users = Users::where('status_id', 'active') ->where( 'created_at', '>', Carbon::now()->subDays(30)) ->get();