'Seeding all year dates except weekends- Laravel
I am trying to seed all the current year days except for weekends. I have something like this.
class CallDateSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
for ($i = 1; $i < 365; $i++) {
$date = CallDate::create([
'date' => Carbon::now()->addDays(1 * $i),
]);
}
}
} // end class
Can I make an exception for weekends or holidays? Thanks.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
