Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/282.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Laravel从集合中取出第一个结果_Php_Laravel 4 - Fatal编程技术网

Php Laravel从集合中取出第一个结果

Php Laravel从集合中取出第一个结果,php,laravel-4,Php,Laravel 4,我在控制器中有以下方法 public function artikel(){ $breadcrumb = array( 'Home' => URL::to('/'), 'Artikel' => '' ); $this->layout->title = "Egoji"; $artikels = Posting::orderBy("created_at","des

我在控制器中有以下方法

public function artikel(){
        $breadcrumb = array(
            'Home' => URL::to('/'),
            'Artikel' => ''
        );

        $this->layout->title = "Egoji";
        $artikels = Posting::orderBy("created_at","desc")->where("postings.tipe","=","artikel")->paginate(5);

        $this->layout->content = View::make("frontend.artikel.index",array("artikels"=>$artikels, 'breadcrumb'=>$breadcrumb))->render();

}

在视图
frontend.artikel.index
中,我试图使用
$artikels->shift()
提取第一个artikel。我得到了第一个artikel,但它没有从集合中删除,当我循环其余部分时,它仍然在那里。

您是否也可以将代码发布到您使用的
array\u shift