1. Go to this page and download the library: Download weremagine/laravel-traits 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/ */
weremagine / laravel-traits example snippets
use Remagine\Traits\HasCreator;
class Article extends Model
{
use HasCreator;
use Remagine\Traits\HasImages;
class Article extends Model
{
use HasImages;
/**
* Images to append to the model via HasImages.
*
* @return array
*/
public function imagesArray()
{
return [
[
'attribute' => 'image_url',
'field' => 'image',
],
];
}
/**
* The string to prefix image attributes with.
*
* @returns string
*/
public function imagePrefix()
{
return env('AWS_CDN').'/';
}
use Remagine\Traits\HasOne;
class QrCode extends Model
{
use HasOne;
/**
* The name to give the relationship via the HasOne trait.
*
* @var string
*/
protected $has_one_attribute = 'model';
/**
* The name of the field to lookup the HasOne model.
*
* @var string
*/
protected $has_one_type = 'model_type';
/**
* The name of the field containing the HasOne model's id.
*
* @var string
*/
protected $has_one_id = 'model_id';
use Remagine\Traits\HasSlug;
class Article extends Model
{
use HasSlug;
/**
* The attribute to sluggify when saving.
*
* @var string
*/
protected $sluggify = 'title';
use Remagine\Traits\HasUniqueKey;
class Article extends Model
{
use HasUniqueKey;
/**
* The name of the unique key for the model.
*/
protected $unique_key = 'key';
/**
* The length unique keys generated should be.
*/
protected $unique_key_length = 10;
/**
* Indicates if the key should be uppercased.
*/
protected $uppercase_key = false;
/**
* The prefix for the unique key.
*/
protected $key_prefix = null;
/**
* The suffix for the unique key.
*/
protected $key_suffix = null;
use Remagine\Traits\HasUuid;
class Article extends Model
{
use HasUuid;
/**
* The name of the field to store uuids.
*/
protected $uuid_field = 'uuid';
Article::byUuid($uuid);
use Remagine\Traits\UserAgent;
class Article extends Model
{
use UserAgent;
/**
* Indicates if the agent should be parsed when saving.
*
* @var array
*/
protected $parse_agent_fields = false;
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.