Answers for "laravel created at where date"

PHP
0

laravel where created_at today

$posts = Post::whereDate('created_at', Carbon::today())->get();
Posted by: Guest on March-04-2021
1

how set date for do work in laravel

//go to App\Console\Kernel
//for see all run the " php artisan schedule:list "
//for run that run the " php artisan schedule:work "
  
<?php

namespace App\Console;

use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
use Illuminate\Support\Facades\DB;

class Kernel extends ConsoleKernel
{
    /**
     * The Artisan commands provided by your application.
     *
     * @var array
     */
    protected $commands = [
        //
    ];

    /**
     * Define the application's command schedule.
     *
     * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
     * @return void
     */
    protected function schedule(Schedule $schedule)
    {
        $schedule->call(function () {
            DB::table('recent_users')->delete();
        })->daily();
    }
}
Posted by: Guest on June-14-2021

Code answers related to "laravel created at where date"

Browse Popular Code Answers by Language