GithubHelp home page GithubHelp logo

martinbean / laravel-sluggable-trait Goto Github PK

View Code? Open in Web Editor NEW
24.0 24.0 5.0 7 KB

A trait you can apply to Eloquent models to have slugs automatically generated on save.

License: MIT License

PHP 100.00%

laravel-sluggable-trait's Introduction

Hi! 👋

I’m Martin Bean, an experienced software engineer and web developer based in the UK. I currently lead of a team of developers at a product company called OpenPlay. Prior to this, I worked at Pfizer, first as part of their DevOps team before moving into a tech lead role, where I directed two company-wide transformation and consolidation projects.

Outside of my full time role I run Your Fight Site. Under its banner I operate two services targeting professional wrestling and combat sport promoters: a website builder called Your Fight Site CMS, and a video on demand marketplace called Your Fight Site VOD.

In my spare time I dabble in reverse engineering video games, specifically PlayStation® 1. This has been a hugely interesting endeavour for me, going from knowing little about computer architecture and hardware to learning concepts like CPUs and registers, as well as assembly and the C programming language, and also just how video games were actually made in that time period.

I’m a lifelong learner with a thirst for knowledge, and enjoy sharing this knowledge. I’m active in communities such as Stack Overflow and the Laracasts forums, and I now share this knowledge in my current role as a team lead.

laravel-sluggable-trait's People

Contributors

martinbean avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

laravel-sluggable-trait's Issues

Avoid duplicates unique entry

Hello and thank you for this very cool package !!

I'm not sure what is the best way to do it, but it would be pretty cool if we can check if the generated Slug already exists in the Database.
Mainly because the Slug column is often unique.

So if I save two entries in the database with the same title, the second entry will have a different slug, like:

my-cool-article
my-cool-article-1

What do you think ?

Feature request

Hi. Thank you for the trait it works great.

I want it to work when updating a model too not just in save.

I override the bootSluggable on my model and add the code below to the method. It works fine but I have to do this manually on every model that i want to update the slug.

static::updating(function (Model $model)
{
$model->setSlug(Str::slug($model->getSluggableString()));
});

Thank you.

Sorry for my bad english

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.