我如何使用laravel elequent中的if else获取数据

时间:2019-03-10 08:27:16

标签: sql database laravel

假设我的薪金模型包含月份和年份列 我想获取数据

    Salary::where((year==date('Y') && month<date('m')) || year<date('Y'))->get()

我如何才能获得laravel的成功?

1 个答案:

答案 0 :(得分:4)

尝试一下

#!/usr/bin/perl

use LWP::Parallel::UserAgent qw(:CALLBACK);
use HTTP::Request; 

my $BrowserName = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.85 Safari/537.36";

my $pua = LWP::Parallel::UserAgent->new();
$pua->agent( $BrowserName );
$pua->nonblock('true');
$pua->in_order  (1);
$pua->duplicates(0);
$pua->timeout   (10);
$pua->redirect  (2);
$pua->remember_failures ( 1 );

$url = "https://www.squeezemind.it";

my $res = $pua->register( HTTP::Request->new('GET', $url), \&gestione_risposta, 4096 );

my $entries = $pua->wait();

# Leggo le risposte
foreach (keys %$entries) {
  my $res = $entries->{$_}->response;
  print "\n\nAnswer for '",$res->request->url, "' was ", $res->code,": ", $res->message;  
}


sub gestione_risposta {

  my($html_content, $response, $protocol, $entry) = @_;

  if( !$response->is_success || $response->code != 200 ) { return C_ENDCON; }  

  if( length($html_content) ) {    
    # Bla Bla
  }

  return undef; 

}