mirror of
https://github.com/openclassify/openclassify.git
synced 2026-01-11 18:01:10 -06:00
Merge pull request #1281 from openclassify/metehancelik
cover image field added to seeder
This commit is contained in:
commit
b346014b53
@ -64,6 +64,9 @@ return [
|
|||||||
'instruction_description' => 'Instruction Description',
|
'instruction_description' => 'Instruction Description',
|
||||||
'instruction_list' => 'Instruction List',
|
'instruction_list' => 'Instruction List',
|
||||||
|
|
||||||
|
// Posts seeder
|
||||||
|
'cover_image' => 'Cover Image',
|
||||||
|
|
||||||
// Offline
|
// Offline
|
||||||
'connection_problem' => 'Connection problem',
|
'connection_problem' => 'Connection problem',
|
||||||
'your_internet_connection_is_broken' => 'Your internet connection is broken,',
|
'your_internet_connection_is_broken' => 'Your internet connection is broken,',
|
||||||
|
|||||||
@ -62,6 +62,8 @@ return [
|
|||||||
'list' => 'Liste',
|
'list' => 'Liste',
|
||||||
'instruction_description' => 'Talimat Açıklama',
|
'instruction_description' => 'Talimat Açıklama',
|
||||||
'instruction_list' => 'Talimat Listesi',
|
'instruction_list' => 'Talimat Listesi',
|
||||||
|
// Posts seeder
|
||||||
|
'cover_image' => 'Kapak Fotoğrafı',
|
||||||
|
|
||||||
// Offline
|
// Offline
|
||||||
'connection_problem' => 'Connection problem',
|
'connection_problem' => 'Connection problem',
|
||||||
|
|||||||
@ -14,7 +14,7 @@
|
|||||||
class="fs-14 product rounded position-relative bg-white link-dark text-decoration-none border">
|
class="fs-14 product rounded position-relative bg-white link-dark text-decoration-none border">
|
||||||
<div class="product-img">
|
<div class="product-img">
|
||||||
<a href="{{ post.route('view') }}">
|
<a href="{{ post.route('view') }}">
|
||||||
{{ img( post.image.make.url ?? 'visiosoft.theme.base::images/no-image.png').class('w-100')|raw }}
|
{{ img( post.cover_image.make.url ?? 'visiosoft.theme.base::images/no-image.png').class('w-100')|raw }}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="product-text-area p-3">
|
<div class="product-text-area p-3">
|
||||||
|
|||||||
@ -12,7 +12,7 @@
|
|||||||
{% for post in posts %}
|
{% for post in posts %}
|
||||||
<a href="{{ post.route('view') }}" class="col-xl-4 col-lg-6 col-md-12 col-12 text-decoration-none my-3">
|
<a href="{{ post.route('view') }}" class="col-xl-4 col-lg-6 col-md-12 col-12 text-decoration-none my-3">
|
||||||
<div class="bannerImage_2 position-relative">
|
<div class="bannerImage_2 position-relative">
|
||||||
{{ img( post.cover_photo.make.url ?? 'visiosoft.theme.base::images/no-image.png')
|
{{ img( post.cover_image.make.url ?? 'visiosoft.theme.base::images/no-image.png')
|
||||||
.class('w-100')|raw }}
|
.class('w-100')|raw }}
|
||||||
<span class="p-1 fs-12 bgSpecial_6 position-absolute left-zero bottom-zero text-white">
|
<span class="p-1 fs-12 bgSpecial_6 position-absolute left-zero bottom-zero text-white">
|
||||||
{{ post.category.name }}
|
{{ post.category.name }}
|
||||||
@ -42,7 +42,7 @@
|
|||||||
<div class="col-md-8 col-12">
|
<div class="col-md-8 col-12">
|
||||||
<div class="position-relative w-fit shadow-sm">
|
<div class="position-relative w-fit shadow-sm">
|
||||||
<a href="{{ posts.first.route('view') }}">
|
<a href="{{ posts.first.route('view') }}">
|
||||||
{{ img( posts.first.image.make.url ?? 'visiosoft.theme.base::images/no-image.png')
|
{{ img( posts.first.cover_image.make.url ?? 'visiosoft.theme.base::images/no-image.png')
|
||||||
.class('w-100')|raw }}
|
.class('w-100')|raw }}
|
||||||
<div class="bgForLight"></div>
|
<div class="bgForLight"></div>
|
||||||
<div class="d-flex flex-column position-absolute p-4 bottom-zero left-zero z-index">
|
<div class="d-flex flex-column position-absolute p-4 bottom-zero left-zero z-index">
|
||||||
@ -61,7 +61,7 @@
|
|||||||
{% if loop.first %}
|
{% if loop.first %}
|
||||||
<div class="position-relative w-fit shadow-sm">
|
<div class="position-relative w-fit shadow-sm">
|
||||||
<a href="{{ post.route('view') }}">
|
<a href="{{ post.route('view') }}">
|
||||||
{{ img( post.image.make.url ?? 'visiosoft.theme.base::images/no-image.png').class('w-100')|raw }}
|
{{ img( post.cover_image.make.url ?? 'visiosoft.theme.base::images/no-image.png').class('w-100')|raw }}
|
||||||
<div class="bgForLight"></div>
|
<div class="bgForLight"></div>
|
||||||
<div class="d-flex flex-column position-absolute p-4 bottom-zero left-zero z-index">
|
<div class="d-flex flex-column position-absolute p-4 bottom-zero left-zero z-index">
|
||||||
<div class="text-white fs-17px">{{ post.title }}</div>
|
<div class="text-white fs-17px">{{ post.title }}</div>
|
||||||
@ -74,7 +74,7 @@
|
|||||||
{% else %}
|
{% else %}
|
||||||
<div class="d-flex my-3">
|
<div class="d-flex my-3">
|
||||||
<a href="{{ post.route('view') }}" class="d-flex text-dark">
|
<a href="{{ post.route('view') }}" class="d-flex text-dark">
|
||||||
{{ img( post.image.make.url ?? 'visiosoft.theme.base::images/no-image.png')
|
{{ img( post.cover_image.make.url ?? 'visiosoft.theme.base::images/no-image.png')
|
||||||
.class('ImageWidth mr-3 w-100')|raw }}
|
.class('ImageWidth mr-3 w-100')|raw }}
|
||||||
<div class="d-flex flex-column">
|
<div class="d-flex flex-column">
|
||||||
<div class="text-capitalize fw-500 fs-13">{{ post.title }}</div>
|
<div class="text-capitalize fw-500 fs-13">{{ post.title }}</div>
|
||||||
|
|||||||
@ -9,9 +9,9 @@
|
|||||||
<div class="row p-0 m-0">
|
<div class="row p-0 m-0">
|
||||||
<div class="col-12 position-relative my-3">
|
<div class="col-12 position-relative my-3">
|
||||||
<div class="productImage">
|
<div class="productImage">
|
||||||
{{ img(post.cover_photo.make.url).class('w-100')|raw }}
|
{{ img(post.cover_image.make.url).class('w-100')|raw }}
|
||||||
</div>
|
</div>
|
||||||
<div class="px-md-4 px-0 p-md-3 p-0 {{ post.cover_photo ? 'positionSpecial' }} w-100">
|
<div class="px-md-4 px-0 p-md-3 p-0 {{ post.cover_image ? 'positionSpecial' }} w-100">
|
||||||
<div class="bg-white p-3 px-4">
|
<div class="bg-white p-3 px-4">
|
||||||
<h1>{{ post.title }}</h1>
|
<h1>{{ post.title }}</h1>
|
||||||
<div class="mt-4 d-flex flex-md-row flex-column">
|
<div class="mt-4 d-flex flex-md-row flex-column">
|
||||||
@ -50,7 +50,7 @@
|
|||||||
<a href="{{ post.route('view') }}"
|
<a href="{{ post.route('view') }}"
|
||||||
class="fs-14 product p-0 mr-3 rounded position-relative bg-white link-dark text-decoration-none">
|
class="fs-14 product p-0 mr-3 rounded position-relative bg-white link-dark text-decoration-none">
|
||||||
<div class="related-image-wrapper w-225">
|
<div class="related-image-wrapper w-225">
|
||||||
{{ img( post.cover_photo.make.url ?? 'visiosoft.theme.base::images/no-image.png').class('related-image')|raw }}
|
{{ img( post.cover_image.make.url ?? 'visiosoft.theme.base::images/no-image.png').class('related-image')|raw }}
|
||||||
</div>
|
</div>
|
||||||
<div class="product-text-area p-3">
|
<div class="product-text-area p-3">
|
||||||
<div class="fw-500 text-dark single-line">
|
<div class="fw-500 text-dark single-line">
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
use Anomaly\Streams\Platform\Database\Seeder\Seeder;
|
use Anomaly\Streams\Platform\Database\Seeder\Seeder;
|
||||||
use Visiosoft\BaseTheme\Seed\RegisterInstructionSeeder;
|
use Visiosoft\BaseTheme\Seed\RegisterInstructionSeeder;
|
||||||
|
use Visiosoft\BaseTheme\Seed\PostFieldsSeeder;
|
||||||
|
|
||||||
class BaseThemeSeeder extends Seeder
|
class BaseThemeSeeder extends Seeder
|
||||||
{
|
{
|
||||||
@ -13,5 +14,8 @@ class BaseThemeSeeder extends Seeder
|
|||||||
{
|
{
|
||||||
// Register Instruction Seeder
|
// Register Instruction Seeder
|
||||||
$this->call(RegisterInstructionSeeder::class);
|
$this->call(RegisterInstructionSeeder::class);
|
||||||
|
|
||||||
|
// Post Fields Seeder
|
||||||
|
$this->call(PostFieldsSeeder::class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -0,0 +1,63 @@
|
|||||||
|
<?php namespace Visiosoft\BaseTheme\Seed;
|
||||||
|
|
||||||
|
use Anomaly\BlocksModule\Area\Contract\AreaRepositoryInterface;
|
||||||
|
use Anomaly\BlocksModule\Type\Contract\TypeRepositoryInterface;
|
||||||
|
use Anomaly\Streams\Platform\Assignment\Contract\AssignmentRepositoryInterface;
|
||||||
|
use Anomaly\Streams\Platform\Field\Contract\FieldRepositoryInterface;
|
||||||
|
use Anomaly\Streams\Platform\Stream\Contract\StreamRepositoryInterface;
|
||||||
|
use Illuminate\Database\Seeder;
|
||||||
|
use Anomaly\BlocksModule\Block\Contract\BlockRepositoryInterface;
|
||||||
|
use Visiosoft\AdvsModule\Adv\AdvModel;
|
||||||
|
|
||||||
|
class PostFieldsSeeder extends Seeder
|
||||||
|
{
|
||||||
|
|
||||||
|
private $fieldRepository;
|
||||||
|
private $assignmentRepository;
|
||||||
|
private $streamRepository;
|
||||||
|
|
||||||
|
public function __construct(
|
||||||
|
FieldRepositoryInterface $fieldRepository,
|
||||||
|
AssignmentRepositoryInterface $assignmentRepository,
|
||||||
|
StreamRepositoryInterface $streamRepository
|
||||||
|
) {
|
||||||
|
$this->fieldRepository = $fieldRepository;
|
||||||
|
$this->assignmentRepository = $assignmentRepository;
|
||||||
|
$this->streamRepository = $streamRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function run()
|
||||||
|
{
|
||||||
|
if ($stream = $this->streamRepository->findBySlugAndNamespace('default_posts', 'posts')) {
|
||||||
|
// Create cover image field
|
||||||
|
$coverImageField = [
|
||||||
|
'name' => trans('visiosoft.theme.base::field.cover_image'),
|
||||||
|
'namespace' => 'posts',
|
||||||
|
'slug' => 'cover_image',
|
||||||
|
'type' => 'anomaly.field_type.file',
|
||||||
|
'config' => [
|
||||||
|
'folders' => ['images'],
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
if (!$field = $this->fieldRepository->findBySlugAndNamespace($coverImageField['slug'], $coverImageField['namespace'])) {
|
||||||
|
$field = $this->fieldRepository->create([
|
||||||
|
'name' => $coverImageField['name'],
|
||||||
|
'namespace' => $coverImageField['namespace'],
|
||||||
|
'slug' => $coverImageField['slug'],
|
||||||
|
'type' => $coverImageField['type'],
|
||||||
|
'config' => $coverImageField['config'],
|
||||||
|
'locked' => 0
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$this->assignmentRepository->findByStreamAndField($stream, $field)) {
|
||||||
|
$this->assignmentRepository->create([
|
||||||
|
'stream_id' => $stream->getId(),
|
||||||
|
'field_id' => $field->id,
|
||||||
|
'label' => $coverImageField['name'],
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user