“Laravel entre datas” Respostas de código

Laravel entre datas

$from = date('2018-01-01');
$to = date('2018-05-02');

Reservation::whereBetween('reservation_from', [$from, $to])->get();
Nasty Narwhal

data de Laravel entre

$from = date('2018-01-01');
$to = date('2018-05-02');

Reservation::whereBetween('reservation_from', [$from, $to])->get();
Cloudy Caiman

PHP Laravel entre datas

namespace App\Http\Controllers;

use App\Mail\CheckUser;
use App\User;
use Carbon\Carbon;
use Illuminate\Http\Request;
use PDF;

class TestController extends Controller
{
    public function index()
    {   
       return view('welcome');
    }

    public function daily_report(Request $request)
    {
       $start_date = Carbon::parse($request->start_date)
                             ->toDateTimeString();

       $end_date = Carbon::parse($request->end_date)
                             ->toDateTimeString();

       return User::whereBetween('created_at', [
         $start_date, $end_date
       ])->get();
    }
}
inbloom

Verifique se a data entre duas datas Laravel

<?php 
  //check if date between two dates
$currentDate = date('Y-m-d');
$currentDate = date('Y-m-d', strtotime($currentDate));   
$startDate = date('Y-m-d', strtotime("01/09/2019"));
$endDate = date('Y-m-d', strtotime("01/10/2019"));   
if (($currentDate >= $startDate) && ($currentDate <= $endDate)){   
  echo "Current date is between two dates";
}else{    
  echo "Current date is not between two dates";  
}
//@sujay
$uj@y

Respostas semelhantes a “Laravel entre datas”

Perguntas semelhantes a “Laravel entre datas”

Mais respostas relacionadas para “Laravel entre datas” em PHP

Procure respostas de código populares por idioma

Procurar outros idiomas de código