本文整理汇总了PHP中Carbon\Carbon::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Carbon::create方法的具体用法?PHP Carbon::create怎么用?PHP Carbon::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Carbon\Carbon
的用法示例。
在下文中一共展示了Carbon::create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGetHumanDateCarbon
public function testGetHumanDateCarbon()
{
$model = new Model();
$model->date = Carbon::create(2014, 1, 1, 0, 0, 0);
//Asserts
$this->assertEquals('January 1, 2014', $model->getHumanDate('date'));
}
示例2: material_update_material_cost_form_submit_correct
/**
* @test
*/
public function material_update_material_cost_form_submit_correct()
{
$this->visit('/material/13/edit')->see('MTech MIS Login Screen');
$user = User::find(46);
$this->actingAs($user)->visit('/material/13/edit')->type("32", 'mat_cost_cost_kg')->type(\Carbon\Carbon::create(2016, 03, 01), 'mat_cost_date')->press("Update Price")->assertSessionHas('flash');
$this->assertResponseOk();
}
示例3: testIssetReturnTrueForProperties
public function testIssetReturnTrueForProperties()
{
$properties = array('year', 'month', 'day', 'hour', 'minute', 'second', 'dayOfWeek', 'dayOfYear', 'daysInMonth', 'timestamp', 'age', 'quarter', 'dst', 'offset', 'offsetHours', 'timezone', 'timezoneName', 'tz', 'tzName');
foreach ($properties as $property) {
$this->assertTrue(isset(Carbon::create(1234, 5, 6, 7, 8, 9)->{$property}));
}
}
示例4: __construct
public function __construct()
{
parent::setUp();
$this->user = factory(\App\User::class)->create();
$this->administratorFactory = new \Larapress\Admin\Database\Factories\AdministratorFactory(Faker\Factory::create(), \Carbon\Carbon::create());
$this->administrator = $this->administratorFactory->administrator($this->user->id)->save();
}
示例5: up
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
//
Schema::create('sponsors', function (Blueprint $table) {
$table->increments('id');
$table->string('slug');
$table->string('company');
$table->string('website');
$table->string('slogan')->nullable();
$table->text('bio')->nullable();
$table->text('tags')->nullable();
$table->text('options')->nullable();
$table->text('contacts')->nullable();
$table->string('photo')->nullable();
$table->timestamps();
$table->timestamp('published')->nullable();
$table->softDeletes();
});
Sponsor::create(['company' => 'Cylance', 'slug' => 'cylance', 'website' => 'http://www.cylance.com', 'bio' => '<p>Cylance is the first company to apply artificial intelligence, algorithmic science and machine learning to cyber security and improve the way companies, governments and end users proactively solve the world’s most difficult security problems. Using a breakthrough mathematical process, Cylance quickly and accurately identifies what is safe and what is a threat, not just what is in a blacklist or whitelist. Cylance provides the technology and services to be truly predictive and preventive against advanced threats.</p>', 'photo' => '/images/sponsors/cylance.png', 'published' => Carbon::create(2015, 00, 04, 19, 37, 05)]);
Sponsor::create(['company' => 'Dynatrace', 'slug' => 'dynatrace', 'website' => 'http://www.dynatrace.com', 'bio' => '<p>Dynatrace is the innovator behind the industry’s premier Digital Performance Platform, making real-time information about digital performance visible and actionable for everyone across business and IT. We help customers of all sizes see their applications and digital channels through the lens of their end users. More than 7,500 organizations use these insights to master complexity, gain operational agility and grow revenue by delivering amazing customer experiences.</p>', 'photo' => '/images/sponsors/dynatrace.png', 'published' => Carbon::create(2015, 00, 04, 19, 37, 05)]);
Sponsor::create(['company' => 'Forsythe Technology', 'slug' => 'forsythe', 'website' => 'http://www.forsythe.com', 'bio' => '<p>Founded in 1971, Forsythe is one of the largest independent IT integrators in North America, serving approximately 1,000 U.S. and Canada-based companies. Forsythe provides independent consulting, hosting solutions and technology financing, as well as IT products and services from leading IT infrastructure manufacturers and vendors. Clients come to Forsythe for help optimizing cost, managing risk, improving performance and enabling innovation within their IT and data center operations to deliver greater value to their business.</p>', 'photo' => '/images/sponsors/forsythe.png', 'published' => Carbon::create(2015, 00, 04, 19, 37, 05)]);
Sponsor::create(['company' => 'Hitachi Data Systems', 'slug' => 'hitachi', 'website' => 'http://www.hitachi.com', 'bio' => '<p>Hitachi Data Systems builds information management and Social Innovation solutions for business and social prosperity. Our IT solutions and services drive strategic management and analysis of the world’s data. Only HDS integrates the best of Hitachi IT and operational technology to deliver the insight that businesses need to thrive. HDS.com</p>', 'photo' => '/images/sponsors/hitachi.png', 'published' => Carbon::create(2015, 00, 04, 19, 37, 05)]);
Sponsor::create(['company' => 'Workday', 'slug' => 'workday', 'website' => 'http://www.workday.com', 'bio' => '<p>Workday is a leading provider of enterprise cloud applications for financeand human resources. Founded in 2005, Workday delivers financial management, human capital management, and analytics applications designed for the world\'s largest companies, educational institutions, and government agencies. Hundreds of organizations, ranging from medium-sized businesses to Fortune 50 enterprises, have selected Workday.</p>', 'photo' => '/images/sponsors/workday.jpg', 'published' => Carbon::create(2015, 00, 04, 19, 37, 05)]);
Sponsor::create(['company' => 'MCCI', 'slug' => 'mcci', 'website' => 'http://www.mccinnovations.com/', 'bio' => '<p>MCCi provides innovative solutions that transform paper-based processes into smart practices. MCCi works with organizations on records and document management, scanning and business workflow. As the #1 Laserfiche reseller, we are passionate about helping organizations run their office more efficiently – saving time, money and resources.</p>', 'photo' => '/images/sponsors/mcci.jpg', 'published' => Carbon::create(2015, 00, 04, 19, 37, 05)]);
Sponsor::create(['company' => 'Good Technologies', 'slug' => 'good', 'website' => 'http://www.good.com', 'bio' => '<p>Good Technology is the leader in secure mobility, providing the leading secure mobility solution for enterprises and governments worldwide, across all stages of the mobility lifecycle. Good’s comprehensive, end-to-end secure mobility solutions portfolio consists of a suite of collaboration applications, a secure mobility platform, mobile device management, unified monitoring, management and analytics and a third-party application and partner ecosystem. Good has more than 5,000 customers in 184 countries, including more than 50 of the FORTUNE 100™ companies. Learn more at www.good.com.</p>', 'photo' => '/images/sponsors/good.jpg', 'published' => Carbon::create(2015, 00, 04, 19, 37, 05)]);
Sponsor::create(['company' => 'Nimble Storage', 'slug' => 'nimble-storage', 'website' => 'http://www.nimblestorage.com', 'bio' => '<p>The Power of One: A Single Storage Consolidation Platform. Most storage architectures were engineered to deliver just a single functional benefit: high performance or high capacity.The Nimble Storage Adaptive Flash platform is transforming this land of storage silos. Enterprises can use a single architectural approach to cater dynamically to varying workloads’ needs for performance and capacity, as well as data protection. Only Nimble offers the Power of One: gain the benefits of consolidation, without compromising the ability to deliver the service levels required for specific workloads. IT organizations that use the Nimble Storage Adaptive Flash platform can predict, manage, and deliver the storage that is required to optimize applications and workloads across the enterprise.</p>', 'photo' => '/images/sponsors/nimble-storage.png', 'published' => Carbon::create(2015, 00, 04, 19, 37, 05)]);
Sponsor::create(['company' => 'Windstream', 'slug' => 'windstream', 'website' => 'http://www.windstream.com', 'bio' => '<p>Windstream, a FORTUNE 500 company, is a leading provider of advanced network communications and technology solutions, including cloud computing and managed services, to businesses nationwide.</p>
<p>Windstream Hosted Solutions offers one of the most comprehensive enterprise-class cloud and managed services portfolios in the industry. From robust cloud computing solutions including public, private and hybrid cloud and cloud storage to complete managed services and colocation options, your network infrastructure, applications, systems and data are maintained in highly secure data centers strategically located nationwide.</p>', 'photo' => '/images/sponsors/windstream.jpg', 'published' => Carbon::create(2015, 00, 04, 19, 37, 05)]);
Sponsor::create(['company' => '2FA', 'slug' => '2fa', 'website' => 'http://www.2fa.com', 'bio' => '<p>2FA Inc. is a cybersecurity company created on the single vision of simplifying authentication. 2FA serves customers in diverse industries including: public sector, healthcare, and enterprise. 2FA supports over 1,000 customers and millions of users around the world, including deployments in all 50 states and over 25 countries.</p>', 'photo' => '/images/sponsors/2fa.png', 'published' => Carbon::create(2015, 00, 04, 19, 37, 05)]);
Sponsor::create(['company' => 'SecureNation', 'slug' => 'secure-nation', 'website' => 'http://www.securenation.com', 'bio' => '<p>SecureNation’s is a “Network Security Advocate and Technology Ally” for our clients addressing almost all of their IT Security needs. We are partnered with most of the industry leading technologies and we have over 300 Gartner Magic Quadrant partners. We have saved millions of dollars for organizations across the US from colleges, financial institutions, state and local government, health-care to Fortune 500. Solving information security and overall technology issues normally at a fraction of the cost. The backbone of SecureNation is total transparency, deep discount negotiation, honesty and long lasting relationships.</p>', 'photo' => '/images/sponsors/secure-nation.png', 'published' => Carbon::create(2015, 00, 04, 19, 37, 05)]);
Sponsor::create(['company' => 'Arbor Networks', 'slug' => 'arbor-networks', 'website' => 'http://www.arbornetworks.com', 'bio' => '<p>Arbor Networks helps secure the world\'s largest enterprise and service provider networks from DDoS attacks and advanced threats. Arbor strives to be the "force multipler," making network and security teams the experts. Our goal is to provide a richer picture into networks and more security context - so customers can solve problems faster and help reduce the risk to their business.</p>', 'photo' => '/images/sponsors/arbor-networks.jpg', 'published' => Carbon::create(2015, 00, 04, 19, 37, 05)]);
}
示例6: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
// SET UP NEW CARBON DATES
$_old = '2016/san-antonio';
$_new = (object) ['slug' => '2017/san-antonio', 'published' => Carbon::create(2016, 01, 18, 16, 30, 00), 'start' => Carbon::create(2017, 01, 18, 07, 00, 00), 'end' => Carbon::create(2017, 01, 18, 16, 30, 00)];
// DELETE DUPLICATES
$conference = Conference::where('slug', '=', $_new->slug)->delete();
$forceDel = Conference::onlyTrashed()->forceDelete();
$agenda = Agenda::where('conference_slug', '=', $_new->slug)->delete();
$forceDel = Agenda::onlyTrashed()->forceDelete();
$option = Option::where('slug', '=', $_new->slug)->delete();
$forceDel = Option::onlyTrashed()->forceDelete();
unset($conference, $agenda, $option, $forceDel);
// RESCHEDULE CONFERENCE
$conference = Conference::where('slug', '=', $_old)->update(['slug' => $_new->slug, 'start_date' => $_new->start, 'end_date' => $_new->end, 'published' => $_new->published]);
// UPDATE OPTIONS
$option = Option::where('slug', '=', $_old)->update(['slug' => $_new->slug]);
// UPDATE AGENDA
$agendas = Agenda::where('conference_slug', '=', $_old)->get();
foreach ($agendas as $agenda) {
$agenda->conference_slug = $_new->slug;
$agenda->timeslot = $_new->start->format('Y-m-d') . ' ' . $agenda->timeslot->format('H:i:s');
$agenda->save();
}
// UPDATE SPEAKERS
$speakers = Speaker::where('conference_slug', '=', $_old)->update(['conference_slug' => $_new->slug]);
}
示例7: costVsSelling
/**
* Cost Vs Selling Price Report
*
* @return $this
*/
public function costVsSelling($month, $year)
{
$this->authorize('view_gp_report');
$date = Carbon::create($year, $month);
$jobIds = DespatchLogEntry::thisMonth($date)->get()->pluck('despatch_log_book_job_cards_id_fk')->toArray();
return view('reports.costVsSelling')->with(['jobs' => JobCard::find($jobIds)]);
}
示例8: should_be_invalid_when_expired
/** @test */
public function should_be_invalid_when_expired()
{
Carbon::setTestNow(Carbon::create(2014, 10, 11, 10, 23, 34));
$reminder = new Reminder($this->id, $this->email, $this->code);
Carbon::setTestNow(Carbon::create(2014, 10, 11, 11, 25, 12));
$this->assertFalse($reminder->isValid());
}
示例9: testDateGetsSet
public function testDateGetsSet()
{
$apod = new APOD();
$date = \Carbon\Carbon::create();
$apod->date($date);
$this->assertTrue($apod->parameters['date'] == $date->format('Y-m-d'));
}
示例10: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
foreach (range(2015, 2030) as $year) {
DB::table('terms')->insert(['start_date' => Carbon::create($year, 8, 20)->toIso8601String(), 'end_date' => Carbon::create($year, 12, 31)->toIso8601String()]);
DB::table('terms')->insert(['start_date' => Carbon::create($year + 1, 1, 1)->toIso8601String(), 'end_date' => Carbon::create($year + 1, 5, 31)->toIso8601String()]);
}
}
示例11: runAccount1
/**
* Run the database seed for account "Compte joint".
*
* @return void
*/
public function runAccount1()
{
Revenue::create(['account_id' => 1, 'name' => 'Salaire Simon', 'amount' => 1551.24, 'date' => Carbon::create(2015, 8, 3, 0)]);
Revenue::create(['account_id' => 1, 'name' => 'Indemnité Delphine', 'amount' => 1146.38, 'date' => Carbon::create(2015, 8, 4, 0)]);
Revenue::create(['account_id' => 1, 'name' => 'Prestations CAF', 'amount' => 446.1, 'date' => Carbon::create(2015, 8, 5, 0)]);
Revenue::create(['account_id' => 1, 'name' => 'Remboursement Bébé au naturel', 'amount' => 13.94, 'date' => Carbon::create(2015, 8, 6, 0)]);
}
示例12: material_store_cost_log_route_works
/**
* @test
*/
public function material_store_cost_log_route_works()
{
$this->visit('/material')->see('MTech MIS Login Screen');
$user = \App\User::find(46);
$this->actingAs($user)->post('/material/13/costlog', ['_token' => csrf_token(), 'mat_cost_cost_kg' => 32, 'mat_cost_date' => \Carbon\Carbon::create(2016, 03, 01)]);
$this->assertRedirectedTo('/material');
}
示例13: testMarc005
public function testMarc005()
{
$rec = $this->parseRecordData('
<marc:controlfield tag="005">20090407000000.0</marc:controlfield>
');
$this->assertEquals(Carbon::create(2009, 4, 7, 0, 0, 0), $rec->modified);
}
示例14: store
public function store(MensalidadeRequest $request, Mensalidade $m)
{
//$m = new Mensalidade();
$dataPrimeiroVenc = $request->dt_venc;
// dd/mm/yyyy
$dta = explode("/", $dataPrimeiroVenc);
$dia = $dta[0];
$mes = $dta[1];
$ano = $dta[2];
$data_venc = Carbon::create($ano, $mes, $dia);
$valor = $this->getfloat($request->valor);
for ($i = 1; $i <= $request->num_parcelas; $i++) {
if ($i == 1) {
//primeiro vencimento
$mes_data_venc = $data_venc;
} else {
$mes_data_venc = $data_venc->addMonth();
}
$m->mes_status = $request->status;
$m->insert(['mes_alu_id' => $request->aluno, 'mes_num' => $i, 'mes_valor' => $valor, 'mes_data_venc' => $mes_data_venc, 'mes_status' => $request->status, 'created_at' => Carbon::now(), 'updated_at' => Carbon::now()]);
}
$mensalidades = $m->join('aluno', function ($join) {
$join->on('mensalidade.mes_alu_id', '=', 'aluno.id');
})->where('mes_alu_id', '=', $request->aluno)->get();
$aluno = new Aluno();
//$nomeAluno = $aluno->all()->where('alu_id',$request->aluno);
$objAluno = DB::table('aluno')->where('id', '=', $request->aluno)->get();
//return $nomeAluno;
//return redirect()->route('mensalidades.lista', ['mensalidades'=>$mensalidades, 'aluno'=>$objAluno, 'test'=>1]);
return view('mensalidade.index', ['mensalidades' => $mensalidades, 'aluno' => $objAluno, 'test' => 1]);
//return var_dump($mensalidades);
}
示例15: carbonFromIso
private function carbonFromIso($dateFromApi)
{
if ($dateFromApi == null) {
return Carbon::create(null);
}
return Carbon::createFromFormat(\DateTime::ISO8601, $dateFromApi);
}