mirror of
https://github.com/openclassify/openclassify.git
synced 2026-02-27 16:14:39 -06:00
Merge branch 'master' of https://github.com/openclassify/openclassify into muammertop
This commit is contained in:
commit
b55a682403
@ -1,4 +1,4 @@
|
||||
# OpenClassify - Laravel 8 Classified Script Platform
|
||||
# OpenClassify - Laravel 8 Classified Script Platform - Weekly Updates
|
||||
|
||||
OpenClassify is modular and most advanced open source classified platform build with Laravel 8 & PHP 7.3+ Supported. Included Pyrocms 3.9
|
||||
|
||||
|
||||
@ -16,8 +16,4 @@
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<span class="font-weight-light small text-black-50 {{ not setting_value('visiosoft.module.advs::show_input_flag') ? 'd-none' }}">
|
||||
***{{ trans('visiosoft.module.advs::field.select_lang_ads') }}
|
||||
</span>
|
||||
{% endif %}
|
||||
|
||||
@ -555,4 +555,11 @@ class AdvRepository extends EntryRepository implements AdvRepositoryInterface
|
||||
->where('slug', '!=', '')
|
||||
->orderBy('publish_at', 'desc');
|
||||
}
|
||||
|
||||
public function findByCFJSON($key, $value)
|
||||
{
|
||||
return $this->currentAds()
|
||||
->whereJsonContains('cf_json', [$key => $value])
|
||||
->first();
|
||||
}
|
||||
}
|
||||
|
||||
@ -56,4 +56,6 @@ interface AdvRepositoryInterface extends EntryRepositoryInterface
|
||||
public function getUserAds($userID = null, $status = "approved");
|
||||
|
||||
public function currentAds();
|
||||
|
||||
public function findByCFJSON($key, $value);
|
||||
}
|
||||
|
||||
@ -10,51 +10,17 @@ use Visiosoft\CatsModule\Category\Contract\CategoryRepositoryInterface;
|
||||
use Visiosoft\CatsModule\Category\CategoryRepository;
|
||||
use Anomaly\Streams\Platform\Model\Cats\CatsCategoryEntryModel;
|
||||
use Visiosoft\CatsModule\Category\CategoryModel;
|
||||
use Illuminate\Routing\Router;
|
||||
use Visiosoft\CatsModule\Category\Listener\CalculatedTotalForChangedAdStatus;
|
||||
use Visiosoft\CatsModule\Category\Listener\CalculatedTotalForDeletedAd;
|
||||
use Visiosoft\CatsModule\Category\Listener\CalculatedTotalForEditedAdCategory;
|
||||
use Visiosoft\CatsModule\Category\Listener\CalculatedTotalForNewAd;
|
||||
use Visiosoft\CatsModule\Category\Table\Handler\Delete;
|
||||
|
||||
class CatsModuleServiceProvider extends AddonServiceProvider
|
||||
{
|
||||
|
||||
/**
|
||||
* Additional addon plugins.
|
||||
*
|
||||
* @type array|null
|
||||
*/
|
||||
protected $plugins = [
|
||||
CatsModulePlugin::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 = [
|
||||
'admin/cats/clean_subcats' => 'Visiosoft\CatsModule\Http\Controller\Admin\CategoryController@cleanSubCategories',
|
||||
'admin/cats/adcountcalc' => 'Visiosoft\CatsModule\Http\Controller\Admin\CategoryController@adCountCalc',
|
||||
@ -78,44 +44,16 @@ class CatsModuleServiceProvider extends AddonServiceProvider
|
||||
'as' => 'visiosoft.module.cats::export',
|
||||
'uses' => 'Visiosoft\CatsModule\Http\Controller\Admin\CategoryController@export',
|
||||
],
|
||||
'admin/api/cats/all' => [
|
||||
'as' => 'visiosoft.module.cats::admin.api.cats.all',
|
||||
'uses' => 'Visiosoft\CatsModule\Http\Controller\Admin\CategoryController@all',
|
||||
],
|
||||
|
||||
// Sitemap
|
||||
'sitemap.xml' => 'Visiosoft\CatsModule\Http\Controller\SitemapController@index',
|
||||
'sitemap.xml/categories' => 'Visiosoft\CatsModule\Http\Controller\SitemapController@categories',
|
||||
];
|
||||
|
||||
/**
|
||||
* The addon middleware.
|
||||
*
|
||||
* @type array|null
|
||||
*/
|
||||
protected $middleware = [
|
||||
//Visiosoft\CatsModule\Http\Middleware\ExampleMiddleware::class
|
||||
];
|
||||
|
||||
/**
|
||||
* Addon group middleware.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $groupMiddleware = [
|
||||
//'web' => [
|
||||
// Visiosoft\CatsModule\Http\Middleware\ExampleMiddleware::class,
|
||||
//],
|
||||
];
|
||||
|
||||
/**
|
||||
* Addon route middleware.
|
||||
*
|
||||
* @type array|null
|
||||
*/
|
||||
protected $routeMiddleware = [];
|
||||
|
||||
/**
|
||||
* The addon event listeners.
|
||||
*
|
||||
* @type array|null
|
||||
*/
|
||||
protected $listeners = [
|
||||
CreatedAd::class => [
|
||||
CalculatedTotalForNewAd::class,
|
||||
@ -131,74 +69,14 @@ class CatsModuleServiceProvider extends AddonServiceProvider
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* The addon alias bindings.
|
||||
*
|
||||
* @type array|null
|
||||
*/
|
||||
protected $aliases = [
|
||||
//'Example' => Visiosoft\CatsModule\Example::class
|
||||
];
|
||||
|
||||
/**
|
||||
* The addon class bindings.
|
||||
*
|
||||
* @type array|null
|
||||
*/
|
||||
protected $bindings = [
|
||||
CatsCategoryEntryModel::class => CategoryModel::class,
|
||||
];
|
||||
|
||||
/**
|
||||
* The addon singleton bindings.
|
||||
*
|
||||
* @type array|null
|
||||
*/
|
||||
protected $singletons = [
|
||||
CategoryRepositoryInterface::class => CategoryRepository::class,
|
||||
];
|
||||
|
||||
/**
|
||||
* 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(AddonCollection $addonCollection)
|
||||
{
|
||||
$settings_url = [
|
||||
@ -219,17 +97,6 @@ class CatsModuleServiceProvider extends AddonServiceProvider
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
}
|
||||
|
||||
public function getOverrides()
|
||||
{
|
||||
$request = app('Illuminate\Http\Request');
|
||||
|
||||
@ -1,13 +1,12 @@
|
||||
<?php namespace Visiosoft\CatsModule\Http\Controller\Admin;
|
||||
|
||||
use Anomaly\FilesModule\File\Contract\FileRepositoryInterface;
|
||||
use Anomaly\FilesModule\File\FileSanitizer;
|
||||
use Anomaly\FilesModule\File\FileUploader;
|
||||
use Anomaly\FilesModule\Folder\Contract\FolderRepositoryInterface;
|
||||
use Anomaly\Streams\Platform\Model\Cats\CatsCategoryEntryTranslationsModel;
|
||||
use Anomaly\Streams\Platform\Ui\Form\FormBuilder;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Http\UploadedFile;
|
||||
use Illuminate\Support\Str;
|
||||
use League\Flysystem\MountManager;
|
||||
use Visiosoft\CatsModule\Category\CategoryExport;
|
||||
@ -19,7 +18,6 @@ use Visiosoft\CatsModule\Category\Contract\CategoryRepositoryInterface;
|
||||
use Visiosoft\CatsModule\Category\Form\CategoryFormBuilder;
|
||||
use Visiosoft\CatsModule\Category\Table\CategoryTableBuilder;
|
||||
use Anomaly\Streams\Platform\Http\Controller\AdminController;
|
||||
use Visiosoft\AdvsModule\Adv\Contract\AdvRepositoryInterface;
|
||||
use Visiosoft\CatsModule\Category\Traits\DeleteCategory;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
|
||||
@ -250,35 +248,39 @@ class CategoryController extends AdminController
|
||||
|
||||
public function createIconFile($category_id)
|
||||
{
|
||||
$fileRepository = app(FileRepositoryInterface::class);
|
||||
$folderRepository = app(FolderRepositoryInterface::class);
|
||||
$manager = app(MountManager::class);
|
||||
$uploader = app(FileUploader::class);
|
||||
|
||||
if ($file = $this->request->file('icon') and $folder = $folderRepository->findBySlug('category_icon') and $category = $this->categoryRepository->find($category_id)) {
|
||||
|
||||
$type = explode('.', $file->getClientOriginalName());
|
||||
if ($request_file = $this->request->file('icon') and $folder = $folderRepository->findBySlug('category_icon') and $category = $this->categoryRepository->find($category_id)) {
|
||||
$type = explode('.', $request_file->getClientOriginalName());
|
||||
$type = end($type);
|
||||
|
||||
$file_location = $folder->getDisk()->getSlug() . '://' . $folder->getSlug() . '/' . FileSanitizer::clean($category_id . "." . $type);
|
||||
$filename = $category_id . "." . $type;
|
||||
|
||||
$file_url = '/files/' . $folder->getSlug() . '/' . FileSanitizer::clean($category_id . "." . $type);
|
||||
|
||||
if (Storage::exists($file_location)) {
|
||||
Storage::delete($file_location);
|
||||
if ($file = $fileRepository->findByNameAndFolder($filename, $folder)) {
|
||||
$file->forceDelete();
|
||||
}
|
||||
|
||||
try {
|
||||
$manager->put($file_location, file_get_contents($file->getRealPath()));
|
||||
$file = new UploadedFile($request_file->getPathname(),
|
||||
$filename,
|
||||
$request_file->getClientMimeType(),
|
||||
$request_file->getError());
|
||||
|
||||
$category->setCategoryIconUrl($file_url);
|
||||
$file = $uploader->upload($file, $folder);
|
||||
|
||||
$category->setCategoryIconUrl($file->make()->url());
|
||||
} catch (\Exception $exception) {
|
||||
$this->messages->error([$exception->getMessage()]);
|
||||
$this->messages->error($exception->getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function import(FormBuilder $builder, FileRepositoryInterface $fileRepository){
|
||||
public function import(FormBuilder $builder, FileRepositoryInterface $fileRepository)
|
||||
{
|
||||
|
||||
if (request()->action == "save" and $file = $fileRepository->find(request()->file)) {
|
||||
if ($file->extension === 'xls' || $file->extension === 'xlsx') {
|
||||
@ -309,7 +311,27 @@ class CategoryController extends AdminController
|
||||
return $builder->render();
|
||||
}
|
||||
|
||||
public function export(){
|
||||
public function export()
|
||||
{
|
||||
return Excel::download(new CategoryExport(), 'cats-' . time() . '.xlsx');
|
||||
}
|
||||
|
||||
public function all()
|
||||
{
|
||||
try {
|
||||
if ($this->categoryRepository->count() > 100) {
|
||||
throw new \Exception('more_than_100');
|
||||
}
|
||||
|
||||
return [
|
||||
'success' => true,
|
||||
'data' => $this->categoryRepository->all(),
|
||||
];
|
||||
} catch (\Exception $e) {
|
||||
return [
|
||||
'success' => false,
|
||||
'msg' => $e->getMessage(),
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -17,6 +17,8 @@ return [
|
||||
|
||||
'name' => env('APP_NAME', 'My Application'),
|
||||
|
||||
'application_domain' => env('APPLICATION_DOMAIN', null),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Environment
|
||||
|
||||
@ -77,6 +77,19 @@ class DatabaseSeeder extends Seeder
|
||||
|
||||
$this->activator->force($visiosoft_administrator);
|
||||
|
||||
//Create Category Icon Folder
|
||||
if (is_null($this->folders->findBy('slug', 'category_icon'))) {
|
||||
$disk = $this->disks->findBySlug('local');
|
||||
|
||||
$this->folders->create([
|
||||
'en' => [
|
||||
'name' => 'Category Icon',
|
||||
'description' => 'A folder for Category Icon.',
|
||||
],
|
||||
'slug' => 'category_icon',
|
||||
'disk' => $disk,
|
||||
]);
|
||||
};
|
||||
|
||||
//Footer Link
|
||||
LinkModel::query()->forceDelete();
|
||||
@ -224,26 +237,11 @@ class DatabaseSeeder extends Seeder
|
||||
]);
|
||||
};
|
||||
|
||||
//Create Category Icon Folder
|
||||
if (is_null($this->folders->findBy('slug', 'category_icon'))) {
|
||||
$disk = $this->disks->findBySlug('local');
|
||||
|
||||
$this->folders->create([
|
||||
'en' => [
|
||||
'name' => 'Category Icon',
|
||||
'description' => 'A folder for Category Icon.',
|
||||
],
|
||||
'slug' => 'category_icon',
|
||||
'disk' => $disk,
|
||||
]);
|
||||
};
|
||||
|
||||
//Demodata Seeder
|
||||
if (is_module_installed('visiosoft.module.demodata')) {
|
||||
$this->call(\Visiosoft\DemodataModule\Demodata\DemodataSeeder::class);
|
||||
}
|
||||
|
||||
Artisan::call('assets:clear');
|
||||
Artisan::call('files:sync');
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user