Support the ongoing development of Laravel.io →
Eloquent Packages
Last updated 1 year ago.
0

No one? plz

0

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;

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

Ah, so I don't have to use some package like this one: https://github.com/maddhatter/laravel-fullcalendar ??

0

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

0

Sign in to participate in this thread!

Eventy

Your banner here too?

LonnyX lonnyx Joined 30 Mar 2015

Moderators

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

Your logo here?

Laravel.io

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

© 2024 Laravel.io - All rights reserved.