当前位置: 首页>>代码示例>>PHP>>正文


PHP Carbon::today方法代码示例

本文整理汇总了PHP中Carbon::today方法的典型用法代码示例。如果您正苦于以下问题:PHP Carbon::today方法的具体用法?PHP Carbon::today怎么用?PHP Carbon::today使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Carbon的用法示例。


在下文中一共展示了Carbon::today方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getEstadoResidencia

 public static function getEstadoResidencia($residencia_id, $fecha_inicial = null)
 {
     if ($fecha_inicial == null) {
         $fecha_inicial = Carbon::parse(Carbon::today()->year . "/" . "01/01");
     }
     $estados = Solvencia::where('residencia_id', "=", $residencia_id)->where('año', ">=", $fecha_inicial->year)->orderBy("id", "desc")->get();
     $estados = $estados->filter(function ($estado) use($fecha_inicial) {
         return $estado->año > $fecha_inicial->year or $estado->año == $fecha_inicial->year && $estado->mes >= $fecha_inicial->month;
     });
     return $estados;
 }
开发者ID:seedgabo,项目名称:condominio,代码行数:11,代码来源:Solvencia.php

示例2: index

 /**
  * Display a listing of the resource.
  * GET /eventos
  *
  * @return Response
  */
 public function index()
 {
     $eventos = Eventos::where('fecha_ini', '>=', Carbon::today())->orderby("fecha_ini", "asc")->orderby("tiempo_ini", "asc")->get();
     $eventos->each(function ($evento) {
         $evento = array_add($evento, 'duracion', traducir_fecha(Carbon::parse($evento->fecha_ini . $evento->tiempo_ini)->diffForHumans(Carbon::parse($evento->fecha_fin . $evento->tiempo_fin)), true));
         $evento['inicio'] = traducir_fecha(Carbon::parse($evento->fecha_ini . $evento->tiempo_ini)->toDayDateTimeString());
         $evento['fin'] = traducir_fecha(Carbon::parse($evento->fecha_fin . $evento->tiempo_fin)->toDayDateTimeString());
         foreach ($evento->areas() as $area) {
             $evento->area .= $area->nombre . ",";
         }
     });
     return Response::json($eventos, 200);
 }
开发者ID:seedgabo,项目名称:condominio,代码行数:19,代码来源:EventosController.php

示例3: editar_solicitud_afi

 public function editar_solicitud_afi()
 {
     $fk_empresa_persona = Empresa_Persona::get()->lists('full_name', 'id');
     $fk_persona = Person::where('persona_es_autorizado', '=', FALSE)->orderBy('persona_cid', 'ASC')->get()->lists('full_name', 'id');
     $today = Carbon::today()->toDateString();
     $inputs = Input::get('idedit');
     $solicitud_afiliacion = Solicitud_Afiliacion::find($inputs);
     //$fk_empresa_persona_seleccionada = Person::where('persona_cid','!=',$persona->persona_cid)->where('persona_es_autorizado','=',false)->lists('persona_cid', 'id');
     if ($solicitud_afiliacion) {
         return View::make('solicitud_afiliacion.createSolicitudAfi', array('fk_empresa_persona' => $fk_empresa_persona, 'fk_persona' => $fk_persona, 'solicitud_afiliacion' => $solicitud_afiliacion));
     } else {
         return Redirect::to('solicitud_afiliacion');
     }
 }
开发者ID:bmrpas,项目名称:SHREDDER,代码行数:14,代码来源:SolicitudAfiliacionController.php

示例4: testGetIncompleteProductLoadsWhenIdHasProduct

 public function testGetIncompleteProductLoadsWhenIdHasProduct()
 {
     $user = Factory::create('Giftertipster\\Entity\\Eloquent\\User', ['permissions' => ['test']]);
     $prod_req = Factory::create('Giftertipster\\Entity\\Eloquent\\ProductRequest', ['created_at' => Carbon::tomorrow(), 'user_id' => 1, 'product_id' => 1, 'vendor' => 'foo', 'vendor_id' => 'bar']);
     $idea = Factory::create('Giftertipster\\Entity\\Eloquent\\Idea', ['created_at' => Carbon::today(), 'user_id' => 1, 'description' => 'foobar idea', 'is_fulfilled' => 0]);
     $repo_result = $this->repo()->getIncompleteProductLoads(1);
     //since keys aren't adjusted after sorting, re apply keys:
     foreach ($repo_result as $item) {
         $result[] = $item;
     }
     assertThat($result, not(emptyArray()));
     assertThat($result[0], hasKeyValuePair('type', 'idea load'));
     assertThat($result[0], hasKey('created_at'));
     assertThat($result[0], hasKey('updated_at'));
     assertThat($result[0], hasKey('description'));
     assertThat($result[0], hasKeyValuePair('query', ['idea_description' => 'foobar idea']));
     assertThat($result[0], hasKey('human_time_diff'));
     assertThat($result, not(hasKey(1)));
 }
开发者ID:ryanrobertsname,项目名称:giftertipster.com,代码行数:19,代码来源:EloquentUserRepositoryTest.php

示例5: uploadAsset

 /**
  * Upload an asset.
  * @throws PageblokException
  */
 public function uploadAsset()
 {
     $date = \Carbon::today();
     $file = \Input::file('file');
     $originalName = $file->getClientOriginalName();
     $extension = $file->getClientOriginalExtension();
     // if extension cannot be found a negative 4 is given
     $extensionPosition = strpos($originalName, '.' . $extension) ?: -4;
     $basename = \Str::slug(substr($file->getClientOriginalName(), 0, $extensionPosition));
     // we always save it like .jpg
     $fileName = $date->toDateString() . '-' . $basename . '.jpg';
     if (!$file->isValid()) {
         throw new PageblokException("No file to upload!", 12);
     }
     $uploadedFilePath = \Pageblok::getUploadPath() . '/' . $fileName;
     \Image::make($file)->save($uploadedFilePath, 75);
     // check if file exists
     if (\File::get($uploadedFilePath)) {
         // file url is the relative url
         $fileUrl = '/' . \Config::get('pageblok::settings.upload.folder') . '/' . $fileName;
         return \Response::json(array('status' => true, 'message' => $fileUrl));
     }
     return \Response::json(array('status' => false, 'message' => 'Error during upload'));
 }
开发者ID:adis-me,项目名称:pageblok,代码行数:28,代码来源:AssetController.php

示例6: scopePinAndRecentReply

 public function scopePinAndRecentReply($query)
 {
     return $query->whereRaw("(`created_at` > '" . Carbon::today()->subMonth()->toDateString() . "' or (`order` > 0) )")->orderBy('order', 'desc')->orderBy('updated_at', 'desc');
 }
开发者ID:6174,项目名称:phphub,代码行数:4,代码来源:Topic.php

示例7: function

<?php

/**
 * Created by PhpStorm.
 * User: veoc
 * Date: 30/10/16
 * Time: 11:26 AM
 */
$factory->define(\App\Modules\SaleModule\Entities\Sale::class, function (\Faker\Generator $faker) {
    return ['price' => 0.01, 'start' => Carbon::yesterday(), 'end' => Carbon::today()->addDays($faker->randomNumber(1))];
});
开发者ID:gez-studio,项目名称:gez-mall,代码行数:11,代码来源:ModelFactory.php

示例8: yesterday

 public static function yesterday($tz = null)
 {
     return Carbon::today($tz)->subDay();
 }
开发者ID:igez,项目名称:gaiaehr,代码行数:4,代码来源:Carbon.php

示例9: editar_solicitud_info

 public function editar_solicitud_info()
 {
     $fk_empresa_persona = Empresa_Persona::get()->lists('full_name', 'id');
     $fk_persona = Person::orderBy('persona_cid', 'ASC')->get()->lists('full_name', 'id');
     $today = Carbon::today()->toDateString();
     $year = Carbon::today()->year;
     $inputs = Input::get('idedit');
     $solicitud_informacion = Solicitud_Informacion::find($inputs);
     if ($solicitud_informacion) {
         return View::make('solicitud_informacion.createSolicitudInfo', array('fk_empresa_persona' => $fk_empresa_persona, 'fk_persona' => $fk_persona, 'solicitud_informacion' => $solicitud_informacion, 'today' => $today, 'year' => $year));
     } else {
         return Redirect::to('solicitud_info');
     }
 }
开发者ID:bmrpas,项目名称:SHREDDER,代码行数:14,代码来源:SolicitudInformacionController.php

示例10: uploadFile

 /**
  * Upload file
  *
  * @param $file
  * @return null|uploaded file url
  * @throws PageblokException if file is given but is not valid
  */
 public function uploadFile($file)
 {
     if (is_null($file)) {
         return null;
     }
     $date = \Carbon::today();
     $originalName = $file->getClientOriginalName();
     $extension = $file->getClientOriginalExtension();
     // if extension cannot be found a negative 4 is given
     $extensionPosition = strpos($originalName, '.' . $extension) ?: -4;
     $basename = substr($file->getClientOriginalName(), 0, $extensionPosition);
     // we always save it like .jpg
     $fileName = $date->toDateString() . '-' . $basename . '.jpg';
     if (!$file->isValid()) {
         throw new PageblokException("No file to upload!", 12);
     }
     $uploadedFilePath = $this->getUploadPath() . '/' . $fileName;
     \Image::make($file)->save($uploadedFilePath, 75);
     // check if file exists
     if (\File::get($uploadedFilePath)) {
         // return the relative file url
         $fileUrl = '/' . $this->uploadFolder . '/' . $fileName;
         return $fileUrl;
     }
     // Upload did not succeed...
     \Log::warning("Could not upload file '{$file}");
     return null;
 }
开发者ID:adis-me,项目名称:pageblok,代码行数:35,代码来源:Pageblok.php

示例11: createNewTracker

 public function createNewTracker(RegisterRequest $request)
 {
     $tracker = Tracker::create(['key' => $request->session()->get('key'), 'date' => Carbon::today()->format('m/d/Y')]);
     $tracker->save();
 }
开发者ID:izzach,项目名称:Capstone,代码行数:5,代码来源:Tracker.php

示例12: scopeActive

 public function scopeActive(Builder $query)
 {
     $today = \Carbon::today();
     $query->where([['start_date', '<=', $today], ['end_date', '>=', $today]]);
 }
开发者ID:gez-studio,项目名称:gez-mall,代码行数:5,代码来源:Slider.php

示例13: scopeRecentReply

 public function scopeRecentReply($query)
 {
     return $query->where('created_at', '>', Carbon::today()->subMonth())->orderBy('updated_at', 'desc');
 }
开发者ID:simonfork,项目名称:phphub,代码行数:4,代码来源:Topic.php

示例14: index

 public function index()
 {
     $widget = ['baru' => Penjualan::where('status', 1)->whereBetween('tgl_order', [Carbon::now()->startOfMonth(), Carbon::today()])->count(), 'poBaru' => Penjualan::whereBetween('tgl_order', [Carbon::now()->startOfMonth(), Carbon::today()])->count(), 'rls' => Penjualan::where('status', '!=', 1)->whereBetween('tgl_order', [Carbon::now()->startOfMonth(), Carbon::today()])->count(), 'orders' => Order::where('status', 1)->count(), 'agen' => Customer::where('tipe', 2)->orWhere('tipe', 3)->where(DB::raw('YEAR(created_at)'), Carbon::now()->year)->count(), 'mitra' => Customer::where('tipe', 1)->orWhere('tipe', 6)->where(DB::raw('YEAR(created_at)'), Carbon::now()->year)->count(), 'biasa' => Customer::where('tipe', 4)->where(DB::raw('YEAR(created_at)'), Carbon::now()->year)->count(), 'agenLastYear' => Customer::where('tipe', 2)->orWhere('tipe', 3)->where(DB::raw('YEAR(created_at)'), Carbon::now()->year - 1)->count(), 'mitraLastYear' => Customer::where('tipe', 1)->orWhere('tipe', 6)->where(DB::raw('YEAR(created_at)'), Carbon::now()->year - 1)->count(), 'biasaLastYear' => Customer::where('tipe', 4)->where(DB::raw('YEAR(created_at)'), Carbon::now()->year - 1)->count()];
     $box = ['penjualans' => Penjualan::orderBy('tgl_order', 'DESC')->take(7)->get(), 'barangs' => Barang::orderBy('id', 'DESC')->take(4)->get(), 'customers' => Penjualan::with('customer')->orderBy('tgl_order', 'DESC')->take(8)->get(), 'followups' => Followup::orderBy('created_at', 'desc')->take(6)->get(), 'bahan' => DB::table('bahan')->where('stok', 0)->take(5)->get(), 'menipis' => DB::table('bahan')->where('stok', 0)->count()];
     // CHART =========================================================================================
     $laporanTahunan = Penjualan::select(DB::raw('MONTH(tgl_transfer) as month, count(`id`) as count, sum(`nominal`) as nominal'))->where('status', '!=', 1)->where(DB::raw('YEAR(tgl_transfer)'), Carbon::now()->year)->groupBy(DB::raw('YEAR(tgl_transfer)'))->groupBy(DB::raw('MONTH(tgl_transfer)'))->orderBy('tgl_transfer', 'asc')->get();
     $total = ['thisMonth' => Penjualan::where('status', '!=', 1)->where('tgl_transfer', '>=', Carbon::now()->startOfMonth())->sum('nominal'), 'thisMonthLastYear' => Penjualan::where(DB::raw('YEAR(tgl_transfer)'), Carbon::now()->year - 1)->where(DB::raw('MONTH(tgl_transfer)'), Carbon::now()->month)->where('status', '!=', 1)->sum('nominal'), 'lastYear' => Penjualan::where(DB::raw('YEAR(tgl_transfer)'), Carbon::now()->year - 1)->where('status', '!=', 1)->sum('nominal'), 'thisYear' => Penjualan::where(DB::raw('YEAR(tgl_transfer)'), Carbon::now()->year)->where('status', '!=', 1)->sum('nominal')];
     // END OF CHART =========================================================================================
     // dd($total['thisMonth']);
     return View::make('admin', compact('box', 'widget', 'total', 'laporanTahunan'));
 }
开发者ID:shittyc0de,项目名称:AplikasiLC,代码行数:11,代码来源:AdminController.php

示例15: verfullcalendar

 public function verfullcalendar()
 {
     $proximos = Eventos::where('fecha_ini', '>=', Carbon::today())->take(10)->orderby('fecha_ini', 'asc')->orderby('tiempo_ini', 'asc')->get();
     $eventos = Eventos::select('razon as title', DB::raw('CONCAT(fecha_ini,"T",tiempo_ini) as start'), DB::raw('CONCAT(fecha_fin,"T",tiempo_fin) as end'))->get();
     return View::make('vercalendario')->withEventos($eventos->toJson())->withProximos($proximos);
 }
开发者ID:seedgabo,项目名称:condominio,代码行数:6,代码来源:HomeController.php


注:本文中的Carbon::today方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。