Skip to content
This repository has been archived by the owner on Jun 3, 2024. It is now read-only.

Commit

Permalink
add constructor array type
Browse files Browse the repository at this point in the history
  • Loading branch information
Qoraiche committed Mar 26, 2019
1 parent 0289546 commit a4174e9
Showing 1 changed file with 28 additions and 11 deletions.
39 changes: 28 additions & 11 deletions src/mailEclipse.php
Original file line number Diff line number Diff line change
Expand Up @@ -637,13 +637,22 @@ static public function handleMailableViewDataArgs($mailable)

if ( $param->getType() !== null )
{

if ( class_exists( $param->getType()->getName() ) )
{
$parameters = [
'is_instance' => true,
'instance' => $param->getType()->getName()
];


} elseif ($param->getType()->getName() == 'array') {

$parameters = [
'is_array' => true,
'arg' => $param->getName()
];

} else {

$parameters = $param->name;
Expand All @@ -661,15 +670,28 @@ static public function handleMailableViewDataArgs($mailable)

$factoryStates = [];

if ( is_array($arg) && $arg['is_instance'] ){
if ( is_array($arg) ){

if ( isset($arg['is_instance']) ){

if ( isset($eloquentFactory[$arg['instance']]) ) {

$filteredparams[] = factory($arg['instance'])->states($factoryStates)->create();

} else {
$filteredparams[] = app($arg['instance']);
}

if ( isset($eloquentFactory[$arg['instance']]) ) {
} elseif( isset($arg['is_array']) ){

$filteredparams[] = factory($arg['instance'])->states($factoryStates)->create();
$filteredparams[] = [];

} else {
$filteredparams[] = app($arg['instance']);
}
} else {

return;
}



} else {

Expand All @@ -692,11 +714,6 @@ static public function handleMailableViewDataArgs($mailable)
}


/**
*
*
*/

static private function getMailableViewData($mailable)
{

Expand Down

0 comments on commit a4174e9

Please sign in to comment.