public function order(Request $request)
    {
        $slug = $this->getSlug($request);

        $dataType = Voyager::model('DataType')->where('slug', '=', $slug)->first();

        // Check permission
        $this->authorize('edit', app($dataType->model_name));

        if (!isset($dataType->order_column) || !isset($dataType->order_display_column)) {
            return redirect()
            ->route("voyager.{$dataType->slug}.index")
            ->with([
                'message'    => __('voyager::bread.ordering_not_set'),
                'alert-type' => 'error',
            ]);
        }

        $model = app($dataType->model_name);
        if ($model && in_array(SoftDeletes::class, class_uses($model))) {
            $model = $model->withTrashed();
        }
        $results = $model->orderBy($dataType->order_column, $dataType->order_direction)->get();

        $display_column = $dataType->order_display_column;

        $dataRow = Voyager::model('DataRow')->whereDataTypeId($dataType->id)->whereField($display_column)->first();

        $view = 'voyager::bread.order';

        if (view()->exists("voyager::$slug.order")) {
            $view = "voyager::$slug.order";
        }

        return Voyager::view($view, compact(
            'dataType',
            'display_column',
            'dataRow',
            'results'
        ));
    }
public function order(Request $request)
    {
        $slug = $this->getSlug($request);

        $dataType = Voyager::model('DataType')->where('slug', '=', $slug)->first();

        // Check permission
        $this->authorize('edit', app($dataType->model_name));

        if (!isset($dataType->order_column) || !isset($dataType->order_display_column)) {
            return redirect()
            ->route("voyager.{$dataType->slug}.index")
            ->with([
                'message'    => __('voyager::bread.ordering_not_set'),
                'alert-type' => 'error',
            ]);
        }

        $model = app($dataType->model_name);
        if ($model && in_array(SoftDeletes::class, class_uses($model))) {
            $model = $model->withTrashed();
        }
        $results = $model->orderBy($dataType->order_column, $dataType->order_direction)->get();

        $display_column = $dataType->order_display_column;

        $dataRow = Voyager::model('DataRow')->whereDataTypeId($dataType->id)->whereField($display_column)->first();

        $view = 'voyager::bread.order';

        if (view()->exists("voyager::$slug.order")) {
            $view = "voyager::$slug.order";
        }

        return Voyager::view($view, compact(
            'dataType',
            'display_column',
            'dataRow',
            'results'
        ));
    }
public function order ( Request $ request ) { $ slug = $ this -> getSlug ( $ request ) ; $ dataType = Voyager :: model ( 'DataType' ) -> where ( 'slug' , '=' , $ slug ) -> first ( ) ; // Check permission $ this -> authorize ( 'edit' , app ( $ dataType -> model_name ) ) ; if ( ! isset ( $ dataType -> order_column ) || ! isset ( $ dataType -> order_display_column ) ) { return redirect ( ) -> route ( "voyager.{$dataType->slug}.index" ) -> with ( [ 'message' => __ ( 'voyager::bread.ordering_not_set' ) , 'alert-type' => 'error' , ] ) ; } $ model = app ( $ dataType -> model_name ) ; if ( $ model && in_array ( SoftDeletes :: class , class_uses ( $ model ) ) ) { $ model = $ model -> withTrashed ( ) ; } $ results = $ model -> orderBy ( $ dataType -> order_column , $ dataType -> order_direction ) -> get ( ) ; $ display_column = $ dataType -> order_display_column ; $ dataRow = Voyager :: model ( 'DataRow' ) -> whereDataTypeId ( $ dataType -> id ) -> whereField ( $ display_column ) -> first ( ) ; $ view = 'voyager::bread.order' ; if ( view ( ) -> exists ( "voyager::$slug.order" ) ) { $ view = "voyager::$slug.order" ; } return Voyager :: view ( $ view , compact ( 'dataType' , 'display_column' , 'dataRow' , 'results' ) ) ; }
Order BREAD items.

@param string $table

@return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
Order BREAD items .