PHP code example of onramplab / laravel-custom-fields
1. Go to this page and download the library: Download onramplab/laravel-custom-fields 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/ */
onramplab / laravel-custom-fields example snippets
use OnrampLab\CustomFields\Concerns\Customizable;
class Lead extends Model
{
use Customizable;
protected $guarded = [];
public function account()
{
return $this->belongsTo(Account::class);
}
public function getContext(): Model
{
return $this->account;
}
}
use OnrampLab\CustomFields\Concerns\Contextable;
class Account extends Model
{
use Contextable;
public function leads()
{
return $this->hasMany(Lead::class);
}
}
use OnrampLab\CustomFields\Concerns\Customizable;
class Lead extends Model
{
use Customizable;
protected $guarded = [];
public function account()
{
return $this->belongsTo(Account::class);
}
public function getContext(): Model
{
return $this->account;
}
}