本文整理汇总了PHP中Room::where_del_date方法的典型用法代码示例。如果您正苦于以下问题:PHP Room::where_del_date方法的具体用法?PHP Room::where_del_date怎么用?PHP Room::where_del_date使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Room
的用法示例。
在下文中一共展示了Room::where_del_date方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run()
{
Bundle::start('messages');
$twoweeks = date('Y-m-d', strtotime('+2 weeks'));
$week = date('Y-m-d', strtotime('+1 weeks'));
$tomorrow = date('Y-m-d', strtotime('+1 day'));
$rooms = Room::where_del_date($tomorrow)->or_where('del_date', '=', $week)->or_where('del_date', '=', $twoweeks)->get();
foreach ($rooms as $room) {
switch ($room->del_date) {
case $twoweeks:
$expire_date = "over twee weken";
break;
case $week:
$expire_date = "over een week";
break;
case $tomorrow:
$expire_date = "morgen";
break;
}
Message::send(function ($message) use($room, $expire_date) {
$message->to($room->email);
$message->from('kamers@kamergenood.nl', 'Kamergenood');
$message->subject('Verleng de kameradvertentie: "' . $room->title . '"');
$message->body('view: emails.extend');
$message->body->id = $room->id;
$message->body->title = $room->title;
$message->body->url = $room->url;
$message->body->delkey = $room->delkey;
$message->body->expire_date = $expire_date;
$message->html(true);
});
}
}
示例2: run
public function run()
{
Bundle::start('messages');
$today = date('Y-m-d');
$rooms = Room::where_del_date($today)->get();
foreach ($rooms as $room) {
Message::send(function ($message) use($room) {
$message->to($room->email);
$message->from('kamers@kamergenood.nl', 'Kamergenood');
$message->subject('Kamer verlopen en verwijderd: "' . $room->title . '"');
$message->body('view: emails.deleted');
$message->body->title = $room->title;
$message->html(true);
});
$path_room_folder = getcwd() . '/public_html/img/room/' . $room->id;
File::rmdir($path_room_folder);
$room->delete();
}
}