required Add Block Extension

This commit is contained in:
vedatakd 2019-11-27 20:12:23 +03:00
parent e8b6cefc3a
commit f492ec9f3b
13 changed files with 2 additions and 320 deletions

View File

@ -1,22 +0,0 @@
{
"name": "visiosoft/addblock-extension",
"type": "streams-addon",
"authors": [
{
"name": "Visiosoft, LTD.",
"email": "support@visiosoft.com.tr",
"homepage": "https://visiosoft.com.tr/",
"role": "Owner"
},
{
"name": "Vedat Akdoğan",
"email": "vedat@visiosoft.com.tr",
"role": "Developer"
}
],
"autoload": {
"psr-4": {
"Visiosoft\\AddblockExtension\\": "src/"
}
}
}

View File

@ -1,24 +0,0 @@
<?php
use Anomaly\Streams\Platform\Database\Migration\Migration;
class VisiosoftExtensionAddblockCreateAddblockFields extends Migration
{
/**
* The addon fields.
*
* @var array
*/
protected $fields = [
'name' => 'anomaly.field_type.text',
'slug' => [
'type' => 'anomaly.field_type.slug',
'config' => [
'slugify' => 'name',
'type' => '_'
],
],
];
}

View File

@ -1,7 +0,0 @@
<?php
return [
'title' => 'Addblock',
'name' => 'Addblock Extension',
'description' => ''
];

View File

@ -1,21 +0,0 @@
<?php namespace Visiosoft\AddblockExtension;
use Anomaly\Streams\Platform\Addon\Extension\Extension;
class AddblockExtension extends Extension
{
/**
* This extension provides...
*
* This should contain the dot namespace
* of the addon this extension is for followed
* by the purpose.variation of the extension.
*
* For example anomaly.module.store::gateway.stripe
*
* @var null|string
*/
protected $provides = null;
}

View File

@ -1,28 +0,0 @@
<?php namespace Visiosoft\AddblockExtension;
use Anomaly\Streams\Platform\Addon\Plugin\Plugin;
use Visiosoft\AddblockExtension\Command\addBlock;
class AddblockExtensionPlugin extends Plugin
{
/**
* @return array
*/
public function getFunctions()
{
return [
new \Twig_SimpleFunction(
'addBlock',
function ($location, $params = []) {
if (!$addBlock = $this->dispatch(new addBlock($location, $params))) {
return null;
}
return $addBlock;
}
)
];
}
}

View File

@ -1,165 +0,0 @@
<?php namespace Visiosoft\AddblockExtension;
use Anomaly\Streams\Platform\Addon\AddonServiceProvider;
use Illuminate\Routing\Router;
class AddblockExtensionServiceProvider extends AddonServiceProvider
{
/**
* Additional addon plugins.
*
* @type array|null
*/
protected $plugins = [
AddblockExtensionPlugin::class
];
/**
* The addon Artisan commands.
*
* @type array|null
*/
protected $commands = [];
/**
* The addon's scheduled commands.
*
* @type array|null
*/
protected $schedules = [];
/**
* The addon API routes.
*
* @type array|null
*/
protected $api = [];
/**
* The addon routes.
*
* @type array|null
*/
protected $routes = [];
/**
* The addon middleware.
*
* @type array|null
*/
protected $middleware = [
//Visiosoft\AddblockExtension\Http\Middleware\ExampleMiddleware::class
];
/**
* Addon group middleware.
*
* @var array
*/
protected $groupMiddleware = [
//'web' => [
// Visiosoft\AddblockExtension\Http\Middleware\ExampleMiddleware::class,
//],
];
/**
* Addon route middleware.
*
* @type array|null
*/
protected $routeMiddleware = [];
/**
* The addon event listeners.
*
* @type array|null
*/
protected $listeners = [
//Visiosoft\AddblockExtension\Event\ExampleEvent::class => [
// Visiosoft\AddblockExtension\Listener\ExampleListener::class,
//],
];
/**
* The addon alias bindings.
*
* @type array|null
*/
protected $aliases = [
//'Example' => Visiosoft\AddblockExtension\Example::class
];
/**
* The addon class bindings.
*
* @type array|null
*/
protected $bindings = [];
/**
* The addon singleton bindings.
*
* @type array|null
*/
protected $singletons = [];
/**
* Additional service providers.
*
* @type array|null
*/
protected $providers = [
//\ExamplePackage\Provider\ExampleProvider::class
];
/**
* The addon view overrides.
*
* @type array|null
*/
protected $overrides = [
//'streams::errors/404' => 'module::errors/404',
//'streams::errors/500' => 'module::errors/500',
];
/**
* The addon mobile-only view overrides.
*
* @type array|null
*/
protected $mobile = [
//'streams::errors/404' => 'module::mobile/errors/404',
//'streams::errors/500' => 'module::mobile/errors/500',
];
/**
* Register the addon.
*/
public function register()
{
// Run extra pre-boot registration logic here.
// Use method injection or commands to bring in services.
}
/**
* Boot the addon.
*/
public function boot()
{
// Run extra post-boot registration logic here.
// Use method injection or commands to bring in services.
}
/**
* Map additional addon routes.
*
* @param Router $router
*/
public function map(Router $router)
{
// Register dynamic routes here for example.
// Use method injection or commands to bring in services.
}
}

View File

@ -1,41 +0,0 @@
<?php namespace Visiosoft\AddblockExtension\Command;
class addBlock
{
/**
* @var $location
*/
protected $location;
/**
* @var $params
*/
protected $params;
/**
* @param $location
* @param $params
*/
public function __construct($location, $params)
{
$this->location = $location;
$this->params = $params;
}
public function handle()
{
$installed_modules = app('module.collection')->installed();
$views = "";
$params = $this->params;
foreach ($installed_modules as $item) {
$namespace = explode('.', $item->namespace);
if (file_exists("../addons/default/" . $namespace[0] . "/" . end($namespace) . "-module/resources/views/" . $this->location . ".twig")) {
$views .= view($item->namespace . '::' . $this->location, compact('params'));
}
}
return $views;
}
}

View File

@ -8,6 +8,7 @@
},
"require": {
"wirelab/language_switcher-plugin": "^1.3",
"visiosoft/addblock-extension": "^1.1",
"ext-zip": "*",
"chumper/zipper": "^1.0"
}

View File

@ -765,6 +765,7 @@ class AdvsController extends PublicController
$this->adv_model->statusAds($id, $type);
$events->dispatch(new ChangeStatusAd($id, $settings));//Create Notify
$this->messages->success(trans('streams::message.edit_success', ['name' => 'Status']));
return back();
}