PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Kevinralph M Tenorio  >  Laravel Helpers  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example
Class: Laravel Helpers
Database access helpers using Laravel Eloquent
Author: By
Last change:
Date: 5 years ago
Size: 913 bytes
 

Contents

Class file image Download
<?php

// This is Laravel Helper Class..
//
// READ ME:
//
// Created this prop, just because, Laravel collection errors incase a direct
// access to its members fails. using `prop` it will just return `null` incase
// a member of the collection does not exists, and if accessing it as a method
// you can convert its value as a proper type, like `float, int, integer, boolean,
// dateTime, string, array, object, double` this can easily be extended by
// adding / modifying the a function in `ObjectPropDataType::checkCustomType`
// its not as best implementation but you got the picture.
//

// Sample simple Usage:
$user = prop(User::find(1));

// Shows raw value; string
dd($x->created_at);

// Shows value with DateTime DataType
dd($x->created_at()->toDateTime());

// Accessing meta or if using 'laravel-metable'
// array is casted as a new `ObjectProp`
dd($x->meta->first());


For more information send a message to info at phpclasses dot org.