Merge branch 'release/0.5.15'
This commit is contained in:
commit
f6f34f7d9a
30 changed files with 554 additions and 250 deletions
|
|
@ -3,19 +3,14 @@
|
||||||
namespace App;
|
namespace App;
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Cviebrock\EloquentSluggable\Sluggable;
|
||||||
use League\CommonMark\CommonMarkConverter;
|
use League\CommonMark\CommonMarkConverter;
|
||||||
use MartinBean\Database\Eloquent\Sluggable;
|
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
|
|
||||||
class Article extends Model
|
class Article extends Model
|
||||||
{
|
{
|
||||||
use SoftDeletes;
|
|
||||||
/*
|
|
||||||
* We want to turn the titles into slugs
|
|
||||||
*/
|
|
||||||
use Sluggable;
|
use Sluggable;
|
||||||
const DISPLAY_NAME = 'title';
|
use SoftDeletes;
|
||||||
const SLUG = 'titleurl';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The attributes that should be mutated to dates.
|
* The attributes that should be mutated to dates.
|
||||||
|
|
@ -31,6 +26,20 @@ class Article extends Model
|
||||||
*/
|
*/
|
||||||
protected $table = 'articles';
|
protected $table = 'articles';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the sluggable configuration array for this model.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function sluggable()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'titleurl' => [
|
||||||
|
'source' => 'title',
|
||||||
|
],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Define the relationship with webmentions.
|
* Define the relationship with webmentions.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -45,13 +45,11 @@ class ArticlesController extends Controller
|
||||||
$published = '0';
|
$published = '0';
|
||||||
}
|
}
|
||||||
//if a `.md` is attached use that for the main content.
|
//if a `.md` is attached use that for the main content.
|
||||||
$content = null; //set default value
|
|
||||||
if ($request->hasFile('article')) {
|
if ($request->hasFile('article')) {
|
||||||
$file = $request->file('article')->openFile();
|
$file = $request->file('article')->openFile();
|
||||||
$content = $file->fread($file->getSize());
|
$content = $file->fread($file->getSize());
|
||||||
}
|
}
|
||||||
$main = $content ?? $request->input('main');
|
$main = $content ?? $request->input('main');
|
||||||
try {
|
|
||||||
$article = Article::create(
|
$article = Article::create(
|
||||||
[
|
[
|
||||||
'url' => $request->input('url'),
|
'url' => $request->input('url'),
|
||||||
|
|
@ -60,16 +58,6 @@ class ArticlesController extends Controller
|
||||||
'published' => $published,
|
'published' => $published,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
} catch (Exception $e) {
|
|
||||||
$msg = $e->getMessage();
|
|
||||||
$unique = strpos($msg, '1062');
|
|
||||||
if ($unique !== false) {
|
|
||||||
//We've checked for error 1062, i.e. duplicate titleurl
|
|
||||||
return redirect('/admin/blog/create')->withInput()->with('message', 'Duplicate title, please change');
|
|
||||||
}
|
|
||||||
//this isn't the error you're looking for
|
|
||||||
throw $e;
|
|
||||||
}
|
|
||||||
|
|
||||||
return redirect('/admin/blog');
|
return redirect('/admin/blog');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -78,20 +78,31 @@ class MicropubController extends Controller
|
||||||
$data['content'] = $request->input('properties.content')[0]['html'];
|
$data['content'] = $request->input('properties.content')[0]['html'];
|
||||||
}
|
}
|
||||||
$data['in-reply-to'] = $request->input('properties.in-reply-to')[0];
|
$data['in-reply-to'] = $request->input('properties.in-reply-to')[0];
|
||||||
$data['location'] = $request->input('properties.location');
|
// check location is geo: string
|
||||||
//flatten location if array
|
if (is_string($request->input('properties.location.0'))) {
|
||||||
if (is_array($data['location'])) {
|
$data['location'] = $request->input('properties.location.0');
|
||||||
$data['location'] = $data['location'][0];
|
}
|
||||||
|
// check location is h-card
|
||||||
|
if (is_array($request->input('properties.location.0'))) {
|
||||||
|
if ($request->input('properties.location.0.type' === 'h-card')) {
|
||||||
|
try {
|
||||||
|
$place = $this->placeService->createPlaceFromCheckin($request->input('properties.location.0'));
|
||||||
|
$data['checkin'] = $place->longurl;
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$data['published'] = $request->input('properties.published')[0];
|
$data['published'] = $request->input('properties.published')[0];
|
||||||
//create checkin place
|
//create checkin place
|
||||||
if (array_key_exists('checkin', $request->input('properties'))) {
|
if (array_key_exists('checkin', $request->input('properties'))) {
|
||||||
$data['checkin'] = $request->input('properties.checkin.0.properties.url.0');
|
|
||||||
$data['swarm-url'] = $request->input('properties.syndication.0');
|
$data['swarm-url'] = $request->input('properties.syndication.0');
|
||||||
try {
|
try {
|
||||||
$this->placeService->createPlaceFromCheckin($request->input('properties.checkin.0'));
|
$place = $this->placeService->createPlaceFromCheckin($request->input('properties.checkin.0'));
|
||||||
|
$data['checkin'] = $place->longurl;
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$data['checkin'] = null;
|
$data['checkin'] = null;
|
||||||
|
$data['swarm-url'] = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -50,12 +50,6 @@ class NotesController extends Controller
|
||||||
$note->longitude = $lnglat[0];
|
$note->longitude = $lnglat[0];
|
||||||
$note->address = $note->place->name;
|
$note->address = $note->place->name;
|
||||||
$note->placeLink = '/places/' . $note->place->slug;
|
$note->placeLink = '/places/' . $note->place->slug;
|
||||||
$note->geoJson = $this->getGeoJson(
|
|
||||||
$note->longitude,
|
|
||||||
$note->latitude,
|
|
||||||
$note->place->name,
|
|
||||||
$note->place->icon
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
/*$mediaLinks = [];
|
/*$mediaLinks = [];
|
||||||
foreach ($note->media()->get() as $media) {
|
foreach ($note->media()->get() as $media) {
|
||||||
|
|
@ -157,12 +151,6 @@ class NotesController extends Controller
|
||||||
$note->longitude = $lnglat[0];
|
$note->longitude = $lnglat[0];
|
||||||
$note->address = $note->place->name;
|
$note->address = $note->place->name;
|
||||||
$note->placeLink = '/places/' . $note->place->slug;
|
$note->placeLink = '/places/' . $note->place->slug;
|
||||||
$note->geoJson = $this->getGeoJson(
|
|
||||||
$note->longitude,
|
|
||||||
$note->latitude,
|
|
||||||
$note->place->name,
|
|
||||||
$note->place->icon
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return view('notes.show', compact('note', 'replies', 'reposts', 'likes'));
|
return view('notes.show', compact('note', 'replies', 'reposts', 'likes'));
|
||||||
|
|
@ -355,19 +343,20 @@ class NotesController extends Controller
|
||||||
{
|
{
|
||||||
$icon = $icon ?? 'marker';
|
$icon = $icon ?? 'marker';
|
||||||
|
|
||||||
return '{
|
return
|
||||||
"type": "FeatureCollection",
|
"{
|
||||||
"features": [{
|
'type': 'FeatureCollection',
|
||||||
"type": "Feature",
|
'features': [{
|
||||||
"geometry": {
|
'type': 'Feature',
|
||||||
"type": "Point",
|
'geometry': {
|
||||||
"coordinates": [' . $longitude . ', ' . $latitude . ']
|
'type': 'Point',
|
||||||
|
'coordinates': [$longitude, $latitude]
|
||||||
},
|
},
|
||||||
"properties": {
|
'properties': {
|
||||||
"title": "' . $title . '",
|
'title': '$title',
|
||||||
"icon": "' . $icon . '"
|
'icon': '$icon'
|
||||||
}
|
}
|
||||||
}]
|
}]
|
||||||
}';
|
}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,19 +5,14 @@ namespace App;
|
||||||
use DB;
|
use DB;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
|
use Cviebrock\EloquentSluggable\Sluggable;
|
||||||
use Phaza\LaravelPostgis\Geometries\Point;
|
use Phaza\LaravelPostgis\Geometries\Point;
|
||||||
use MartinBean\Database\Eloquent\Sluggable;
|
|
||||||
use Phaza\LaravelPostgis\Eloquent\PostgisTrait;
|
use Phaza\LaravelPostgis\Eloquent\PostgisTrait;
|
||||||
|
|
||||||
class Place extends Model
|
class Place extends Model
|
||||||
{
|
{
|
||||||
use PostgisTrait;
|
|
||||||
/*
|
|
||||||
* We want to turn the names into slugs.
|
|
||||||
*/
|
|
||||||
use Sluggable;
|
use Sluggable;
|
||||||
const DISPLAY_NAME = 'name';
|
use PostgisTrait;
|
||||||
const SLUG = 'slug';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The attributes that are mass assignable.
|
* The attributes that are mass assignable.
|
||||||
|
|
@ -36,6 +31,20 @@ class Place extends Model
|
||||||
'polygon',
|
'polygon',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the sluggable configuration array for this model.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function sluggable()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'slug' => [
|
||||||
|
'source' => 'name',
|
||||||
|
],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Define the relationship with Notes.
|
* Define the relationship with Notes.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -46,8 +46,7 @@ class NoteService
|
||||||
//uri of form http://host/places/slug, we want slug
|
//uri of form http://host/places/slug, we want slug
|
||||||
//get the URL path, then take last part, we can hack with basename
|
//get the URL path, then take last part, we can hack with basename
|
||||||
//as path looks like file path.
|
//as path looks like file path.
|
||||||
$slug = basename(parse_url($data['location'], PHP_URL_PATH));
|
$place = Place::where('slug', basename(parse_url($data['location'], PHP_URL_PATH)))->first();
|
||||||
$place = Place::where('slug', $slug)->first();
|
|
||||||
$note->place()->associate($place);
|
$note->place()->associate($place);
|
||||||
}
|
}
|
||||||
if (substr($data['location'], 0, 4) == 'geo:') {
|
if (substr($data['location'], 0, 4) == 'geo:') {
|
||||||
|
|
@ -61,7 +60,7 @@ class NoteService
|
||||||
}
|
}
|
||||||
|
|
||||||
if (array_key_exists('checkin', $data) && $data['checkin'] !== null) {
|
if (array_key_exists('checkin', $data) && $data['checkin'] !== null) {
|
||||||
$place = Place::where('foursquare', $data['checkin'])->first();
|
$place = Place::where('slug', basename(parse_url($data['checkin'], PHP_URL_PATH)))->first();
|
||||||
if ($place !== null) {
|
if ($place !== null) {
|
||||||
$note->place()->associate($place);
|
$note->place()->associate($place);
|
||||||
$note->swarm_url = $data['swarm-url'];
|
$note->swarm_url = $data['swarm-url'];
|
||||||
|
|
|
||||||
|
|
@ -41,15 +41,15 @@ class PlaceService
|
||||||
* Create a place from a h-card checkin, for exameple from OwnYourSwarm.
|
* Create a place from a h-card checkin, for exameple from OwnYourSwarm.
|
||||||
*
|
*
|
||||||
* @param array
|
* @param array
|
||||||
* @return bool
|
* @return Place
|
||||||
*/
|
*/
|
||||||
public function createPlaceFromCheckin(array $checkin): bool
|
public function createPlaceFromCheckin(array $checkin): Place
|
||||||
{
|
{
|
||||||
//check if the place exists if from swarm
|
//check if the place exists if from swarm
|
||||||
if (array_key_exists('url', $checkin['properties'])) {
|
if (array_key_exists('url', $checkin['properties']) && ends_with(parse_url($checkin['properties']['url'][0], PHP_URL_HOST), 'foursquare.com')) {
|
||||||
$search = Place::where('foursquare', $checkin['properties']['url'][0])->count();
|
$place = Place::where('foursquare', $checkin['properties']['url'][0])->get();
|
||||||
if ($search === 1) {
|
if (count($place) === 1) {
|
||||||
return true;
|
return $place;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (array_key_exists('name', $checkin['properties']) === false) {
|
if (array_key_exists('name', $checkin['properties']) === false) {
|
||||||
|
|
@ -60,7 +60,7 @@ class PlaceService
|
||||||
}
|
}
|
||||||
$place = new Place();
|
$place = new Place();
|
||||||
$place->name = $checkin['properties']['name'][0];
|
$place->name = $checkin['properties']['name'][0];
|
||||||
if (starts_with($checkin['properties']['url'][0], 'https://foursquare.com')) {
|
if (ends_with(parse_url($checkin['properties']['url'][0], PHP_URL_HOST), 'foursquare.com')) {
|
||||||
$place->foursquare = $checkin['properties']['url'][0];
|
$place->foursquare = $checkin['properties']['url'][0];
|
||||||
}
|
}
|
||||||
$place->location = new Point(
|
$place->location = new Point(
|
||||||
|
|
@ -69,6 +69,6 @@ class PlaceService
|
||||||
);
|
);
|
||||||
$place->save();
|
$place->save();
|
||||||
|
|
||||||
return true;
|
return $place;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,11 @@
|
||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## Version 0.5.15 (2017-06-17)
|
||||||
|
- Add support for ownyourgram.com sending h-card locations
|
||||||
|
- change sluggable implementation
|
||||||
|
- Add tests for uploading new articles from .md files
|
||||||
|
- Fix issue with maps not loading geojson data
|
||||||
|
|
||||||
## Version 0.5.14 (2017-06-11)
|
## Version 0.5.14 (2017-06-11)
|
||||||
- Remove some Log statements in-appropriate for porduction
|
- Remove some Log statements in-appropriate for porduction
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@
|
||||||
"type": "project",
|
"type": "project",
|
||||||
"require": {
|
"require": {
|
||||||
"php": ">=7.1.0",
|
"php": ">=7.1.0",
|
||||||
|
"cviebrock/eloquent-sluggable": "^4.2",
|
||||||
"ezyang/htmlpurifier": "~4.6",
|
"ezyang/htmlpurifier": "~4.6",
|
||||||
"guzzlehttp/guzzle": "~6.0",
|
"guzzlehttp/guzzle": "~6.0",
|
||||||
"indieauth/client": "~0.1",
|
"indieauth/client": "~0.1",
|
||||||
|
|
@ -18,7 +19,6 @@
|
||||||
"lcobucci/jwt": "^3.1",
|
"lcobucci/jwt": "^3.1",
|
||||||
"league/commonmark": "^0.15.0",
|
"league/commonmark": "^0.15.0",
|
||||||
"league/flysystem-aws-s3-v3": "^1.0",
|
"league/flysystem-aws-s3-v3": "^1.0",
|
||||||
"martinbean/laravel-sluggable-trait": "0.2.*",
|
|
||||||
"mf2/mf2": "~0.3",
|
"mf2/mf2": "~0.3",
|
||||||
"phaza/laravel-postgis": "~3.1",
|
"phaza/laravel-postgis": "~3.1",
|
||||||
"pmatseykanets/laravel-scout-postgres": "^0.5.0",
|
"pmatseykanets/laravel-scout-postgres": "^0.5.0",
|
||||||
|
|
|
||||||
160
composer.lock
generated
160
composer.lock
generated
|
|
@ -4,7 +4,7 @@
|
||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "7cfa8f05a76283f45a0f1a30d00ecbad",
|
"content-hash": "af5dc6e36b50396acecb6c17d3392645",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "aws/aws-sdk-php",
|
"name": "aws/aws-sdk-php",
|
||||||
|
|
@ -180,6 +180,70 @@
|
||||||
],
|
],
|
||||||
"time": "2016-08-19T16:43:44+00:00"
|
"time": "2016-08-19T16:43:44+00:00"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "cocur/slugify",
|
||||||
|
"version": "v2.5",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/cocur/slugify.git",
|
||||||
|
"reference": "e8167e9a3236044afebd6e8ab13ebeb3ec9ca145"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/cocur/slugify/zipball/e8167e9a3236044afebd6e8ab13ebeb3ec9ca145",
|
||||||
|
"reference": "e8167e9a3236044afebd6e8ab13ebeb3ec9ca145",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=5.5.9"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"laravel/framework": "~5.1",
|
||||||
|
"latte/latte": "~2.2",
|
||||||
|
"league/container": "^2.2.0",
|
||||||
|
"mikey179/vfsstream": "~1.6",
|
||||||
|
"mockery/mockery": "~0.9",
|
||||||
|
"nette/di": "~2.2",
|
||||||
|
"phpunit/phpunit": "~4.8|~5.2",
|
||||||
|
"pimple/pimple": "~1.1",
|
||||||
|
"plumphp/plum": "~0.1",
|
||||||
|
"silex/silex": "~1.3",
|
||||||
|
"symfony/config": "~2.4|~3.0",
|
||||||
|
"symfony/dependency-injection": "~2.4|~3.0",
|
||||||
|
"symfony/http-kernel": "~2.4|~3.0",
|
||||||
|
"twig/twig": "~1.26|~2.0",
|
||||||
|
"zendframework/zend-modulemanager": "~2.2",
|
||||||
|
"zendframework/zend-servicemanager": "~2.2",
|
||||||
|
"zendframework/zend-view": "~2.2"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Cocur\\Slugify\\": "src"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Ivo Bathke",
|
||||||
|
"email": "ivo.bathke@gmail.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Florian Eckerstorfer",
|
||||||
|
"email": "florian@eckerstorfer.co",
|
||||||
|
"homepage": "https://florian.ec"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Converts a string into a slug.",
|
||||||
|
"keywords": [
|
||||||
|
"slug",
|
||||||
|
"slugify"
|
||||||
|
],
|
||||||
|
"time": "2017-03-23T21:52:55+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "composer/ca-bundle",
|
"name": "composer/ca-bundle",
|
||||||
"version": "1.0.7",
|
"version": "1.0.7",
|
||||||
|
|
@ -239,6 +303,58 @@
|
||||||
],
|
],
|
||||||
"time": "2017-03-06T11:59:08+00:00"
|
"time": "2017-03-06T11:59:08+00:00"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "cviebrock/eloquent-sluggable",
|
||||||
|
"version": "4.2.3",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/cviebrock/eloquent-sluggable.git",
|
||||||
|
"reference": "cbeb6e16b783173dbb95e00f78237d349e73c07d"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/cviebrock/eloquent-sluggable/zipball/cbeb6e16b783173dbb95e00f78237d349e73c07d",
|
||||||
|
"reference": "cbeb6e16b783173dbb95e00f78237d349e73c07d",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"cocur/slugify": "^2.3",
|
||||||
|
"illuminate/config": "^5.4",
|
||||||
|
"illuminate/database": "^5.4",
|
||||||
|
"illuminate/support": "^5.4",
|
||||||
|
"php": ">=5.6.4 || ^7.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"mockery/mockery": "^0.9.4",
|
||||||
|
"orchestra/database": "~3.4",
|
||||||
|
"orchestra/testbench": "^3.4",
|
||||||
|
"phpunit/phpunit": "~5.7"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Cviebrock\\EloquentSluggable\\": "src"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Colin Viebrock",
|
||||||
|
"email": "colin@viebrock.ca"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Easy creation of slugs for your Eloquent models in Laravel 5.",
|
||||||
|
"homepage": "https://github.com/cviebrock/eloquent-sluggable",
|
||||||
|
"keywords": [
|
||||||
|
"eloquent",
|
||||||
|
"laravel",
|
||||||
|
"slug"
|
||||||
|
],
|
||||||
|
"time": "2017-04-18T15:03:20+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "dnoegel/php-xdg-base-dir",
|
"name": "dnoegel/php-xdg-base-dir",
|
||||||
"version": "0.1",
|
"version": "0.1",
|
||||||
|
|
@ -1971,48 +2087,6 @@
|
||||||
"description": "Flysystem adapter for the AWS S3 SDK v3.x",
|
"description": "Flysystem adapter for the AWS S3 SDK v3.x",
|
||||||
"time": "2017-06-08T13:37:03+00:00"
|
"time": "2017-06-08T13:37:03+00:00"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "martinbean/laravel-sluggable-trait",
|
|
||||||
"version": "0.2.0",
|
|
||||||
"source": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://github.com/martinbean/laravel-sluggable-trait.git",
|
|
||||||
"reference": "8984dc9bc2596814f79baf44aeb9a39c9c07b149"
|
|
||||||
},
|
|
||||||
"dist": {
|
|
||||||
"type": "zip",
|
|
||||||
"url": "https://api.github.com/repos/martinbean/laravel-sluggable-trait/zipball/8984dc9bc2596814f79baf44aeb9a39c9c07b149",
|
|
||||||
"reference": "8984dc9bc2596814f79baf44aeb9a39c9c07b149",
|
|
||||||
"shasum": ""
|
|
||||||
},
|
|
||||||
"require": {
|
|
||||||
"illuminate/database": ">=4.0",
|
|
||||||
"illuminate/support": ">=4.0",
|
|
||||||
"php": ">=5.4.0"
|
|
||||||
},
|
|
||||||
"type": "library",
|
|
||||||
"autoload": {
|
|
||||||
"psr-4": {
|
|
||||||
"MartinBean\\Database\\Eloquent\\": "src/"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"notification-url": "https://packagist.org/downloads/",
|
|
||||||
"license": [
|
|
||||||
"MIT"
|
|
||||||
],
|
|
||||||
"authors": [
|
|
||||||
{
|
|
||||||
"name": "Martin Bean",
|
|
||||||
"email": "martin@martinbean.co.uk"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"description": "A trait you can apply to Eloquent models to have slugs automatically generated on save.",
|
|
||||||
"keywords": [
|
|
||||||
"eloquent",
|
|
||||||
"laravel"
|
|
||||||
],
|
|
||||||
"time": "2015-02-17T22:47:44+00:00"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "mf2/mf2",
|
"name": "mf2/mf2",
|
||||||
"version": "v0.3.2",
|
"version": "v0.3.2",
|
||||||
|
|
|
||||||
|
|
@ -235,6 +235,11 @@ return [
|
||||||
*/
|
*/
|
||||||
Laravel\Tinker\TinkerServiceProvider::class,
|
Laravel\Tinker\TinkerServiceProvider::class,
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Eolquent Sluggable
|
||||||
|
*/
|
||||||
|
Cviebrock\EloquentSluggable\ServiceProvider::class,
|
||||||
|
|
||||||
],
|
],
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
126
config/sluggable.php
Normal file
126
config/sluggable.php
Normal file
|
|
@ -0,0 +1,126 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/**
|
||||||
|
* What attributes do we use to build the slug?
|
||||||
|
* This can be a single field, like "name" which will build a slug from:
|
||||||
|
*
|
||||||
|
* $model->name;
|
||||||
|
*
|
||||||
|
* Or it can be an array of fields, like ("name", "company"), which builds a slug from:
|
||||||
|
*
|
||||||
|
* $model->name . ' ' . $model->company;
|
||||||
|
*
|
||||||
|
* If you've defined custom getters in your model, you can use those too,
|
||||||
|
* since Eloquent will call them when you request a custom attribute.
|
||||||
|
*
|
||||||
|
* Defaults to null, which uses the toString() method on your model.
|
||||||
|
*/
|
||||||
|
|
||||||
|
'source' => null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The maximum length of a generated slug. Defaults to "null", which means
|
||||||
|
* no length restrictions are enforced. Set it to a positive integer if you
|
||||||
|
* want to make sure your slugs aren't too long.
|
||||||
|
*/
|
||||||
|
|
||||||
|
'maxLength' => null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If left to "null", then use the cocur/slugify package to generate the slug
|
||||||
|
* (with the separator defined below).
|
||||||
|
*
|
||||||
|
* Set this to a closure that accepts two parameters (string and separator)
|
||||||
|
* to define a custom slugger. e.g.:
|
||||||
|
*
|
||||||
|
* 'method' => function( $string, $sep ) {
|
||||||
|
* return preg_replace('/[^a-z]+/i', $sep, $string);
|
||||||
|
* },
|
||||||
|
*
|
||||||
|
* Otherwise, this will be treated as a callable to be used. e.g.:
|
||||||
|
*
|
||||||
|
* 'method' => array('Str','slug'),
|
||||||
|
*/
|
||||||
|
|
||||||
|
'method' => null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Separator to use when generating slugs. Defaults to a hyphen.
|
||||||
|
*/
|
||||||
|
|
||||||
|
'separator' => '-',
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enforce uniqueness of slugs? Defaults to true.
|
||||||
|
* If a generated slug already exists, an incremental numeric
|
||||||
|
* value will be appended to the end until a unique slug is found. e.g.:
|
||||||
|
*
|
||||||
|
* my-slug
|
||||||
|
* my-slug-1
|
||||||
|
* my-slug-2
|
||||||
|
*/
|
||||||
|
|
||||||
|
'unique' => true,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If you are enforcing unique slugs, the default is to add an
|
||||||
|
* incremental value to the end of the base slug. Alternatively, you
|
||||||
|
* can change this value to a closure that accepts three parameters:
|
||||||
|
* the base slug, the separator, and a Collection of the other
|
||||||
|
* "similar" slugs. The closure should return the new unique
|
||||||
|
* suffix to append to the slug.
|
||||||
|
*/
|
||||||
|
|
||||||
|
'uniqueSuffix' => null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Should we include the trashed items when generating a unique slug?
|
||||||
|
* This only applies if the softDelete property is set for the Eloquent model.
|
||||||
|
* If set to "false", then a new slug could duplicate one that exists on a trashed model.
|
||||||
|
* If set to "true", then uniqueness is enforced across trashed and existing models.
|
||||||
|
*/
|
||||||
|
|
||||||
|
'includeTrashed' => false,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An array of slug names that can never be used for this model,
|
||||||
|
* e.g. to prevent collisions with existing routes or controller methods, etc..
|
||||||
|
* Defaults to null (i.e. no reserved names).
|
||||||
|
* Can be a static array, e.g.:
|
||||||
|
*
|
||||||
|
* 'reserved' => array('add', 'delete'),
|
||||||
|
*
|
||||||
|
* or a closure that returns an array of reserved names.
|
||||||
|
* If using a closure, it will accept one parameter: the model itself, and should
|
||||||
|
* return an array of reserved names, or null. e.g.
|
||||||
|
*
|
||||||
|
* 'reserved' => function( Model $model) {
|
||||||
|
* return $model->some_method_that_returns_an_array();
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* In the case of a slug that gets generated with one of these reserved names,
|
||||||
|
* we will do:
|
||||||
|
*
|
||||||
|
* $slug .= $separator + "1"
|
||||||
|
*
|
||||||
|
* and continue from there.
|
||||||
|
*/
|
||||||
|
|
||||||
|
'reserved' => null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether to update the slug value when a model is being
|
||||||
|
* re-saved (i.e. already exists). Defaults to false, which
|
||||||
|
* means slugs are not updated.
|
||||||
|
*
|
||||||
|
* Be careful! If you are using slugs to generate URLs, then
|
||||||
|
* updating your slug automatically might change your URLs which
|
||||||
|
* is probably not a good idea from an SEO point of view.
|
||||||
|
* Only set this to true if you understand the possible consequences.
|
||||||
|
*/
|
||||||
|
|
||||||
|
'onUpdate' => false,
|
||||||
|
|
||||||
|
];
|
||||||
File diff suppressed because one or more lines are too long
2
public/assets/js/maps.js
vendored
2
public/assets/js/maps.js
vendored
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
2
public/assets/js/newnote.js
vendored
2
public/assets/js/newnote.js
vendored
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue