রিডাক্স (redux) ফ্রেমওয়ার্ক দিয়ে ওয়ার্ডপ্রেস থিম অপশন

Why take this course?
আপনি যে ভাষায় ডাগরীং করা চান, তাহলে আমি বাংলায় সাধারণ একটি স্ট্যাটিক কন্টেইনার (Stateful Component) তৈরি করব এবং রিডাক্স ফ্রেমওয়ার্ক ব্যবহার করা দেই।
1. ইনスটল করা
আপনার ডিভাইনে (example.com) বা সাধারণ একটি সার্ভার একটি রিডাক্স জেনের প্রজেক্ত তৈরি করতে হবে। অ্যাট লাইব্রেরীগুলো ইনসটল করা জানাবেন:
composer require laravel/jetstream
npm install
npm run dev
php artisan jetstream:install livewire --teams=2
2. অপশন প্যানেল তৈরি করা
গাইডলাইন এবং স্টার্टিং পয়েন্ট হিসেবে laravel-news.com/articles/creating-a-simple-admin-panel-with-jetstream ফাইলটি ব্যবহার করে একটি sample-config.php সন্তুষ্ট করুন।
3. মেইন কনফিগারেশন প্রক্রিয়াটি তুলে ধরে
// config/jetstream.php
'sanctum' => [
// ...
'stateful' => [
'components' => env('JETSTREAM_STATEFUL_COMPONENTS', true),
],
],
4. সেকশনসমূহ যুক্ত করা
আপনার থিম প্যানেল প্রস্তুত হওয়ার পর, Livewire বা অন্য একটি stateful component ই용া কোনো নাম ডাগরীং করুন:
// app/Http/Livewire/StatefulComponent.php
use Livewire\Component;
class StatefulComponent extends Component
{
public $state = [
// Your state properties
];
public function updateState($key, $value)
{
$this->state[$key] = $value;
$this->emit('stateUpdated', $key, $value);
}
public function render()
{
return view('livewire.stateful-component');
}
}
এবং সেটি মূলক ভিত্বিত ফাইলে (example.blade.php) ডের করুন:
<!-- resources/views/livewire/stateful-component.blade.php -->
<div>
<!-- Your form or component here -->
@livewire(StatefulComponent::class)
</div>
5. State এবং Event লিস্টনার কমপোনেনט ফেল করা
Livewire ভিত্বিত ফাইলে (example.js) JavaScript কোড লিখুন যা stateful component এর জন্য লিস্টনার এবং event emit করবে:
// resources/js/components/StatefulComponent.vue
<script>
import { Head, router } from '@inertiajs/inertia';
import Pusher from 'pusher-js';
export default defineComponent({
emits: ['stateUpdated'],
mounted() {
const key = "{{ $key }}"; // Replace with your dynamic key
const cable = new Pusher.LoggingPusher('{{ config('broadcasting.connections.pusher.key') }}', {
cluster: 'laravel',
wsHostUrl: 'ws-eu1.phoenix.zendesk.com', // Change to your cluster
wssPort: 6071,
});
cable.subscribe('stateful-channel-{{ $componentId }}')
.bind('StateUpdated', (data) => {
this.$emit('stateUpdated', data);
})
.bind('UpdatesChannel', (data) => {
// Handle updates here
});
},
});
</script>
এবং PHP ভিত্বিত ফাইলে (example.php) আপনার component এর event কমপোনেনট ফেল:
// app/Http/Livewire/StatefulComponent.php
public function mount()
{
$this->listeners(['stateUpdated']);
}
public function stateUpdated($key, $value)
{
$this->state[$key] = $value;
}
6. Broadcasting Configuration
Laravel Sanctum এবং Pusher তৈরি করা হওয়ার পর, Laravel সবসময় broadcasting configuration নির্েষ্� করুন:
// config/broadcasting.php
'pusher' => [
'model' => App\Models\User::class,
// ...
],
এবং Pusher চানে তৈরি করুন:
php artisan pusher:install
7. Stateful Component হলোক করা
প্রো젝টি রাশনাও বের করতে এবং পুষ্টি হতে পরীক্ষা করুন:
npm install && npm run dev
php artisan migrate
এবং শেয়ারের ফসলতা ভাল হোক, stateful component তৈরি হওয়া থাকবে এবং event ব্যাবহার করা হবে এটুক সময় সা용কন্ড পাবে।
আপনি দেখতে পাবেন, যে আপনার Livewire component এবং Pusher ব্যবহার করা সমান ভাল করে শিপার সক্ষী তৈরি করতে পারেন। Stateful component এর মান আপডেট হবে এবং event listener এবং পুষ্টি করবে Pusher চ্যালনে সেগুলি ব্যবহার করে।
Course Gallery




Loading charts...