1. Go to this page and download the library: Download mookofe/laravel-support library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
mookofe / laravel-support example snippets
namespace App;
use Mookofe\LaravelSupport\Model;
class User extends Model {
}
$model->current_date = '2015-01-01 00:00:00';
echo $model->getHumanDate('current_date'); //January 01, 2015
//Using Carbon datetime format:
$format = 'l jS \\of F Y h:i:s A';
echo $model->getHumanDate('current_date', $format); //Thursday 1st of January 01 2015 00:00:00 AM
$collection = User::all();
//New collection only with the specified fields
$format = array('name', 'lastname');
$new_collection = $collection->rebuild($format);
//You can also change field names and objects as follow:
$format = array('id', 'personal_data' => ['name', 'lastname', 'sex']);
$new_collection = $collection->rebuild($format);
$collection = User::all();
$user_avatar_collection = User_avatar::all();
//Check if all users have a record on the user avatar collection
$collection->compare($user_avatar_collection, 'user_id', 'id'); //boolean