Redirection is working perfectly but i am no able to get the variable
$this->posts->tvseasons->tvepisodes->tvvideos->alias;
Its giving error
Undefined property: Illuminate\Database\Eloquent\Collection::$tvepisodes
use Akhil\Vh1\Models\TvShow;
function onStart()
{
$show_id = $this->Param('show_id');
$season_id = $this->Param('season_id');
$episode_id = $this->Param('episode_id');
$this['show_id'] = $show_id;
$this['season_id'] = $season_id;
$this['episode_id'] = $episode_id;
$this['posts'] = TvShow::isPublished()->where('alias', '=', $show_id)
->with(array('tvseasons' => function($s){
$s->isPublished()->where('alias', '=', $this->season_id)
->with(array('tvepisodes' => function($e){
$e->isPublished()->where('alias', '=', $this->episode_id)
->with(array('tvvideos' => function($f){
$f->where('published', '=', 1)
->where('is_deleted', '=', 0)
->orderBy('id', 'asc')
->skip(0)->take(1);
}))->skip(0)->take(1);
}))->skip(0)->take(1);
}))->first();
//echo '<pre>';print_r($posts->tvseasons->tvepisodes);
$this['posts'] = $this->posts->tvseasons->tvepisodes->tvvideos->alias;
//$url = Request::url();
//return Redirect::to($url.'/hello', 302);
}
Last updated