PHP code example of mixdinternet / categories

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

    

mixdinternet / categories example snippets


  php artisan vendor:publish --provider="Mixdinternet\Categories\Providers\CategoriesServiceProvider" --tag="migrations"`
  php artisan migrate


 
 namespace Mixdinternet\Flavors;
 
 use Mixdinternet\Categories\Category as BaseCategory;
 use Mixdinternet\Flavors\Scopes\FlavorsCategory;
 
 class Category extends BaseCategory
 {
     public static function boot()
     {
         static::addGlobalScope(new FlavorsCategory());
     }
 
     public function flavors()
     {
         return $this->hasMany(Flavor::class);
     }
 }
 

public function flavors()
{
  return $this->hasMany(Flavor::class);
}
 
 

Route::group(['middleware' => ['web'], 'prefix' => config('admin.url'), 'as' => 'admin.flavors'], function () {
    Route::group(['middleware' => ['auth.admin', 'auth.rules']], function () {

        Route::get('{categoryType}/categories/trash', ['uses' => '\Mixdinternet\Categories\Http\Controllers\CategoriesAdminController@index', 'as' => '.categories.trash']);
        Route::post('{categoryType}/categories/restore/{id}', ['uses' => '\Mixdinternet\Categories\Http\Controllers\CategoriesAdminController@restore', 'as' => '.categories.restore']);
        Route::resource('{categoryType}/categories', '\Mixdinternet\Categories\Http\Controllers\CategoriesAdminController', [
            'names' => [
                'index' => '.categories.index',
                'create' => '.categories.create',
                'store' => '.categories.store',
                'edit' => '.categories.edit',
                'update' => '.categories.update',
                'show' => '.categories.show',
            ], 'except' => ['destroy']]);
        Route::delete('{categoryType}/categories/destroy', ['uses' => '\Mixdinternet\Categories\Http\Controllers\CategoriesAdminController@destroy', 'as' => '.categories.destroy']);
       
    });
});