PHP code example of alzpk / laraslug

1. Go to this page and download the library: Download alzpk/laraslug library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

alzpk / laraslug example snippets


namespace App\Models;

use Alzpk\Laraslug\Laraslug;
use Illuminate\Database\Eloquent\Model;

class Post extends Model
{
    use Laraslug;
}

public function up()
    {
        Schema::create('posts', function (Blueprint $table) {
            $table->id();
            $table->string('subject');
            $table->string('uri');
            $table->timestamps();
        });
    }

namespace App\Models;

use Alzpk\Laraslug\Laraslug;
use Illuminate\Database\Eloquent\Model;

class Post extends Model
{
    use Laraslug;
    
    private string $slugColumn = 'uri';
    private string $slugValueColumn = 'subject';
}

namespace App\Models;

use Alzpk\Laraslug\Laraslug;
use Illuminate\Database\Eloquent\Model;

class Post extends Model
{
    use Laraslug;
    
    private string $slugPrefix = 'prefix';
}