Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Ficha
- public function contenidos()
- {
- return $this->belongsToMany('Contenido', 'contenido_ficha')->withTimestamps();
- }
- Contenido
- public function fichas()
- {
- return $this->belongsToMany('Ficha', 'contenido_ficha')->withTimestamps();
- }
- public function myShow($id, $slug)
- {
- $ficha = Ficha::where('id', $id)->first();
- $date = $ficha->created_at;
- setlocale(LC_TIME, 'Europe/Madrid');
- $date = $date->formatlocalized('%A %d %B %Y');
- return View::make('fichas.show')
- ->with('ficha', $ficha)
- ->with('date', $date);
- }
- @foreach ($ficha->contenidos as $contenido)
- {{ $contenido->nombre }}
- @endforeach
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement