Esempio n. 1
0
function dateToFormat($birthdate)
{
    if (!is_null($birthdate)) {
        $carbon = new \Carbon\Carbon();
        $date = $carbon->createFromTimestamp(strtotime($birthdate));
        return $date->format('d/m/Y');
    }
    return null;
}
 public function testViewCanBeRendered()
 {
     @unlink(__DIR__ . '/receipt.blade.php');
     $vendor = 'Taylor';
     $product = 'Laravel';
     $street = 'street';
     $location = 'location';
     $phone = 'phone';
     $url = 'url';
     $__stripeInvoice = (object) ['id' => 1, 'date' => $date = time()];
     $invoice = m::mock('Laravel\\Cashier\\Invoice', [m::mock('Laravel\\Cashier\\Contracts\\Billable'), $__stripeInvoice]);
     $invoice->shouldReceive('date')->andReturn(Carbon\Carbon::createFromTimestamp($date));
     /*
      * Invoice items...
      */
     $invoice->shouldReceive('invoiceItems')->andReturn([$invoiceItem = m::mock('StdClass')]);
     $invoiceItem->description = 'foo';
     $invoiceItem->shouldReceive('total')->andReturn('total');
     $invoiceItem->shouldReceive('dollars')->andReturn('total');
     /*
      * Subscription...
      */
     $invoice->shouldReceive('subscriptions')->andReturn([$subscription = m::mock('StdClass')]);
     $subscription->quantity = 1;
     $subscription->shouldReceive('total');
     $subscription->shouldReceive('dollars')->andReturn('dollars');
     $subscription->shouldReceive('startDateString');
     $subscription->shouldReceive('endDateString');
     /*
      * Discounts...
      */
     $invoice->shouldReceive('hasDiscount')->andReturn(true);
     $invoice->shouldReceive('discountIsPercentage')->andReturn(true);
     $invoice->shouldReceive('coupon')->andReturn('coupon');
     $invoice->shouldReceive('percentOff')->andReturn('percent-off');
     $invoice->shouldReceive('discount')->andReturn('discount');
     /*
      * Final total...
      */
     $invoice->shouldReceive('total')->andReturn('total');
     $invoice->shouldReceive('dollars')->andReturn('total');
     /*
      * Billable instance...
      */
     $billable = m::mock('StdClass');
     $billable->shouldReceive('getBillableName')->andReturn('name');
     $compiler = new Illuminate\View\Compilers\BladeCompiler(new Illuminate\Filesystem\Filesystem(), null);
     $compiled = $compiler->compileString(file_get_contents(__DIR__ . '/../src/views/receipt.blade.php'));
     file_put_contents(__DIR__ . '/receipt.blade.php', $compiled);
     ob_start();
     include __DIR__ . '/receipt.blade.php';
     $contents = ob_get_clean();
     @unlink(__DIR__ . '/receipt.blade.php');
 }
Esempio n. 3
0
                        by
                        <?php 
        $latest = $thread->last();
        ?>

                        <a href="#"><img src="<?php 
        echo assets('assets/img/forum-latest.png');
        ?>
" class="forum-post-latest" width="8" height="8"></a>

                        <?php 
        echo char_link(playerIdToName($latest->posted_by));
        ?>
,
                        <abbr title="<?php 
        echo Carbon\Carbon::createFromTimestamp($latest->created);
        ?>
"><?php 
        echo ago($latest->created);
        ?>
</abbr>
                    </small>
                </td>
            </tr>
        <?php 
    }
    ?>
    <?php 
} else {
    ?>
        <tr>
Esempio n. 4
0
 function to_carbon($value, $alternateFormat = null, $defaultTime = null)
 {
     // If it's already a Carbon object, return it.
     if ($value instanceof Carbon\Carbon) {
         return $value;
     }
     // If this value is an integer, we will assume it is a UNIX timestamp's value
     // and format a Carbon object from this timestamp. This allows flexibility
     // when defining your date fields as they might be UNIX timestamps here.
     if (is_numeric($value)) {
         return Carbon\Carbon::createFromTimestamp($value);
     }
     $value = str_replace('/', '-', $value);
     $value = str_replace('\\', '-', $value);
     // Try to convert it using strtotime().
     if (($date = strtotime($value)) !== false) {
         return Carbon\Carbon::createFromTimestamp($date);
     } elseif (!$value instanceof DateTime) {
         $alternateFormat = $alternateFormat ?: 'Y-m-d H:i:s';
         return Carbon\Carbon::createFromFormat($alternateFormat, $value);
     }
     return Carbon\Carbon::instance($value);
 }
Esempio n. 5
0
		      	<th>Order Status</th>
		      	<td><span class="label label-<?php 
echo $details->label;
?>
"><?php 
echo $details->status;
?>
</span></td>
		      </tr>
		      
		      <tr>
		     	<th>Phone</th>
		     	<td><?php 
echo $details->phone;
?>
</td>
		     </tr>
		     <tr>
		     	<th>Created at</th>
		     	<td><?php 
echo Carbon\Carbon::createFromTimestamp(strtotime($details->created_at))->diffForHumans();
?>
</td>
		     </tr>

		     </table>
		     <a href="javascript:history.go(-1);" class="btn btn-primary">Back</a>
			</div>
		</div>
	</div>
</div>
Esempio n. 6
0
				<br>
			</div>
	  </div>
	  <div class="ui vertical divider">
	    VS
	  </div>
	  <div class="column">
			<div class="ui text container right ">

				<img class="ui small bordered rounded image candidate-img" src="{{ $person1->data->photo_url }}">
				<br><br><br>
				<h3>{{ $person1->data->name }}</h3>							

				<?php 
$date = $person->data->birthdate;
$birthdate = Carbon\Carbon::createFromTimestamp($date);
?>
				<p><i class="teal birthday icon"></i> BirthDate : {{ $birthdate->toDateString() }} </p>
				<p><i class="teal student icon"></i> Education : {{$person1->data->education }}</p>
				<p><i class="teal suitcase icon"></i> Occupation : {{$person1->data->occupation }}</p>
				<p><i class="teal mars stroke icon"></i> Gender : {{ $person1->data->gender == 'M' ? 'male' : 'female' }}</p>				
				<p><i class="teal map pin icon"></i> Town : {{ $person1->data->ward_village}}</p>				
				<p><i class="teal male icon"></i> Father : {{ $person1->data->father->name}}</p>
				<p><i class="teal empire icon"></i> Father Religion : {{ $person1->data->father->religion}}</p>				
				<p><i class="teal female icon"></i> Mother : {{ $person1->data->mother->name}}</p>
				<p><i class="teal empire icon"></i> Mother Religion : {{ $person1->data->mother->religion}}</p>				
				<p><i class="teal university icon"></i> legislature : {{ $person1->data->legislature}} </p>
				<p><i class="teal flag icon"></i> ethnicity : {{ $person1->data->ethnicity}}</p>
				<p><i class="teal tag icon"></i> Constituency : {{ $person1->data->constituency->name}} {{ $person->data->constituency->number}}</p>
				<p><i class="teal map pin icon"></i> State : {{ $person1->data->constituency->parent}}</p>
Esempio n. 7
0
function get_time_or_null($timestamp)
{
    if ($timestamp !== null && $timestamp !== 0) {
        return Carbon\Carbon::createFromTimestamp($timestamp);
    }
}