public function permalink($type, $content = null)
    {
        $format = $this->app['config']->get("orchestra/story::permalink.{$type}");

        if (is_null($format) || ! ($content instanceof Content)) {
            return handles('orchestra/story::/');
        }

        if (is_null($published = $content->getAttribute('published_at'))) {
            $published = Carbon::now();
        }

        $permalinks = [
            'id'    => $content->getAttribute('id'),
            'slug'  => str_replace(['_post_/', '_page_/'], '', $content->getAttribute('slug')),
            'type'  => $content->getAttribute('type'),
            'date'  => $published->format('Y-m-d'),
            'year'  => $published->format('Y'),
            'month' => $published->format('m'),
            'day'   => $published->format('d'),
        ];

        foreach ($permalinks as $key => $value) {
            $format = str_replace('{'.$key.'}', $value, $format);
        }

        return handles("orchestra/story::{$format}");
    }
public function permalink($type, $content = null)
    {
        $format = $this->app['config']->get("orchestra/story::permalink.{$type}");

        if (is_null($format) || ! ($content instanceof Content)) {
            return handles('orchestra/story::/');
        }

        if (is_null($published = $content->getAttribute('published_at'))) {
            $published = Carbon::now();
        }

        $permalinks = [
            'id'    => $content->getAttribute('id'),
            'slug'  => str_replace(['_post_/', '_page_/'], '', $content->getAttribute('slug')),
            'type'  => $content->getAttribute('type'),
            'date'  => $published->format('Y-m-d'),
            'year'  => $published->format('Y'),
            'month' => $published->format('m'),
            'day'   => $published->format('d'),
        ];

        foreach ($permalinks as $key => $value) {
            $format = str_replace('{'.$key.'}', $value, $format);
        }

        return handles("orchestra/story::{$format}");
    }
public function permalink ( $ type , $ content = null ) { $ format = $ this -> app [ 'config' ] -> get ( "orchestra/story::permalink.{$type}" ) ; if ( is_null ( $ format ) || ! ( $ content instanceof Content ) ) { return handles ( 'orchestra/story::/' ) ; } if ( is_null ( $ published = $ content -> getAttribute ( 'published_at' ) ) ) { $ published = Carbon :: now ( ) ; } $ permalinks = [ 'id' => $ content -> getAttribute ( 'id' ) , 'slug' => str_replace ( [ '_post_/' , '_page_/' ] , '' , $ content -> getAttribute ( 'slug' ) ) , 'type' => $ content -> getAttribute ( 'type' ) , 'date' => $ published -> format ( 'Y-m-d' ) , 'year' => $ published -> format ( 'Y' ) , 'month' => $ published -> format ( 'm' ) , 'day' => $ published -> format ( 'd' ) , ] ; foreach ( $ permalinks as $ key => $ value ) { $ format = str_replace ( '{' . $ key . '}' , $ value , $ format ) ; } return handles ( "orchestra/story::{$format}" ) ; }
Generate URL by content.

@param  string  $type
@param  \Orchestra\Story\Model\Content|null  $content

@return string
Generate URL by content .