Created
June 30, 2022 05:26
-
-
Save ashishakya/ec327b8238e67a6bf1406eef57141aef to your computer and use it in GitHub Desktop.
pankaj dai ram katha
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| namespace App\Transformers\Tenancy\LeadsCustomField; | |
| use App\Models\Tenancy\LeadsCustomField; | |
| use Illuminate\Support\Str; | |
| use League\Fractal\TransformerAbstract; | |
| /** | |
| * Class LeadsCustomFieldListTransformer | |
| * @package App\Transformers\Tenancy\Object | |
| */ | |
| class LeadsCustomFieldListTransformer extends TransformerAbstract | |
| { | |
| protected $defaultIncludes = ["relation"]; // key ko name | |
| protected $availableIncludes = [""]; //request gare pachi tanney | |
| /** | |
| * @param LeadsCustomField $leadsCustomField | |
| * | |
| * @return array | |
| */ | |
| public function transform(LeadsCustomField $leadsCustomField): array | |
| { | |
| return [ | |
| "id" => $leadsCustomField->id, | |
| "field_type" => $leadsCustomField->field_type, | |
| "field_label" => $leadsCustomField->field_label, | |
| "is_required" => filter_var($leadsCustomField->is_mandatory, FILTER_VALIDATE_BOOLEAN), | |
| "actions" => [ | |
| "edit" => !$leadsCustomField->isUsed(), | |
| "delete" => !$leadsCustomField->isUsed(), | |
| ], | |
| "relation"=> [] // default if tala bata kei aayena bhane | |
| ]; | |
| } | |
| // public function includeRelation($leadsCustomField){ here Relation is key from mathi property | |
| //// relation item ho ki item | |
| //// cif colelction | |
| // return $this->collection($leadsCustomField->relation, new tranform()); | |
| // | |
| //// if item | |
| // return $this->item($leadsCustomField->relation, new tranform()); | |
| // | |
| // } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // chain -> wrap always |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment