Support the ongoing development of →
Eloquent Packages
Last updated 4 months ago.

No one? plz


first of all u have to describe how to connect tables;

in your Market model

public function Calendar ()
     return $this->hasOne( 'App\Calendar' ); //or hasMany ( up to you, its about application how to work logic )

after, you can call market item with calendar or calendars

$markets = App\Market::with('Calendar')->get();

Add this method in your Calendar modal

public function isOpen() {
     if ( $this->event == 'open') return true;
     return false;

public function isClose() {
     if ( $this->event == 'close') return true;
     return false;

public function isPromo() {
     if ( $this->event == 'promo') return true;
     return false;

its ready to use in your blade;

@foreach ( $markets as $item)
       <td>{{ item->name }}</td>
       <td>{{ item->Calendar->isOpen() ? 'Opened' : 'Closed or Promoted' }}</td>

Ah, so I don't have to use some package like this one: ??


There is no package used in my code. Its modals and laravel eloquent magic


Sign in to participate in this thread!


Your banner here too?

LonnyX lonnyx Joined 30 Mar 2015


We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2022 - All rights reserved.