participants->registration_type->contains('certificate_available', 'Y')) [ " shows "Property [registrationType] does not exist on this collection instance"?I want to show for each registration a link" name="description" /> participants->registration_type->contains('certificate_available', 'Y')) [ " shows "Property [registrationType] does not exist on this collection instance"?I want to show for each registration a link" />

Do you know why it appears “Property [registrationType] does not exist on this collection instance”?


Do you know why the " @if ($nextRegistration->participants->registration_type->contains('certificate_available', 'Y')) [ " shows "Property [registrationType] does not exist on this collection instance"?

I want to show for each registration a link "Get certificate" if the column "certificate_available" of the "registration_types" table has the value "Y".

<ul class="list-group"> @foreach($nextRegistrations as $nextRegistration) @if(!empty($nextRegistration->conference) || !empty($nextRegistration->conference->start_date)) @if ($nextRegistration->participants->registration_type->contains('certificate_available', 'Y')) <a href="{{route('conferences.certificateInfo', [ 'regID'=> $nextRegistration->id])}}" class="btn btn-primary ml-2">Download certificate</a> @endif </li> @endif @endforeach </ul>

The participant model has the registration_type():

class Participant extends Model { public function registration(){ return $this->belongsTo('App\Registration'); } public function registration_type(){ return $this->belongsTo('App\RegistrationType'); } }

To get the $nextRegistrations the code is:

$nextRegistrations = $user->registrations() ->with('participants.registration_type') ->whereHas( 'conference', function ($query) { $query->where('end_date', '>', now()); } )->paginate($pageLimit);

And $nextRegistrations shows like:

LengthAwarePaginator {#336 ▼ #total: 3 #lastPage: 1 #items: Collection {#320 ▼ #items: array:3 [▼ 0 => Registration {#308 ▼ ... #relations: array:1 [▼ "participants" => Collection {#327 ▼ #items: array:1 [▼ 0 => Participant {#332 ▼ ... #relations: array:1 [▼ "registration_type" => RegistrationType {#337 ▼ #fillable: array:7 [▶] .... #attributes: array:10 [▼ "id" => 1 "name" => "general" "description" => "desc general" "conference_id" => 1 "certificate_id" => 1 "certificate_available" => "Y" ] ... } ] ... } ] } ] ... } 1 => Registration {#321 ▶} 2 => Registration {#317 ▶} ] } .... }


How do you retrieve the data from the database. You may need to use the with method:

$data = Participant::with('registration_type')->get()

or in the view use "registration_type" as a method, not as a property:


You can find more about the belongs to relationship here: <a href="" rel="nofollow"></a>


  • Plotting - Pch and rep functions in R
  • Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http:/
  • Decide what touching Notification icon does
  • Oracle SQL - How to get counts based up on dates into multiple columns in ORACLE
  • php - Insert data from checkbox array into MySQL
  • ActiveRecord::Enum - PG::InvalidTextRepresentation: ERROR: invalid input syntax for integer:
  • Alternatives to RDD.cartesian for fuzzy join in ApacheSpark
  • Core Data - complex fetch
  • Powerpoint 2010 VSTO AddIn taskpane on multiple Windows
  • QTP UFT Unable to find row count from table
  • how to sort an arraylist that contains string arrays?
  • how to pass value from server control using jQuery?
  • How to fail Phing without triggering backtrace
  • How to clear specified format data from clipboard?
  • How can I include the Ivy dependency and none of its dependencies?
  • Swift string variables localization
  • PHP Copy function not working
  • Cythonized function unexpectedly slow
  • Setting src to Base64-encoded image with Javascript is failing
  • ASPNetCore MVC Routing Let Server Handle Specific Route
  • Javascript focus remove text highlight
  • Laravel 4 routing not working due to .htaccess file?
  • Iron Router: How do I send data to the layout?
  • Can I have a variable number of URI parameters or key-value pairs in Laravel 4?
  • get iframe content as string
  • List images(01.png) and descriptions(01.txt) from directory
  • Simulate click Geckofx vb,net
  • xtable package: Skipping some rows in the output
  • Jackson Parser: ignore deserializing for type mismatch
  • How do I pass the string value parameter of the selected list item from an auto-populated dropdown l
  • How to use remove-erase idiom for removing empty vectors in a vector?
  • Jquery UI tool tip close icon
  • D3 nodes and links from JSON with nested arrays of children
  • Repeat a vertical line on every page in Report Builder / SSRS
  • Why is an OPTIONS request sent to the server?
  • HTML download movie download link
  • How to delete a row from a dynamic generate table using jquery?
  • json Serialization in asp
  • Rails 2: use form_for to build a form covering multiple objects of the same class
  • How to stop GridView from loading again when I press back button?