Skip to content

Instantly share code, notes, and snippets.

@ManojKiranA
Created August 29, 2019 12:51
Show Gist options
  • Save ManojKiranA/78290dd16e2598cb14b8316fda6edfa9 to your computer and use it in GitHub Desktop.
Save ManojKiranA/78290dd16e2598cb14b8316fda6edfa9 to your computer and use it in GitHub Desktop.

$relations = [];

    $reflextionClass = new \ReflectionClass(TravelRequest::class);

    foreach($reflextionClass->getMethods() as $method) 
    {
        $doc = $method->getDocComment();

        $relations[$method->name] =  Str::contains((new \ReflectionMethod(TravelRequest::class, $method->name))->getDocComment(),['\Illuminate\Database\Eloquent\Relations']);

    }

    $collection = collect($relations)->filter(function($each){

if ($each) { return true; } }); dd($collection);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment