mardi 29 septembre 2015

Laravel check if there is any data stored for the upcomming hour

I want to check if there is any data stored in mysql for the upcoming hour. I am using laravel 5.1 and carbon to store and get data.

Here is my code:

 * Check if there is any data for the upcoming hour
 *
 * @return \Illuminate\Http\Response
 */
public function test()
{
    $timestamp = Carbon::now('Australia/Brisbane');

    // start time with end time check in between
   $post = DB::table('posts')
                ->join('profiles', 'posts.profile_id', '=', 'profiles.id')
                ->where('posts.scheduled_time', '=', $timestamp->addMinutes(59)->toDateTimeString())
                ->get();
   dd($post);

}

When I run the query I just get an empty array. Im not sure what I've missed.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire