PHP code example of larapost / categories

1. Go to this page and download the library: Download larapost/categories 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/ */

    

larapost / categories example snippets


'providers' => [
    ...
    Larapost\Categorie\Support\ServiceProvider::class,
],

use Larapost\Categories;

function(Categories $categories)
{
    return $categories->add('<name>', '<slug>' = false);
}

function(Categories $categories)
{
    return $categories->update('<id>', '<name>', '<slug>' = false);
}

function(Categories $categories)
{
    return $categories->get('<column>', '<value>', <subs> = true | false);
}

function(Categories $categories)
{
    return $categories->remove('<id>');
}

function(Categories $categories)
{
    return $categories->all();
}

function(Categories $categories)
{
    return $categories->subAdd('<categorie_id>', '<name>', '<slug>' = false);
}

function(Categories $categories)
{
    return $categories->subUpdate('<id>', '<name>', '<slug>' = false);
}

function(Categories $categories)
{
    return $categories->subGet('<categorie_id>', '<column>', '<value>');
}

function(Categories $categories)
{
    return $categories->subRemove('<id>');
}

function(Categories $categories)
{
    return $categories->subAll();
}

$ php artisan migrate
OR
$ php artisan migrate:fresh