<?php

namespace Mehrab\City\Providers;

use Database\Seeders\DatabaseSeeder;
use Illuminate\Support\Facades\Gate;
use Mehrab\City\Database\Seeds\CitySeeder;
use Mehrab\City\Models\City;
use Mehrab\City\Policies\CityPolicy;
use Mehrab\RolePermission\Database\Seeds\RolePermissionSeeder;

class CityServiceProvider extends \Illuminate\Support\ServiceProvider
{
    public function register()
    {
        $this->loadRoutesFrom(__DIR__."/../Routes/city_routes.php");
        $this->loadMigrationsFrom(__DIR__."/../Database/Migrations/");
        $this->loadViewsFrom(__DIR__.'/../Resources/Views/','City');
//        $this->loadJsonTranslationsFrom(__DIR__.'/../Resources/Lang/');
        // DatabaseSeeder::$Seeders[] = CitySeeder::class;
        Gate::policy(City::class,CityPolicy::class);

    }

    public function boot(){
        $this->app->booted(function (){
            config()->set("AdminSidebar.city",[
                "name" => "مدیریت شهرها",
                "link" => route("admin_article_list"),
                "icon" => "fa-map-marker",
                "children"=>[
                    ["name"=>"لیست استان ها","link"=>route("city.index")],
                    ["name"=>"ایجاد استان","link"=>route("city.create")],
                    ["name"=>"لیست مناطق","link"=>route('region.index')],
                    ["name"=>"ایجاد مناطق","link"=>route('region.create') ],
                ],
                "permission"=>\Mehrab\RolePermission\Models\Permission::PERMISSION_MANAGE_STATE
            ]);
        });
    }
}
