feat: add bylaw management features including documents, legal authorities, subject categories, and nodes
This commit is contained in:
@@ -31,11 +31,13 @@ class AddSubscriptionDays extends Command
|
|||||||
|
|
||||||
if ($days <= 0) {
|
if ($days <= 0) {
|
||||||
$this->error('Days must be a positive integer.');
|
$this->error('Days must be a positive integer.');
|
||||||
|
|
||||||
return self::FAILURE;
|
return self::FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($onlyWithoutSubscription && ! $allUsers) {
|
if ($onlyWithoutSubscription && ! $allUsers) {
|
||||||
$this->error('The --only-without-subscription option can only be used with --all-users.');
|
$this->error('The --only-without-subscription option can only be used with --all-users.');
|
||||||
|
|
||||||
return self::FAILURE;
|
return self::FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -43,12 +45,14 @@ class AddSubscriptionDays extends Command
|
|||||||
$planId = $this->option('plan-id');
|
$planId = $this->option('plan-id');
|
||||||
if (! $planId) {
|
if (! $planId) {
|
||||||
$this->error('When using --all-users you must provide --plan-id for users without a subscription.');
|
$this->error('When using --all-users you must provide --plan-id for users without a subscription.');
|
||||||
|
|
||||||
return self::FAILURE;
|
return self::FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
$plan = SubscribePlan::find($planId);
|
$plan = SubscribePlan::find($planId);
|
||||||
if (! $plan) {
|
if (! $plan) {
|
||||||
$this->error('Subscribe plan not found for the given --plan-id.');
|
$this->error('Subscribe plan not found for the given --plan-id.');
|
||||||
|
|
||||||
return self::FAILURE;
|
return self::FAILURE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ class ArtController extends Controller
|
|||||||
'law_id' => 'required',
|
'law_id' => 'required',
|
||||||
'division_id' => 'nullable',
|
'division_id' => 'nullable',
|
||||||
'branch_id' => 'nullable',
|
'branch_id' => 'nullable',
|
||||||
'is_free' => 'nullable'
|
'is_free' => 'nullable',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$validated['is_free'] = $request->input('is_free') ? true : false;
|
$validated['is_free'] = $request->input('is_free') ? true : false;
|
||||||
@@ -86,7 +86,6 @@ class ArtController extends Controller
|
|||||||
$divisions = Division::all();
|
$divisions = Division::all();
|
||||||
$branches = Branch::all();
|
$branches = Branch::all();
|
||||||
|
|
||||||
|
|
||||||
return view('admin.art.update', compact('art', 'chapters', 'parts', 'gates', 'books', 'volums', 'laws', 'sections', 'branches', 'divisions'));
|
return view('admin.art.update', compact('art', 'chapters', 'parts', 'gates', 'books', 'volums', 'laws', 'sections', 'branches', 'divisions'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -106,7 +105,7 @@ class ArtController extends Controller
|
|||||||
'law_id' => 'required',
|
'law_id' => 'required',
|
||||||
'division_id' => 'nullable',
|
'division_id' => 'nullable',
|
||||||
'branch_id' => 'nullable',
|
'branch_id' => 'nullable',
|
||||||
'is_free' => 'nullable'
|
'is_free' => 'nullable',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$validated['is_free'] = $request->input('is_free') ? true : false;
|
$validated['is_free'] = $request->input('is_free') ? true : false;
|
||||||
|
|||||||
@@ -0,0 +1,56 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Admin;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\BylawCodificationLink;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class BylawCodificationLinkController extends Controller
|
||||||
|
{
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$items = BylawCodificationLink::latest('created_at')->paginate(15);
|
||||||
|
|
||||||
|
return view('admin.bylaw-codification-link.index', compact('items'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
return view('admin.bylaw-codification-link.create');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
$data = $request->validate(['source_entity_type' => 'required|in:bylaw_node,bylaw_doc,law_doc,court_verdict,advisory_opinion', 'source_entity_id' => 'required|integer', 'target_entity_type' => 'required|in:bylaw_node,bylaw_doc,law_doc,court_verdict,advisory_opinion', 'target_entity_id' => 'required|integer', 'link_type' => 'required|in:repeals_explicitly,repeals_implicitly,annuls_entirely,annuls_partially,amends,adds_to,interprets,is_executive_bylaw_of', 'effective_date' => 'nullable|date', 'justification' => 'nullable|string']);
|
||||||
|
$data['created_at'] = now();
|
||||||
|
BylawCodificationLink::create($data);
|
||||||
|
|
||||||
|
return redirect(route('bylaw-codification-link.index'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function edit(BylawCodificationLink $bylawCodificationLink)
|
||||||
|
{
|
||||||
|
return view('admin.bylaw-codification-link.update', compact('bylawCodificationLink'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function show(BylawCodificationLink $bylawCodificationLink)
|
||||||
|
{
|
||||||
|
return redirect(route('bylaw-codification-link.edit', $bylawCodificationLink));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update(Request $request, BylawCodificationLink $bylawCodificationLink)
|
||||||
|
{
|
||||||
|
$data = $request->validate(['source_entity_type' => 'required|in:bylaw_node,bylaw_doc,law_doc,court_verdict,advisory_opinion', 'source_entity_id' => 'required|integer', 'target_entity_type' => 'required|in:bylaw_node,bylaw_doc,law_doc,court_verdict,advisory_opinion', 'target_entity_id' => 'required|integer', 'link_type' => 'required|in:repeals_explicitly,repeals_implicitly,annuls_entirely,annuls_partially,amends,adds_to,interprets,is_executive_bylaw_of', 'effective_date' => 'nullable|date', 'justification' => 'nullable|string']);
|
||||||
|
$bylawCodificationLink->update($data);
|
||||||
|
|
||||||
|
return redirect(route('bylaw-codification-link.edit', $bylawCodificationLink));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function destroy(BylawCodificationLink $bylawCodificationLink)
|
||||||
|
{
|
||||||
|
$bylawCodificationLink->delete();
|
||||||
|
|
||||||
|
return redirect(route('bylaw-codification-link.index'));
|
||||||
|
}
|
||||||
|
}
|
||||||
69
app/Http/Controllers/Admin/BylawDocumentController.php
Normal file
69
app/Http/Controllers/Admin/BylawDocumentController.php
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Admin;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\BylawDocument;
|
||||||
|
use App\Models\BylawLegalAuthority;
|
||||||
|
use App\Models\BylawSubjectCategory;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class BylawDocumentController extends Controller
|
||||||
|
{
|
||||||
|
public function index(Request $request)
|
||||||
|
{
|
||||||
|
$query = BylawDocument::with(['category', 'approvalAuthority', 'promulgationAuthority']);
|
||||||
|
if ($request->filled('q')) {
|
||||||
|
$query->where('title', 'like', "%{$request->q}%");
|
||||||
|
}
|
||||||
|
$items = $query->latest()->paginate(15)->withQueryString();
|
||||||
|
|
||||||
|
return view('admin.bylaw-document.index', compact('items'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
$categories = BylawSubjectCategory::all();
|
||||||
|
$authorities = BylawLegalAuthority::all();
|
||||||
|
|
||||||
|
return view('admin.bylaw-document.create', compact('categories', 'authorities'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
$data = $request->validate(['title' => 'required|string|max:1000', 'category_id' => 'nullable|exists:bylaw_subject_categories,id', 'approval_authority_id' => 'nullable|exists:bylaw_legal_authorities,id', 'approval_date' => 'nullable|date', 'promulgation_authority_id' => 'nullable|exists:bylaw_legal_authorities,id', 'promulgation_date' => 'nullable|date', 'promulgation_number' => 'nullable|string|max:100', 'official_gazette_number' => 'nullable|string|max:100', 'official_gazette_date' => 'nullable|date', 'execution_date' => 'nullable|date', 'bylaw_type' => 'required|in:executive,delegated,independent', 'global_status' => 'required|in:valid,explicitly_repealed,implicitly_repealed,annulled,expired,draft', 'pdf_file_path' => 'nullable|string|max:500', 'is_published' => 'nullable|boolean', 'description' => 'nullable|string']);
|
||||||
|
$data['is_published'] = $request->boolean('is_published');
|
||||||
|
BylawDocument::create($data);
|
||||||
|
|
||||||
|
return redirect(route('bylaw-document.index'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function edit(BylawDocument $bylawDocument)
|
||||||
|
{
|
||||||
|
$categories = BylawSubjectCategory::all();
|
||||||
|
$authorities = BylawLegalAuthority::all();
|
||||||
|
|
||||||
|
return view('admin.bylaw-document.update', compact('bylawDocument', 'categories', 'authorities'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function show(BylawDocument $bylawDocument)
|
||||||
|
{
|
||||||
|
return redirect(route('bylaw-document.edit', $bylawDocument));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update(Request $request, BylawDocument $bylawDocument)
|
||||||
|
{
|
||||||
|
$data = $request->validate(['title' => 'required|string|max:1000', 'category_id' => 'nullable|exists:bylaw_subject_categories,id', 'approval_authority_id' => 'nullable|exists:bylaw_legal_authorities,id', 'approval_date' => 'nullable|date', 'promulgation_authority_id' => 'nullable|exists:bylaw_legal_authorities,id', 'promulgation_date' => 'nullable|date', 'promulgation_number' => 'nullable|string|max:100', 'official_gazette_number' => 'nullable|string|max:100', 'official_gazette_date' => 'nullable|date', 'execution_date' => 'nullable|date', 'bylaw_type' => 'required|in:executive,delegated,independent', 'global_status' => 'required|in:valid,explicitly_repealed,implicitly_repealed,annulled,expired,draft', 'pdf_file_path' => 'nullable|string|max:500', 'is_published' => 'nullable|boolean', 'description' => 'nullable|string']);
|
||||||
|
$data['is_published'] = $request->boolean('is_published');
|
||||||
|
$bylawDocument->update($data);
|
||||||
|
|
||||||
|
return redirect(route('bylaw-document.edit', $bylawDocument));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function destroy(BylawDocument $bylawDocument)
|
||||||
|
{
|
||||||
|
$bylawDocument->delete();
|
||||||
|
|
||||||
|
return redirect(route('bylaw-document.index'));
|
||||||
|
}
|
||||||
|
}
|
||||||
59
app/Http/Controllers/Admin/BylawLegalAuthorityController.php
Normal file
59
app/Http/Controllers/Admin/BylawLegalAuthorityController.php
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Admin;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\BylawLegalAuthority;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class BylawLegalAuthorityController extends Controller
|
||||||
|
{
|
||||||
|
public function index(Request $request)
|
||||||
|
{
|
||||||
|
$query = BylawLegalAuthority::query();
|
||||||
|
if ($request->filled('q')) {
|
||||||
|
$query->where('name', 'like', "%{$request->q}%");
|
||||||
|
}
|
||||||
|
$items = $query->latest()->paginate(15)->withQueryString();
|
||||||
|
|
||||||
|
return view('admin.bylaw-legal-authority.index', compact('items'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
return view('admin.bylaw-legal-authority.create');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
$data = $request->validate(['name' => 'required|unique:bylaw_legal_authorities,name', 'authority_type' => 'required|in:executive,judicial,legislative,administrative,other', 'description' => 'nullable|string']);
|
||||||
|
BylawLegalAuthority::create($data);
|
||||||
|
|
||||||
|
return redirect(route('bylaw-legal-authority.index'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function edit(BylawLegalAuthority $bylawLegalAuthority)
|
||||||
|
{
|
||||||
|
return view('admin.bylaw-legal-authority.update', compact('bylawLegalAuthority'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function show(BylawLegalAuthority $bylawLegalAuthority)
|
||||||
|
{
|
||||||
|
return redirect(route('bylaw-legal-authority.edit', $bylawLegalAuthority));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update(Request $request, BylawLegalAuthority $bylawLegalAuthority)
|
||||||
|
{
|
||||||
|
$data = $request->validate(['name' => 'required|unique:bylaw_legal_authorities,name,'.$bylawLegalAuthority->id, 'authority_type' => 'required|in:executive,judicial,legislative,administrative,other', 'description' => 'nullable|string']);
|
||||||
|
$bylawLegalAuthority->update($data);
|
||||||
|
|
||||||
|
return redirect(route('bylaw-legal-authority.edit', $bylawLegalAuthority));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function destroy(BylawLegalAuthority $bylawLegalAuthority)
|
||||||
|
{
|
||||||
|
$bylawLegalAuthority->delete();
|
||||||
|
|
||||||
|
return redirect(route('bylaw-legal-authority.index'));
|
||||||
|
}
|
||||||
|
}
|
||||||
57
app/Http/Controllers/Admin/BylawNodeController.php
Normal file
57
app/Http/Controllers/Admin/BylawNodeController.php
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Admin;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\BylawDocument;
|
||||||
|
use App\Models\BylawNode;
|
||||||
|
use App\Models\BylawNodeType;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class BylawNodeController extends Controller
|
||||||
|
{
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$items = BylawNode::with(['document', 'type'])->latest()->paginate(15);
|
||||||
|
|
||||||
|
return view('admin.bylaw-node.index', compact('items'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
return view('admin.bylaw-node.create', ['documents' => BylawDocument::all(), 'types' => BylawNodeType::all(), 'parents' => BylawNode::all()]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
$data = $request->validate(['document_id' => 'required|exists:bylaw_documents,id', 'parent_id' => 'nullable|exists:bylaw_nodes,id', 'node_type_id' => 'required|exists:bylaw_node_types,id', 'node_identifier' => 'nullable|string|max:50', 'title' => 'nullable|string|max:500', 'node_content' => 'nullable|string', 'sort_order' => 'nullable|integer', 'valid_from' => 'nullable|date', 'valid_to' => 'nullable|date', 'node_status' => 'required|in:valid,repealed,annulled,amended,suspended']);
|
||||||
|
BylawNode::create($data);
|
||||||
|
|
||||||
|
return redirect(route('bylaw-node.index'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function edit(BylawNode $bylawNode)
|
||||||
|
{
|
||||||
|
return view('admin.bylaw-node.update', ['bylawNode' => $bylawNode, 'documents' => BylawDocument::all(), 'types' => BylawNodeType::all(), 'parents' => BylawNode::where('id', '!=', $bylawNode->id)->get()]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function show(BylawNode $bylawNode)
|
||||||
|
{
|
||||||
|
return redirect(route('bylaw-node.edit', $bylawNode));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update(Request $request, BylawNode $bylawNode)
|
||||||
|
{
|
||||||
|
$data = $request->validate(['document_id' => 'required|exists:bylaw_documents,id', 'parent_id' => 'nullable|exists:bylaw_nodes,id', 'node_type_id' => 'required|exists:bylaw_node_types,id', 'node_identifier' => 'nullable|string|max:50', 'title' => 'nullable|string|max:500', 'node_content' => 'nullable|string', 'sort_order' => 'nullable|integer', 'valid_from' => 'nullable|date', 'valid_to' => 'nullable|date', 'node_status' => 'required|in:valid,repealed,annulled,amended,suspended']);
|
||||||
|
$bylawNode->update($data);
|
||||||
|
|
||||||
|
return redirect(route('bylaw-node.edit', $bylawNode));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function destroy(BylawNode $bylawNode)
|
||||||
|
{
|
||||||
|
$bylawNode->delete();
|
||||||
|
|
||||||
|
return redirect(route('bylaw-node.index'));
|
||||||
|
}
|
||||||
|
}
|
||||||
55
app/Http/Controllers/Admin/BylawNodeTypeController.php
Normal file
55
app/Http/Controllers/Admin/BylawNodeTypeController.php
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Admin;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\BylawNodeType;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class BylawNodeTypeController extends Controller
|
||||||
|
{
|
||||||
|
public function index(Request $request)
|
||||||
|
{
|
||||||
|
$items = BylawNodeType::latest()->paginate(15)->withQueryString();
|
||||||
|
|
||||||
|
return view('admin.bylaw-node-type.index', compact('items'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
return view('admin.bylaw-node-type.create');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
$data = $request->validate(['name' => 'required|unique:bylaw_node_types,name', 'hierarchy_level' => 'required|integer']);
|
||||||
|
BylawNodeType::create($data);
|
||||||
|
|
||||||
|
return redirect(route('bylaw-node-type.index'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function edit(BylawNodeType $bylawNodeType)
|
||||||
|
{
|
||||||
|
return view('admin.bylaw-node-type.update', compact('bylawNodeType'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function show(BylawNodeType $bylawNodeType)
|
||||||
|
{
|
||||||
|
return redirect(route('bylaw-node-type.edit', $bylawNodeType));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update(Request $request, BylawNodeType $bylawNodeType)
|
||||||
|
{
|
||||||
|
$data = $request->validate(['name' => 'required|unique:bylaw_node_types,name,'.$bylawNodeType->id, 'hierarchy_level' => 'required|integer']);
|
||||||
|
$bylawNodeType->update($data);
|
||||||
|
|
||||||
|
return redirect(route('bylaw-node-type.edit', $bylawNodeType));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function destroy(BylawNodeType $bylawNodeType)
|
||||||
|
{
|
||||||
|
$bylawNodeType->delete();
|
||||||
|
|
||||||
|
return redirect(route('bylaw-node-type.index'));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Admin;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\BylawSubjectCategory;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
|
class BylawSubjectCategoryController extends Controller
|
||||||
|
{
|
||||||
|
public function index(Request $request)
|
||||||
|
{
|
||||||
|
$query = BylawSubjectCategory::query();
|
||||||
|
if ($request->filled('q')) {
|
||||||
|
$query->where('name', 'like', "%{$request->q}%");
|
||||||
|
} $items = $query->latest()->paginate(15)->withQueryString();
|
||||||
|
|
||||||
|
return view('admin.bylaw-subject-category.index', compact('items'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
$parents = BylawSubjectCategory::all();
|
||||||
|
|
||||||
|
return view('admin.bylaw-subject-category.create', compact('parents'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
$data = $request->validate(['parent_id' => 'nullable|exists:bylaw_subject_categories,id', 'name' => 'required|string', 'slug' => 'nullable|string|unique:bylaw_subject_categories,slug', 'sort_order' => 'nullable|integer']);
|
||||||
|
$data['slug'] = $data['slug'] ?? Str::slug($data['name']);
|
||||||
|
BylawSubjectCategory::create($data);
|
||||||
|
|
||||||
|
return redirect(route('bylaw-subject-category.index'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function edit(BylawSubjectCategory $bylawSubjectCategory)
|
||||||
|
{
|
||||||
|
$parents = BylawSubjectCategory::where('id', '!=', $bylawSubjectCategory->id)->get();
|
||||||
|
|
||||||
|
return view('admin.bylaw-subject-category.update', compact('bylawSubjectCategory', 'parents'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function show(BylawSubjectCategory $bylawSubjectCategory)
|
||||||
|
{
|
||||||
|
return redirect(route('bylaw-subject-category.edit', $bylawSubjectCategory));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update(Request $request, BylawSubjectCategory $bylawSubjectCategory)
|
||||||
|
{
|
||||||
|
$data = $request->validate(['parent_id' => 'nullable|exists:bylaw_subject_categories,id', 'name' => 'required|string', 'slug' => 'required|string|unique:bylaw_subject_categories,slug,'.$bylawSubjectCategory->id, 'sort_order' => 'nullable|integer']);
|
||||||
|
$bylawSubjectCategory->update($data);
|
||||||
|
|
||||||
|
return redirect(route('bylaw-subject-category.edit', $bylawSubjectCategory));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function destroy(BylawSubjectCategory $bylawSubjectCategory)
|
||||||
|
{
|
||||||
|
$bylawSubjectCategory->delete();
|
||||||
|
|
||||||
|
return redirect(route('bylaw-subject-category.index'));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -34,10 +34,9 @@ class CategoryController extends Controller
|
|||||||
{
|
{
|
||||||
$validated = $request->validate([
|
$validated = $request->validate([
|
||||||
'name' => 'required',
|
'name' => 'required',
|
||||||
'type' => 'required'
|
'type' => 'required',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
||||||
Category::create($validated);
|
Category::create($validated);
|
||||||
|
|
||||||
return redirect(route('categories.index'));
|
return redirect(route('categories.index'));
|
||||||
@@ -52,7 +51,7 @@ class CategoryController extends Controller
|
|||||||
{
|
{
|
||||||
$validated = $request->validate([
|
$validated = $request->validate([
|
||||||
'name' => 'required',
|
'name' => 'required',
|
||||||
'type' => 'required'
|
'type' => 'required',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$category->update($validated);
|
$category->update($validated);
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ class ChapterController extends Controller
|
|||||||
'book_id' => 'nullable',
|
'book_id' => 'nullable',
|
||||||
'volum_id' => 'nullable',
|
'volum_id' => 'nullable',
|
||||||
'law_id' => 'nullable',
|
'law_id' => 'nullable',
|
||||||
'division_id' => 'nullable'
|
'division_id' => 'nullable',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
Chapter::query()->create($validated);
|
Chapter::query()->create($validated);
|
||||||
@@ -75,7 +75,7 @@ class ChapterController extends Controller
|
|||||||
'book_id' => 'nullable',
|
'book_id' => 'nullable',
|
||||||
'volum_id' => 'nullable',
|
'volum_id' => 'nullable',
|
||||||
'law_id' => 'nullable',
|
'law_id' => 'nullable',
|
||||||
'division_id' => 'nullable'
|
'division_id' => 'nullable',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$chapter->update($validated);
|
$chapter->update($validated);
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ class JudicialPrecedentCategoryController extends Controller
|
|||||||
public function store(Request $request)
|
public function store(Request $request)
|
||||||
{
|
{
|
||||||
$validated = $request->validate([
|
$validated = $request->validate([
|
||||||
'name' => 'required|string|unique:judicial_precedent_categories,name'
|
'name' => 'required|string|unique:judicial_precedent_categories,name',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
JudicialPrecedentCategory::create($validated);
|
JudicialPrecedentCategory::create($validated);
|
||||||
@@ -70,7 +70,7 @@ class JudicialPrecedentCategoryController extends Controller
|
|||||||
public function update(Request $request, JudicialPrecedentCategory $judicialPrecedentCategory)
|
public function update(Request $request, JudicialPrecedentCategory $judicialPrecedentCategory)
|
||||||
{
|
{
|
||||||
$validated = $request->validate([
|
$validated = $request->validate([
|
||||||
'name' => 'required|string|unique:judicial_precedent_categories,name,' . $judicialPrecedentCategory->id
|
'name' => 'required|string|unique:judicial_precedent_categories,name,'.$judicialPrecedentCategory->id,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$judicialPrecedentCategory->update($validated);
|
$judicialPrecedentCategory->update($validated);
|
||||||
@@ -84,6 +84,7 @@ class JudicialPrecedentCategoryController extends Controller
|
|||||||
public function destroy(JudicialPrecedentCategory $judicialPrecedentCategory)
|
public function destroy(JudicialPrecedentCategory $judicialPrecedentCategory)
|
||||||
{
|
{
|
||||||
$judicialPrecedentCategory->delete();
|
$judicialPrecedentCategory->delete();
|
||||||
|
|
||||||
return redirect(route('judicial-precedent-category.index'));
|
return redirect(route('judicial-precedent-category.index'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ class JudicialPrecedentController extends Controller
|
|||||||
{
|
{
|
||||||
$arts = Art::all();
|
$arts = Art::all();
|
||||||
$categories = JudicialPrecedentCategory::all();
|
$categories = JudicialPrecedentCategory::all();
|
||||||
|
|
||||||
return view('admin.judicial-precedent.create', compact('arts', 'categories'));
|
return view('admin.judicial-precedent.create', compact('arts', 'categories'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,7 +47,7 @@ class JudicialPrecedentController extends Controller
|
|||||||
'issuing_authority' => 'nullable|string',
|
'issuing_authority' => 'nullable|string',
|
||||||
'category_id' => 'nullable|exists:judicial_precedent_categories,id',
|
'category_id' => 'nullable|exists:judicial_precedent_categories,id',
|
||||||
'art_ids' => 'nullable|array',
|
'art_ids' => 'nullable|array',
|
||||||
'art_ids.*' => 'exists:arts,id'
|
'art_ids.*' => 'exists:arts,id',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$judicialPrecedent = JudicialPrecedent::create([
|
$judicialPrecedent = JudicialPrecedent::create([
|
||||||
@@ -55,7 +56,7 @@ class JudicialPrecedentController extends Controller
|
|||||||
'subject' => $validated['subject'],
|
'subject' => $validated['subject'],
|
||||||
'full_text' => $validated['full_text'],
|
'full_text' => $validated['full_text'],
|
||||||
'issuing_authority' => $validated['issuing_authority'] ?? 'هیأت عمومی دیوان عالی کشور',
|
'issuing_authority' => $validated['issuing_authority'] ?? 'هیأت عمومی دیوان عالی کشور',
|
||||||
'category_id' => $validated['category_id']
|
'category_id' => $validated['category_id'],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if (! empty($validated['art_ids'])) {
|
if (! empty($validated['art_ids'])) {
|
||||||
@@ -84,7 +85,7 @@ class JudicialPrecedentController extends Controller
|
|||||||
'issuing_authority' => 'nullable|string',
|
'issuing_authority' => 'nullable|string',
|
||||||
'category_id' => 'nullable|exists:judicial_precedent_categories,id',
|
'category_id' => 'nullable|exists:judicial_precedent_categories,id',
|
||||||
'art_ids' => 'nullable|array',
|
'art_ids' => 'nullable|array',
|
||||||
'art_ids.*' => 'exists:arts,id'
|
'art_ids.*' => 'exists:arts,id',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$judicialPrecedent->update($validated);
|
$judicialPrecedent->update($validated);
|
||||||
@@ -97,6 +98,7 @@ class JudicialPrecedentController extends Controller
|
|||||||
public function destroy(JudicialPrecedent $judicialPrecedent)
|
public function destroy(JudicialPrecedent $judicialPrecedent)
|
||||||
{
|
{
|
||||||
$judicialPrecedent->delete();
|
$judicialPrecedent->delete();
|
||||||
|
|
||||||
return redirect(route('judicial-precedent.index'));
|
return redirect(route('judicial-precedent.index'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,11 +58,10 @@ class LawController extends Controller
|
|||||||
return redirect()->route('law.index')->with('success', 'Law created successfully.');
|
return redirect()->route('law.index')->with('success', 'Law created successfully.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function edit(Law $law)
|
public function edit(Law $law)
|
||||||
{
|
{
|
||||||
$categories = Category::all();
|
$categories = Category::all();
|
||||||
|
|
||||||
return view('admin.law.update', compact('law', 'categories'));
|
return view('admin.law.update', compact('law', 'categories'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ class NotificationController extends Controller
|
|||||||
public function store(StoreRequest $request)
|
public function store(StoreRequest $request)
|
||||||
{
|
{
|
||||||
Notification::create($request->validated());
|
Notification::create($request->validated());
|
||||||
|
|
||||||
return redirect()->route('notifications.index');
|
return redirect()->route('notifications.index');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -47,12 +48,14 @@ class NotificationController extends Controller
|
|||||||
public function update(UpdateRequest $request, Notification $notification)
|
public function update(UpdateRequest $request, Notification $notification)
|
||||||
{
|
{
|
||||||
$notification->update($request->validated());
|
$notification->update($request->validated());
|
||||||
|
|
||||||
return redirect()->route('notifications.index');
|
return redirect()->route('notifications.index');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function destroy(Notification $notification)
|
public function destroy(Notification $notification)
|
||||||
{
|
{
|
||||||
$notification->delete();
|
$notification->delete();
|
||||||
|
|
||||||
return redirect()->route('notifications.index');
|
return redirect()->route('notifications.index');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ class PartController extends Controller
|
|||||||
'book_id' => 'nullable',
|
'book_id' => 'nullable',
|
||||||
'volum_id' => 'nullable',
|
'volum_id' => 'nullable',
|
||||||
'law_id' => 'nullable',
|
'law_id' => 'nullable',
|
||||||
'division_id' => 'nullable'
|
'division_id' => 'nullable',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
Part::query()->create($validated);
|
Part::query()->create($validated);
|
||||||
@@ -80,7 +80,7 @@ class PartController extends Controller
|
|||||||
'book_id' => 'nullable',
|
'book_id' => 'nullable',
|
||||||
'volum_id' => 'nullable',
|
'volum_id' => 'nullable',
|
||||||
'law_id' => 'nullable',
|
'law_id' => 'nullable',
|
||||||
'division_id' => 'nullable'
|
'division_id' => 'nullable',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$part->update($validated);
|
$part->update($validated);
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ class SectionController extends Controller
|
|||||||
'book_id' => 'nullable',
|
'book_id' => 'nullable',
|
||||||
'volum_id' => 'nullable',
|
'volum_id' => 'nullable',
|
||||||
'law_id' => 'nullable',
|
'law_id' => 'nullable',
|
||||||
'division_id' => 'nullable'
|
'division_id' => 'nullable',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
section::query()->create($validated);
|
section::query()->create($validated);
|
||||||
@@ -72,7 +72,7 @@ class SectionController extends Controller
|
|||||||
'book_id' => 'nullable',
|
'book_id' => 'nullable',
|
||||||
'volum_id' => 'nullable',
|
'volum_id' => 'nullable',
|
||||||
'law_id' => 'nullable',
|
'law_id' => 'nullable',
|
||||||
'division_id' => 'nullable'
|
'division_id' => 'nullable',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$section->update($validated);
|
$section->update($validated);
|
||||||
|
|||||||
@@ -37,10 +37,10 @@ class SubscribePlanController extends Controller
|
|||||||
$validated['is_free'] = $request->has('is_free');
|
$validated['is_free'] = $request->has('is_free');
|
||||||
|
|
||||||
SubscribePlan::create($validated);
|
SubscribePlan::create($validated);
|
||||||
|
|
||||||
return redirect()->route('subscribe-plans.index');
|
return redirect()->route('subscribe-plans.index');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function edit(SubscribePlan $subscribePlan)
|
public function edit(SubscribePlan $subscribePlan)
|
||||||
{
|
{
|
||||||
return view('admin.subscribe-plans.update', compact('subscribePlan'));
|
return view('admin.subscribe-plans.update', compact('subscribePlan'));
|
||||||
@@ -53,12 +53,14 @@ class SubscribePlanController extends Controller
|
|||||||
$validated['is_free'] = $request->has('is_free');
|
$validated['is_free'] = $request->has('is_free');
|
||||||
|
|
||||||
$subscribePlan->update($validated);
|
$subscribePlan->update($validated);
|
||||||
|
|
||||||
return redirect()->route('subscribe-plans.index');
|
return redirect()->route('subscribe-plans.index');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function destroy(SubscribePlan $subscribePlan)
|
public function destroy(SubscribePlan $subscribePlan)
|
||||||
{
|
{
|
||||||
$subscribePlan->delete();
|
$subscribePlan->delete();
|
||||||
|
|
||||||
return redirect()->route('subscribe-plans.index');
|
return redirect()->route('subscribe-plans.index');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ class VersionController extends Controller
|
|||||||
$validated['force_update'] = $validated['force_update'] == 'on' ? 1 : 0;
|
$validated['force_update'] = $validated['force_update'] == 'on' ? 1 : 0;
|
||||||
}
|
}
|
||||||
Version::create($validated);
|
Version::create($validated);
|
||||||
|
|
||||||
return redirect(route('versions.index'));
|
return redirect(route('versions.index'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,12 +57,14 @@ class VersionController extends Controller
|
|||||||
$validated['force_update'] = $validated['force_update'] == 'on' ? 1 : 0;
|
$validated['force_update'] = $validated['force_update'] == 'on' ? 1 : 0;
|
||||||
}
|
}
|
||||||
$version->update($validated);
|
$version->update($validated);
|
||||||
|
|
||||||
return redirect(route('versions.index'));
|
return redirect(route('versions.index'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function destroy(Version $version)
|
public function destroy(Version $version)
|
||||||
{
|
{
|
||||||
$version->delete();
|
$version->delete();
|
||||||
|
|
||||||
return redirect(route('versions.index'));
|
return redirect(route('versions.index'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ class SuggestionController extends Controller
|
|||||||
{
|
{
|
||||||
Suggestion::create([
|
Suggestion::create([
|
||||||
'user_id' => auth()->user()->id,
|
'user_id' => auth()->user()->id,
|
||||||
'text' => $requst->text
|
'text' => $requst->text,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return $this->success(null, 'موفقیت', 'پیشنهاد شما با موفقیت برای مدیر ارسال شد');
|
return $this->success(null, 'موفقیت', 'پیشنهاد شما با موفقیت برای مدیر ارسال شد');
|
||||||
|
|||||||
@@ -155,7 +155,6 @@ class ArtController extends Controller
|
|||||||
return $this->success(null, 'Success', 'Art liked successfully');
|
return $this->success(null, 'Success', 'Art liked successfully');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private function isLiked($art_id): bool
|
private function isLiked($art_id): bool
|
||||||
{
|
{
|
||||||
return LikeArt::query()->where('art_id', $art_id)
|
return LikeArt::query()->where('art_id', $art_id)
|
||||||
@@ -179,14 +178,13 @@ class ArtController extends Controller
|
|||||||
return [
|
return [
|
||||||
'id' => $q->art->id,
|
'id' => $q->art->id,
|
||||||
'title' => $q->art->title,
|
'title' => $q->art->title,
|
||||||
'text' => $isLocked ? null : $q->art->text
|
'text' => $isLocked ? null : $q->art->text,
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|
||||||
return $this->success($likes);
|
return $this->success($likes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function search(Request $request)
|
public function search(Request $request)
|
||||||
{
|
{
|
||||||
$validated = $request->validate([
|
$validated = $request->validate([
|
||||||
@@ -201,7 +199,7 @@ class ArtController extends Controller
|
|||||||
'branch_id' => 'nullable|array',
|
'branch_id' => 'nullable|array',
|
||||||
'category_id' => 'nullable|int',
|
'category_id' => 'nullable|int',
|
||||||
'per_page' => 'nullable|integer',
|
'per_page' => 'nullable|integer',
|
||||||
'search' => 'nullable|string'
|
'search' => 'nullable|string',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$models = [
|
$models = [
|
||||||
@@ -214,7 +212,7 @@ class ArtController extends Controller
|
|||||||
Part::class,
|
Part::class,
|
||||||
Gate::class,
|
Gate::class,
|
||||||
Branch::class,
|
Branch::class,
|
||||||
Art::class
|
Art::class,
|
||||||
];
|
];
|
||||||
|
|
||||||
$results = [];
|
$results = [];
|
||||||
@@ -238,7 +236,7 @@ class ArtController extends Controller
|
|||||||
'part_id',
|
'part_id',
|
||||||
'gate_id',
|
'gate_id',
|
||||||
'chapter_id',
|
'chapter_id',
|
||||||
'branch_id'
|
'branch_id',
|
||||||
];
|
];
|
||||||
|
|
||||||
$model = new $modelClass;
|
$model = new $modelClass;
|
||||||
@@ -258,7 +256,6 @@ class ArtController extends Controller
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
if (! empty($validated['category_id'])) {
|
if (! empty($validated['category_id'])) {
|
||||||
$query->whereIn('law_id', Category::where('type', $this->convertValueTo($validated['category_id']))->get()->pluck('id'));
|
$query->whereIn('law_id', Category::where('type', $this->convertValueTo($validated['category_id']))->get()->pluck('id'));
|
||||||
}
|
}
|
||||||
@@ -289,7 +286,7 @@ class ArtController extends Controller
|
|||||||
'count_art' => $law->arts->count(),
|
'count_art' => $law->arts->count(),
|
||||||
'count_volums' => $law->volums->count(),
|
'count_volums' => $law->volums->count(),
|
||||||
'price' => $law->price,
|
'price' => $law->price,
|
||||||
'image' => $law->image
|
'image' => $law->image,
|
||||||
];
|
];
|
||||||
})->toArray();
|
})->toArray();
|
||||||
} else {
|
} else {
|
||||||
@@ -309,7 +306,7 @@ class ArtController extends Controller
|
|||||||
'is_locked' => auth()->user()->isSubscriber() !== false ? false : optional($law)->is_locked,
|
'is_locked' => auth()->user()->isSubscriber() !== false ? false : optional($law)->is_locked,
|
||||||
'route' => array_values($this->route($modelClass, $item)),
|
'route' => array_values($this->route($modelClass, $item)),
|
||||||
'category' => optional($law?->category)?->name ?? '',
|
'category' => optional($law?->category)?->name ?? '',
|
||||||
'image' => $law->image
|
'image' => $law->image,
|
||||||
];
|
];
|
||||||
} elseif ((new $modelClass)->getTable() == 'art') {
|
} elseif ((new $modelClass)->getTable() == 'art') {
|
||||||
return [
|
return [
|
||||||
@@ -320,7 +317,7 @@ class ArtController extends Controller
|
|||||||
'is_locked' => auth()->user()->isSubscriber() !== false ? false : optional($law)->is_locked,
|
'is_locked' => auth()->user()->isSubscriber() !== false ? false : optional($law)->is_locked,
|
||||||
'route' => array_values($this->route($modelClass, $item)),
|
'route' => array_values($this->route($modelClass, $item)),
|
||||||
'law' => $law?->title ?? '',
|
'law' => $law?->title ?? '',
|
||||||
'image' => $law->image
|
'image' => $law->image,
|
||||||
];
|
];
|
||||||
} else {
|
} else {
|
||||||
return [
|
return [
|
||||||
@@ -336,8 +333,6 @@ class ArtController extends Controller
|
|||||||
})->toArray();
|
})->toArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private function route($modelClass, $query)
|
private function route($modelClass, $query)
|
||||||
{
|
{
|
||||||
if ((new $modelClass)->getTable() == 'art') {
|
if ((new $modelClass)->getTable() == 'art') {
|
||||||
@@ -350,12 +345,14 @@ class ArtController extends Controller
|
|||||||
Chapter::find($query->chapter_id)?->title,
|
Chapter::find($query->chapter_id)?->title,
|
||||||
Part::find($query->part_id)?->title,
|
Part::find($query->part_id)?->title,
|
||||||
Gate::find($query->gate_id)?->title,
|
Gate::find($query->gate_id)?->title,
|
||||||
Branch::find($query->branch_id)?->title
|
Branch::find($query->branch_id)?->title,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$route = array_values($route);
|
$route = array_values($route);
|
||||||
|
|
||||||
return $route;
|
return $route;
|
||||||
}
|
}
|
||||||
|
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -365,7 +362,7 @@ class ArtController extends Controller
|
|||||||
|
|
||||||
$models = [
|
$models = [
|
||||||
Law::class,
|
Law::class,
|
||||||
Art::class
|
Art::class,
|
||||||
];
|
];
|
||||||
|
|
||||||
$results = [];
|
$results = [];
|
||||||
@@ -374,7 +371,6 @@ class ArtController extends Controller
|
|||||||
$results = array_merge($results, $this->searchModelFastSearch($modelClass, $search));
|
$results = array_merge($results, $this->searchModelFastSearch($modelClass, $search));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$models_other = [
|
$models_other = [
|
||||||
Volum::class,
|
Volum::class,
|
||||||
Book::class,
|
Book::class,
|
||||||
@@ -394,7 +390,6 @@ class ArtController extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$models = [
|
$models = [
|
||||||
Law::class,
|
Law::class,
|
||||||
Volum::class,
|
Volum::class,
|
||||||
@@ -405,7 +400,7 @@ class ArtController extends Controller
|
|||||||
Part::class,
|
Part::class,
|
||||||
Gate::class,
|
Gate::class,
|
||||||
Branch::class,
|
Branch::class,
|
||||||
Art::class
|
Art::class,
|
||||||
];
|
];
|
||||||
|
|
||||||
$count_all = 0;
|
$count_all = 0;
|
||||||
@@ -414,7 +409,6 @@ class ArtController extends Controller
|
|||||||
$count_all += count($this->searchModel($modelClass, $search));
|
$count_all += count($this->searchModel($modelClass, $search));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return $this->success(['items' => $results, 'count' => $count_all]);
|
return $this->success(['items' => $results, 'count' => $count_all]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -449,7 +443,7 @@ class ArtController extends Controller
|
|||||||
'title' => $q->title,
|
'title' => $q->title,
|
||||||
'type' => $table === 'section' ? 'sections' : $table,
|
'type' => $table === 'section' ? 'sections' : $table,
|
||||||
'category' => $category,
|
'category' => $category,
|
||||||
'law' => Law::where('id', $q->law_id)->first()?->title
|
'law' => Law::where('id', $q->law_id)->first()?->title,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -458,7 +452,7 @@ class ArtController extends Controller
|
|||||||
'title' => $q->title,
|
'title' => $q->title,
|
||||||
'type' => $table === 'section' ? 'sections' : $table,
|
'type' => $table === 'section' ? 'sections' : $table,
|
||||||
'category' => $category,
|
'category' => $category,
|
||||||
'image' => Law::where('id', $q->id)->first()?->image
|
'image' => Law::where('id', $q->id)->first()?->image,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -474,7 +468,7 @@ class ArtController extends Controller
|
|||||||
Chapter::find($q->chapter_id)?->title,
|
Chapter::find($q->chapter_id)?->title,
|
||||||
Part::find($q->part_id)?->title,
|
Part::find($q->part_id)?->title,
|
||||||
Gate::find($q->gate_id)?->title,
|
Gate::find($q->gate_id)?->title,
|
||||||
Branch::find($q->branch_id)?->title
|
Branch::find($q->branch_id)?->title,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$text = $q->text;
|
$text = $q->text;
|
||||||
@@ -499,7 +493,7 @@ class ArtController extends Controller
|
|||||||
'count_art' => $law->arts->count(),
|
'count_art' => $law->arts->count(),
|
||||||
'count_volum' => $law->volums->count(),
|
'count_volum' => $law->volums->count(),
|
||||||
'price' => $law->price,
|
'price' => $law->price,
|
||||||
'image' => $law->image
|
'image' => $law->image,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ use App\Http\Controllers\Controller;
|
|||||||
use App\Http\Requests\BookRequest;
|
use App\Http\Requests\BookRequest;
|
||||||
use App\Models\Book;
|
use App\Models\Book;
|
||||||
use App\Models\Law;
|
use App\Models\Law;
|
||||||
use App\Models\Order;
|
|
||||||
use App\Traits\BaseApiResponse;
|
use App\Traits\BaseApiResponse;
|
||||||
|
|
||||||
class BookController extends Controller
|
class BookController extends Controller
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ class CategoriesController extends Controller
|
|||||||
|
|
||||||
$categories = Category::paginate($perPage, ['*'], 'page', $page);
|
$categories = Category::paginate($perPage, ['*'], 'page', $page);
|
||||||
|
|
||||||
|
|
||||||
return $this->success($categories->items());
|
return $this->success($categories->items());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ use App\Http\Controllers\Controller;
|
|||||||
use App\Http\Requests\ChapterRequest;
|
use App\Http\Requests\ChapterRequest;
|
||||||
use App\Models\Chapter;
|
use App\Models\Chapter;
|
||||||
use App\Models\Law;
|
use App\Models\Law;
|
||||||
use App\Models\Order;
|
|
||||||
use App\Traits\BaseApiResponse;
|
use App\Traits\BaseApiResponse;
|
||||||
|
|
||||||
class ChapterController extends Controller
|
class ChapterController extends Controller
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ namespace App\Http\Controllers\api;
|
|||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Models\Folder;
|
use App\Models\Folder;
|
||||||
use App\Models\FolderArt;
|
use App\Models\FolderArt;
|
||||||
use App\Models\Law;
|
|
||||||
use App\Traits\BaseApiResponse;
|
use App\Traits\BaseApiResponse;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
@@ -18,26 +17,25 @@ class FolderController extends Controller
|
|||||||
$folder = Folder::query()->where('user_id', auth()->id())->get()
|
$folder = Folder::query()->where('user_id', auth()->id())->get()
|
||||||
->map(function ($q) {
|
->map(function ($q) {
|
||||||
return [
|
return [
|
||||||
"id" => $q->id,
|
'id' => $q->id,
|
||||||
"name" => $q->name,
|
'name' => $q->name,
|
||||||
"count_of_arts" => $q->arts->count(),
|
'count_of_arts' => $q->arts->count(),
|
||||||
"created_at" => $q->created_at,
|
'created_at' => $q->created_at,
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
return $this->success($folder);
|
return $this->success($folder);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function create(Request $request)
|
public function create(Request $request)
|
||||||
{
|
{
|
||||||
$validted = $request->validate([
|
$validted = $request->validate([
|
||||||
'name' => 'required'
|
'name' => 'required',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
Folder::create([
|
Folder::create([
|
||||||
'user_id' => auth()->user()->id,
|
'user_id' => auth()->user()->id,
|
||||||
'name' => $validted['name']
|
'name' => $validted['name'],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return $this->success([], 'ایجاد شد', 'پوشه با موفقیت ایجاد شد.');
|
return $this->success([], 'ایجاد شد', 'پوشه با موفقیت ایجاد شد.');
|
||||||
@@ -47,7 +45,7 @@ class FolderController extends Controller
|
|||||||
{
|
{
|
||||||
$validted = $request->validate([
|
$validted = $request->validate([
|
||||||
'folder_id' => 'required',
|
'folder_id' => 'required',
|
||||||
'art_id' => 'required'
|
'art_id' => 'required',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if (Folder::query()->where('id', $validted['folder_id'])->count() == 0) {
|
if (Folder::query()->where('id', $validted['folder_id'])->count() == 0) {
|
||||||
@@ -60,7 +58,7 @@ class FolderController extends Controller
|
|||||||
|
|
||||||
FolderArt::create([
|
FolderArt::create([
|
||||||
'folder_id' => $validted['folder_id'],
|
'folder_id' => $validted['folder_id'],
|
||||||
'art_id' => $validted['art_id']
|
'art_id' => $validted['art_id'],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return $this->success([], 'اضافه شد', 'ارت با موفیت اضافه شد');
|
return $this->success([], 'اضافه شد', 'ارت با موفیت اضافه شد');
|
||||||
@@ -138,6 +136,7 @@ class FolderController extends Controller
|
|||||||
return $this->failed('پوشه یافت نشد', 'پوشه مورد نظر یافت نشد', 404);
|
return $this->failed('پوشه یافت نشد', 'پوشه مورد نظر یافت نشد', 404);
|
||||||
}
|
}
|
||||||
Folder::query()->where('id', $id)->delete();
|
Folder::query()->where('id', $id)->delete();
|
||||||
|
|
||||||
return $this->success([], 'حذف شد', 'پوشه با موفقیت حذف شد');
|
return $this->success([], 'حذف شد', 'پوشه با موفقیت حذف شد');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -147,6 +146,7 @@ class FolderController extends Controller
|
|||||||
return $this->failed([], 'ارت مورد نظر یافت نشد', 404);
|
return $this->failed([], 'ارت مورد نظر یافت نشد', 404);
|
||||||
}
|
}
|
||||||
FolderArt::query()->where('folder_id', $id)->where('art_id', $art_id)->delete();
|
FolderArt::query()->where('folder_id', $id)->where('art_id', $art_id)->delete();
|
||||||
|
|
||||||
return $this->success([], 'حذف شد', 'ارت با موفقیت حذف شد');
|
return $this->success([], 'حذف شد', 'ارت با موفقیت حذف شد');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,9 +6,7 @@ use App\Http\Controllers\Controller;
|
|||||||
use App\Http\Requests\ChapterRequest;
|
use App\Http\Requests\ChapterRequest;
|
||||||
use App\Models\Gate;
|
use App\Models\Gate;
|
||||||
use App\Models\Law;
|
use App\Models\Law;
|
||||||
use App\Models\Order;
|
|
||||||
use App\Traits\BaseApiResponse;
|
use App\Traits\BaseApiResponse;
|
||||||
use Illuminate\Http\Request;
|
|
||||||
|
|
||||||
class GateController extends Controller
|
class GateController extends Controller
|
||||||
{
|
{
|
||||||
@@ -30,8 +28,6 @@ class GateController extends Controller
|
|||||||
return $gate;
|
return $gate;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return $this->success($gates->items());
|
return $this->success($gates->items());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ class HomeController extends Controller
|
|||||||
return [
|
return [
|
||||||
'id' => $q->law?->id,
|
'id' => $q->law?->id,
|
||||||
'name' => $q->law?->title,
|
'name' => $q->law?->title,
|
||||||
'is_locked' => $q->law?->is_locked
|
'is_locked' => $q->law?->is_locked,
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -37,7 +37,7 @@ class HomeController extends Controller
|
|||||||
return [
|
return [
|
||||||
'id' => $q->id,
|
'id' => $q->id,
|
||||||
'name' => $q->title,
|
'name' => $q->title,
|
||||||
'is_locked' => $q->is_locked
|
'is_locked' => $q->is_locked,
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -49,13 +49,13 @@ class HomeController extends Controller
|
|||||||
$q->where('type', $category);
|
$q->where('type', $category);
|
||||||
})->get()->map(function ($q) {
|
})->get()->map(function ($q) {
|
||||||
return [
|
return [
|
||||||
"id" => $q->id,
|
'id' => $q->id,
|
||||||
"title" => $q->title,
|
'title' => $q->title,
|
||||||
"is_locked" => $q->is_locked,
|
'is_locked' => $q->is_locked,
|
||||||
"category_id" => $q->category_id,
|
'category_id' => $q->category_id,
|
||||||
"price" => $q->price,
|
'price' => $q->price,
|
||||||
"image" => $q->image,
|
'image' => $q->image,
|
||||||
"type" => 'law'
|
'type' => 'law',
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -64,7 +64,7 @@ class HomeController extends Controller
|
|||||||
return [
|
return [
|
||||||
'id' => $q->id,
|
'id' => $q->id,
|
||||||
'name' => $q->title,
|
'name' => $q->title,
|
||||||
'is_locked' => $q->is_locked
|
'is_locked' => $q->is_locked,
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -83,7 +83,7 @@ class HomeController extends Controller
|
|||||||
'name' => $freeSubscription->subscribe->name,
|
'name' => $freeSubscription->subscribe->name,
|
||||||
'price' => $freeSubscription->subscribe->price,
|
'price' => $freeSubscription->subscribe->price,
|
||||||
'expired_day' => $freeSubscription->expired_at->diffInDays(now()),
|
'expired_day' => $freeSubscription->expired_at->diffInDays(now()),
|
||||||
'is_free' => true
|
'is_free' => true,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,7 +92,9 @@ class HomeController extends Controller
|
|||||||
->latest('expired_at')
|
->latest('expired_at')
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
$expiredDays = UserSubscriber::query()->where('user_id', $user->id)->where('expired_at', '>=', now())->get()->sum(function ($subscriber) {return $subscriber->expired_at->diffInDays(now());});
|
$expiredDays = UserSubscriber::query()->where('user_id', $user->id)->where('expired_at', '>=', now())->get()->sum(function ($subscriber) {
|
||||||
|
return $subscriber->expired_at->diffInDays(now());
|
||||||
|
});
|
||||||
|
|
||||||
if ($latestSubscription) {
|
if ($latestSubscription) {
|
||||||
$current_plan = [
|
$current_plan = [
|
||||||
@@ -100,7 +102,7 @@ class HomeController extends Controller
|
|||||||
'name' => $latestSubscription->subscribe->name ?? 'Subscription',
|
'name' => $latestSubscription->subscribe->name ?? 'Subscription',
|
||||||
'price' => $latestSubscription->subscribe->price ?? 100,
|
'price' => $latestSubscription->subscribe->price ?? 100,
|
||||||
'expired_day' => $expiredDays,
|
'expired_day' => $expiredDays,
|
||||||
'is_free' => (bool) $latestSubscription->is_free
|
'is_free' => (bool) $latestSubscription->is_free,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ class NoteController extends Controller
|
|||||||
$validated = $request->validate([
|
$validated = $request->validate([
|
||||||
'art_id' => 'required',
|
'art_id' => 'required',
|
||||||
'note' => 'required',
|
'note' => 'required',
|
||||||
'color_code' => 'nullable'
|
'color_code' => 'nullable',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
Note::query()->create(
|
Note::query()->create(
|
||||||
@@ -36,7 +36,7 @@ class NoteController extends Controller
|
|||||||
{
|
{
|
||||||
$validated = $request->validate([
|
$validated = $request->validate([
|
||||||
'note' => 'required',
|
'note' => 'required',
|
||||||
'color_code' => 'nullable'
|
'color_code' => 'nullable',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$note = Note::findOrFail($id);
|
$note = Note::findOrFail($id);
|
||||||
|
|||||||
@@ -5,10 +5,8 @@ namespace App\Http\Controllers\api;
|
|||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Http\Requests\ChapterRequest;
|
use App\Http\Requests\ChapterRequest;
|
||||||
use App\Models\Law;
|
use App\Models\Law;
|
||||||
use App\Models\Order;
|
|
||||||
use App\Models\Part;
|
use App\Models\Part;
|
||||||
use App\Traits\BaseApiResponse;
|
use App\Traits\BaseApiResponse;
|
||||||
use Illuminate\Http\Request;
|
|
||||||
|
|
||||||
class PartController extends Controller
|
class PartController extends Controller
|
||||||
{
|
{
|
||||||
@@ -32,7 +30,6 @@ class PartController extends Controller
|
|||||||
return $part;
|
return $part;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
return $this->success($parts->items());
|
return $this->success($parts->items());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
namespace App\Http\Controllers\api;
|
namespace App\Http\Controllers\api;
|
||||||
|
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Models\Order;
|
|
||||||
use App\Models\PaymentTransaction;
|
use App\Models\PaymentTransaction;
|
||||||
use App\Models\SubscribePlan;
|
use App\Models\SubscribePlan;
|
||||||
use App\Models\UserSubscriber;
|
use App\Models\UserSubscriber;
|
||||||
@@ -44,6 +43,7 @@ class PayController extends Controller
|
|||||||
return $this->success(['url' => $payment]);
|
return $this->success(['url' => $payment]);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Log::error('Payment initiation failed: '.$e->getMessage());
|
Log::error('Payment initiation failed: '.$e->getMessage());
|
||||||
|
|
||||||
return $this->failed('Payment initialization failed', $e->getMessage());
|
return $this->failed('Payment initialization failed', $e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -78,20 +78,21 @@ class PayController extends Controller
|
|||||||
return $this->failed([], ['title' => 'Payment Failed', 'message' => 'Payment verification failed.']);
|
return $this->failed([], ['title' => 'Payment Failed', 'message' => 'Payment verification failed.']);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Log::info('error in callback function', ['error' => $e->getMessage()]);
|
Log::info('error in callback function', ['error' => $e->getMessage()]);
|
||||||
|
|
||||||
return $this->failed([], ['title' => 'Payment Failed', 'message' => 'Payment verification failed.']);
|
return $this->failed([], ['title' => 'Payment Failed', 'message' => 'Payment verification failed.']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private function send($url, $api, $amount, $redirect, $factorId, $name, $email, $description)
|
private function send($url, $api, $amount, $redirect, $factorId, $name, $email, $description)
|
||||||
{
|
{
|
||||||
$ch = curl_init();
|
$ch = curl_init();
|
||||||
curl_setopt($ch, CURLOPT_URL, $url);
|
curl_setopt($ch, CURLOPT_URL, $url);
|
||||||
curl_setopt($ch, CURLOPT_POSTFIELDS, "api=$api&amount=$amount&redirect=$redirect&factorId=$factorId&name=$name&email=$email&description=$description");
|
curl_setopt($ch, CURLOPT_POSTFIELDS, "api=$api&amount=$amount&redirect=$redirect&factorId=$factorId&name=$name&email=$email&description=$description");
|
||||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
|
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||||
$res = curl_exec($ch);
|
$res = curl_exec($ch);
|
||||||
curl_close($ch);
|
curl_close($ch);
|
||||||
|
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -100,10 +101,11 @@ class PayController extends Controller
|
|||||||
$ch = curl_init();
|
$ch = curl_init();
|
||||||
curl_setopt($ch, CURLOPT_URL, $url);
|
curl_setopt($ch, CURLOPT_URL, $url);
|
||||||
curl_setopt($ch, CURLOPT_POSTFIELDS, "api=$api&id_get=$id_get&trans_id=$trans_id&json=1");
|
curl_setopt($ch, CURLOPT_POSTFIELDS, "api=$api&id_get=$id_get&trans_id=$trans_id&json=1");
|
||||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
|
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||||
$res = curl_exec($ch);
|
$res = curl_exec($ch);
|
||||||
curl_close($ch);
|
curl_close($ch);
|
||||||
|
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ use App\Http\Controllers\Controller;
|
|||||||
use App\Http\Requests\SectionRequest;
|
use App\Http\Requests\SectionRequest;
|
||||||
use App\Models\Law;
|
use App\Models\Law;
|
||||||
use App\Models\LikeSection;
|
use App\Models\LikeSection;
|
||||||
use App\Models\Order;
|
|
||||||
use App\Models\Section;
|
use App\Models\Section;
|
||||||
use App\Traits\BaseApiResponse;
|
use App\Traits\BaseApiResponse;
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ class SubscribePlanController extends Controller
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'id' => $q->id,
|
'id' => $q->id,
|
||||||
'name' => $q->name,
|
'name' => $q->name,
|
||||||
@@ -37,7 +38,7 @@ class SubscribePlanController extends Controller
|
|||||||
'expired_day' => $q->expired_day,
|
'expired_day' => $q->expired_day,
|
||||||
'is_free' => $q->is_free == 1 ? true : false,
|
'is_free' => $q->is_free == 1 ? true : false,
|
||||||
'type' => $q->type,
|
'type' => $q->type,
|
||||||
'transaction' => $q->transaction
|
'transaction' => $q->transaction,
|
||||||
|
|
||||||
];
|
];
|
||||||
})->filter(function ($q) {
|
})->filter(function ($q) {
|
||||||
@@ -103,6 +104,7 @@ class SubscribePlanController extends Controller
|
|||||||
return $this->success(['url' => $payment]);
|
return $this->success(['url' => $payment]);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Log::error('Payment initiation failed: '.$e->getMessage());
|
Log::error('Payment initiation failed: '.$e->getMessage());
|
||||||
|
|
||||||
return $this->failed(null, 'درگاه پرداخت در دسترس نیست');
|
return $this->failed(null, 'درگاه پرداخت در دسترس نیست');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -112,7 +114,7 @@ class SubscribePlanController extends Controller
|
|||||||
$request->validate([
|
$request->validate([
|
||||||
'subscribe_plan_id' => 'required|exists:subscribe_plans,id',
|
'subscribe_plan_id' => 'required|exists:subscribe_plans,id',
|
||||||
'subscription_id' => 'nullable',
|
'subscription_id' => 'nullable',
|
||||||
'purchase_token' => 'nullable'
|
'purchase_token' => 'nullable',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$subscribePlan = SubscribePlan::findOrFail($request->subscribe_plan_id);
|
$subscribePlan = SubscribePlan::findOrFail($request->subscribe_plan_id);
|
||||||
@@ -139,7 +141,7 @@ class SubscribePlanController extends Controller
|
|||||||
$user->userSubscribers()->create([
|
$user->userSubscribers()->create([
|
||||||
'subscribe_plan_id' => $subscribePlan->id,
|
'subscribe_plan_id' => $subscribePlan->id,
|
||||||
'expired_at' => $expiredAt,
|
'expired_at' => $expiredAt,
|
||||||
'is_free' => true
|
'is_free' => true,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return $this->success(null, 'Subscribe Plan', 'Free Subscribe Plan Successfully Activated');
|
return $this->success(null, 'Subscribe Plan', 'Free Subscribe Plan Successfully Activated');
|
||||||
@@ -172,12 +174,13 @@ class SubscribePlanController extends Controller
|
|||||||
'purchase_token' => $purchase_token,
|
'purchase_token' => $purchase_token,
|
||||||
'market_provider' => 'bazaar',
|
'market_provider' => 'bazaar',
|
||||||
'last_verified_at' => now(),
|
'last_verified_at' => now(),
|
||||||
'is_free' => false
|
'is_free' => false,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return $this->success(null, 'Subscribe Plan', 'Subscription successfully activated.');
|
return $this->success(null, 'Subscribe Plan', 'Subscription successfully activated.');
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Log::error('Error in subscription', ['Error' => $e->getMessage()]);
|
Log::error('Error in subscription', ['Error' => $e->getMessage()]);
|
||||||
|
|
||||||
return $this->failed(null, ['title' => 'Subscribe Plan', 'message' => 'Failed to verify subscription.']);
|
return $this->failed(null, ['title' => 'Subscribe Plan', 'message' => 'Failed to verify subscription.']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -306,16 +309,16 @@ class SubscribePlanController extends Controller
|
|||||||
return $this->success(null, 'Subscribe Plan', 'No Subscribe Plan');
|
return $this->success(null, 'Subscribe Plan', 'No Subscribe Plan');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private function send($url, $api, $amount, $redirect, $factorId, $name, $email, $description)
|
private function send($url, $api, $amount, $redirect, $factorId, $name, $email, $description)
|
||||||
{
|
{
|
||||||
$ch = curl_init();
|
$ch = curl_init();
|
||||||
curl_setopt($ch, CURLOPT_URL, $url);
|
curl_setopt($ch, CURLOPT_URL, $url);
|
||||||
curl_setopt($ch, CURLOPT_POSTFIELDS, "api=$api&amount=$amount&redirect=$redirect&factorId=$factorId&name=$name&email=$email&description=$description");
|
curl_setopt($ch, CURLOPT_POSTFIELDS, "api=$api&amount=$amount&redirect=$redirect&factorId=$factorId&name=$name&email=$email&description=$description");
|
||||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
|
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||||
$res = curl_exec($ch);
|
$res = curl_exec($ch);
|
||||||
curl_close($ch);
|
curl_close($ch);
|
||||||
|
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -324,10 +327,11 @@ class SubscribePlanController extends Controller
|
|||||||
$ch = curl_init();
|
$ch = curl_init();
|
||||||
curl_setopt($ch, CURLOPT_URL, $url);
|
curl_setopt($ch, CURLOPT_URL, $url);
|
||||||
curl_setopt($ch, CURLOPT_POSTFIELDS, "api=$api&id_get=$id_get&trans_id=$trans_id&json=1");
|
curl_setopt($ch, CURLOPT_POSTFIELDS, "api=$api&id_get=$id_get&trans_id=$trans_id&json=1");
|
||||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
|
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||||
$res = curl_exec($ch);
|
$res = curl_exec($ch);
|
||||||
curl_close($ch);
|
curl_close($ch);
|
||||||
|
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,12 +21,12 @@ class VersionController extends Controller
|
|||||||
|
|
||||||
if (intval($version->number) > $versionRequest->number) {
|
if (intval($version->number) > $versionRequest->number) {
|
||||||
return $this->success([
|
return $this->success([
|
||||||
'force_update' => $version->force_update == 1 ? true : false
|
'force_update' => $version->force_update == 1 ? true : false,
|
||||||
], 'Your app need to be updated');
|
], 'Your app need to be updated');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->success([
|
return $this->success([
|
||||||
'force_update' => false
|
'force_update' => false,
|
||||||
], 'Version successfully');
|
], 'Version successfully');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ use App\Models\Chapter;
|
|||||||
use App\Models\Division;
|
use App\Models\Division;
|
||||||
use App\Models\Gate;
|
use App\Models\Gate;
|
||||||
use App\Models\Law;
|
use App\Models\Law;
|
||||||
use App\Models\Order;
|
|
||||||
use App\Models\Part;
|
use App\Models\Part;
|
||||||
use App\Models\RecentArt;
|
use App\Models\RecentArt;
|
||||||
use App\Models\Section;
|
use App\Models\Section;
|
||||||
@@ -79,7 +78,7 @@ class VolumController extends Controller
|
|||||||
'title' => $item->title,
|
'title' => $item->title,
|
||||||
'number' => $item->number,
|
'number' => $item->number,
|
||||||
'type' => $relation,
|
'type' => $relation,
|
||||||
'is_locked' => auth()->user()->isSubscriber() !== false ? false : Law::where('id', $item->law_id)->first()?->is_locked
|
'is_locked' => auth()->user()->isSubscriber() !== false ? false : Law::where('id', $item->law_id)->first()?->is_locked,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
$paginationData = [
|
$paginationData = [
|
||||||
@@ -104,7 +103,6 @@ class VolumController extends Controller
|
|||||||
return $this->success([], 'Division not found');
|
return $this->success([], 'Division not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$data = [];
|
$data = [];
|
||||||
$foundRelation = false;
|
$foundRelation = false;
|
||||||
foreach (['sections', 'chapters', 'parts', 'gate', 'branch', 'art'] as $relation) {
|
foreach (['sections', 'chapters', 'parts', 'gate', 'branch', 'art'] as $relation) {
|
||||||
@@ -117,7 +115,7 @@ class VolumController extends Controller
|
|||||||
'title' => $item->title,
|
'title' => $item->title,
|
||||||
'number' => $item->number,
|
'number' => $item->number,
|
||||||
'type' => $relation,
|
'type' => $relation,
|
||||||
'is_locked' => auth()->user()->isSubscriber() !== false ? false : Law::where('id', $item->law_id)->first()?->is_locked
|
'is_locked' => auth()->user()->isSubscriber() !== false ? false : Law::where('id', $item->law_id)->first()?->is_locked,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -151,7 +149,7 @@ class VolumController extends Controller
|
|||||||
'title' => $item->title,
|
'title' => $item->title,
|
||||||
'number' => $item->number,
|
'number' => $item->number,
|
||||||
'type' => $relation,
|
'type' => $relation,
|
||||||
'is_locked' => auth()->user()->isSubscriber() !== false ? false : Law::where('id', $item->law_id)->first()?->is_locked
|
'is_locked' => auth()->user()->isSubscriber() !== false ? false : Law::where('id', $item->law_id)->first()?->is_locked,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -184,7 +182,7 @@ class VolumController extends Controller
|
|||||||
'title' => $item->title,
|
'title' => $item->title,
|
||||||
'number' => $item->number,
|
'number' => $item->number,
|
||||||
'type' => $relation,
|
'type' => $relation,
|
||||||
'is_locked' => auth()->user()->isSubscriber() !== false ? false : Law::where('id', $item->law_id)->first()?->is_locked
|
'is_locked' => auth()->user()->isSubscriber() !== false ? false : Law::where('id', $item->law_id)->first()?->is_locked,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -218,7 +216,7 @@ class VolumController extends Controller
|
|||||||
'title' => $item->title,
|
'title' => $item->title,
|
||||||
'number' => $item->number,
|
'number' => $item->number,
|
||||||
'type' => $relation,
|
'type' => $relation,
|
||||||
'is_locked' => auth()->user()->isSubscriber() !== false ? false : Law::where('id', $item->law_id)->first()?->is_locked
|
'is_locked' => auth()->user()->isSubscriber() !== false ? false : Law::where('id', $item->law_id)->first()?->is_locked,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -252,7 +250,7 @@ class VolumController extends Controller
|
|||||||
'title' => $item->title,
|
'title' => $item->title,
|
||||||
'number' => $item->number,
|
'number' => $item->number,
|
||||||
'type' => $relation,
|
'type' => $relation,
|
||||||
'is_locked' => auth()->user()->isSubscriber() !== false ? false : Law::where('id', $item->law_id)->first()?->is_locked
|
'is_locked' => auth()->user()->isSubscriber() !== false ? false : Law::where('id', $item->law_id)->first()?->is_locked,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -286,7 +284,7 @@ class VolumController extends Controller
|
|||||||
'title' => $item->title,
|
'title' => $item->title,
|
||||||
'number' => $item->number,
|
'number' => $item->number,
|
||||||
'type' => $relation,
|
'type' => $relation,
|
||||||
'is_locked' => auth()->user()->isSubscriber() !== false ? false : Law::where('id', $item->law_id)->first()?->is_locked
|
'is_locked' => auth()->user()->isSubscriber() !== false ? false : Law::where('id', $item->law_id)->first()?->is_locked,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -300,7 +298,6 @@ class VolumController extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ($gate_id) {
|
if ($gate_id) {
|
||||||
$gate = Gate::with(['branch', 'art'])
|
$gate = Gate::with(['branch', 'art'])
|
||||||
->find($gate_id);
|
->find($gate_id);
|
||||||
@@ -321,7 +318,7 @@ class VolumController extends Controller
|
|||||||
'title' => $item->title,
|
'title' => $item->title,
|
||||||
'number' => $item->number,
|
'number' => $item->number,
|
||||||
'type' => $relation,
|
'type' => $relation,
|
||||||
'is_locked' => auth()->user()->isSubscriber() !== false ? false : Law::where('id', $item->law_id)->first()?->is_locked
|
'is_locked' => auth()->user()->isSubscriber() !== false ? false : Law::where('id', $item->law_id)->first()?->is_locked,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -355,7 +352,7 @@ class VolumController extends Controller
|
|||||||
'title' => $item->title,
|
'title' => $item->title,
|
||||||
'number' => $item->number,
|
'number' => $item->number,
|
||||||
'type' => $relation,
|
'type' => $relation,
|
||||||
'is_locked' => auth()->user()->isSubscriber() !== false ? false : Law::where('id', $item->law_id)->first()?->is_locked
|
'is_locked' => auth()->user()->isSubscriber() !== false ? false : Law::where('id', $item->law_id)->first()?->is_locked,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -380,16 +377,14 @@ class VolumController extends Controller
|
|||||||
->where('law_id', $law->id)
|
->where('law_id', $law->id)
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
|
|
||||||
RecentArt::query()->updateOrCreate([
|
RecentArt::query()->updateOrCreate([
|
||||||
'user_id' => auth()->user()->id,
|
'user_id' => auth()->user()->id,
|
||||||
'law_id' => $law_Id
|
'law_id' => $law_Id,
|
||||||
], [
|
], [
|
||||||
'user_id' => auth()->user()->id,
|
'user_id' => auth()->user()->id,
|
||||||
'law_id' => $law_Id
|
'law_id' => $law_Id,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
||||||
$data = [];
|
$data = [];
|
||||||
|
|
||||||
if (count($arts) > 0) {
|
if (count($arts) > 0) {
|
||||||
@@ -399,9 +394,10 @@ class VolumController extends Controller
|
|||||||
'title' => $item->title,
|
'title' => $item->title,
|
||||||
'number' => $item->number,
|
'number' => $item->number,
|
||||||
'type' => 'volume',
|
'type' => 'volume',
|
||||||
'is_locked' => auth()->user()->isSubscriber() !== false ? false : Law::where('id', $law->id)->first()?->is_locked
|
'is_locked' => auth()->user()->isSubscriber() !== false ? false : Law::where('id', $law->id)->first()?->is_locked,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->success($data, 'Success');
|
return $this->success($data, 'Success');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -423,9 +419,10 @@ class VolumController extends Controller
|
|||||||
'title' => $item->title,
|
'title' => $item->title,
|
||||||
'number' => $item->number,
|
'number' => $item->number,
|
||||||
'type' => 'art',
|
'type' => 'art',
|
||||||
'is_locked' => auth()->user()->isSubscriber() !== false ? false : Law::where('id', $law->id)->first()?->is_locked
|
'is_locked' => auth()->user()->isSubscriber() !== false ? false : Law::where('id', $law->id)->first()?->is_locked,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->success($data, 'Success');
|
return $this->success($data, 'Success');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -504,8 +501,8 @@ class VolumController extends Controller
|
|||||||
'foreign_key' => 'branch_id',
|
'foreign_key' => 'branch_id',
|
||||||
'type' => (new Art)->getTable(),
|
'type' => (new Art)->getTable(),
|
||||||
'check_mode' => Art::class,
|
'check_mode' => Art::class,
|
||||||
'check_key' => 'branch_id'
|
'check_key' => 'branch_id',
|
||||||
]
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
foreach ($filters as $filterKey => $filterInfo) {
|
foreach ($filters as $filterKey => $filterInfo) {
|
||||||
@@ -533,7 +530,7 @@ class VolumController extends Controller
|
|||||||
'title' => $item?->title,
|
'title' => $item?->title,
|
||||||
'number' => $item?->number,
|
'number' => $item?->number,
|
||||||
'type' => $type,
|
'type' => $type,
|
||||||
'is_end' => $check_model::where($check_key, $item?->id)->count() !== 0 ? false : true
|
'is_end' => $check_model::where($check_key, $item?->id)->count() !== 0 ? false : true,
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -544,7 +541,6 @@ class VolumController extends Controller
|
|||||||
return $this->success([], 'No law or book or volume specified');
|
return $this->success([], 'No law or book or volume specified');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function check_filter_with_art(CheckBookFilterRequest $request)
|
public function check_filter_with_art(CheckBookFilterRequest $request)
|
||||||
{
|
{
|
||||||
$lawId = $request->law_id;
|
$lawId = $request->law_id;
|
||||||
@@ -596,7 +592,6 @@ class VolumController extends Controller
|
|||||||
return $this->success([], 'No related records found in the law');
|
return $this->success([], 'No related records found in the law');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ($bookId) {
|
if ($bookId) {
|
||||||
$book = Book::with(['divisions', 'sections', 'gates', 'parts', 'chapters', 'branchs', 'art'])->find($bookId);
|
$book = Book::with(['divisions', 'sections', 'gates', 'parts', 'chapters', 'branchs', 'art'])->find($bookId);
|
||||||
if (! $book) {
|
if (! $book) {
|
||||||
@@ -712,7 +707,6 @@ class VolumController extends Controller
|
|||||||
return $this->success([], 'No valid filter specified');
|
return $this->success([], 'No valid filter specified');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private function prepareItemsData($items, $type)
|
private function prepareItemsData($items, $type)
|
||||||
{
|
{
|
||||||
$data = [];
|
$data = [];
|
||||||
@@ -732,6 +726,7 @@ class VolumController extends Controller
|
|||||||
'price' => $law?->price,
|
'price' => $law?->price,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -740,13 +735,14 @@ class VolumController extends Controller
|
|||||||
foreach ($relations as $relation) {
|
foreach ($relations as $relation) {
|
||||||
if ($model->{$relation} && $model->{$relation}->count() > 0) {
|
if ($model->{$relation} && $model->{$relation}->count() > 0) {
|
||||||
$items = $model->{$relation}()->paginate($perPage);
|
$items = $model->{$relation}()->paginate($perPage);
|
||||||
|
|
||||||
return $this->prepareItemsData($items, $relation);
|
return $this->prepareItemsData($items, $relation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private function convertValueTo($var)
|
private function convertValueTo($var)
|
||||||
{
|
{
|
||||||
switch ($var) {
|
switch ($var) {
|
||||||
@@ -769,13 +765,13 @@ class VolumController extends Controller
|
|||||||
switch ((new $modelClass)->getTable()) {
|
switch ((new $modelClass)->getTable()) {
|
||||||
case 'laws':
|
case 'laws':
|
||||||
$route = array_filter([
|
$route = array_filter([
|
||||||
Law::find($query->id)?->title
|
Law::find($query->id)?->title,
|
||||||
]);
|
]);
|
||||||
break;
|
break;
|
||||||
case 'volums':
|
case 'volums':
|
||||||
$route = array_filter([
|
$route = array_filter([
|
||||||
Law::find($query->law_id)?->title,
|
Law::find($query->law_id)?->title,
|
||||||
Volum::find($query->id)?->title
|
Volum::find($query->id)?->title,
|
||||||
]);
|
]);
|
||||||
break;
|
break;
|
||||||
case 'books':
|
case 'books':
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ class GetApiRequest extends FormRequest
|
|||||||
public function rules(): array
|
public function rules(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'book_id' => 'required'
|
'book_id' => 'required',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ class SuggestionRequest extends FormRequest
|
|||||||
public function rules(): array
|
public function rules(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'text' => 'required'
|
'text' => 'required',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ class CreateVersionStore extends FormRequest
|
|||||||
'number' => 'required',
|
'number' => 'required',
|
||||||
'log' => 'required',
|
'log' => 'required',
|
||||||
'force_update' => 'nullable',
|
'force_update' => 'nullable',
|
||||||
'type' => 'required'
|
'type' => 'required',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ class CreateRequest extends FormRequest
|
|||||||
'is_active' => 'nullable',
|
'is_active' => 'nullable',
|
||||||
'is_free' => 'nullable',
|
'is_free' => 'nullable',
|
||||||
'type' => 'nullable',
|
'type' => 'nullable',
|
||||||
'transaction' => 'nullable'
|
'transaction' => 'nullable',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ class UpdateRequest extends FormRequest
|
|||||||
'is_active' => 'nullable',
|
'is_active' => 'nullable',
|
||||||
'is_free' => 'nullable',
|
'is_free' => 'nullable',
|
||||||
'type' => 'nullable',
|
'type' => 'nullable',
|
||||||
'transaction' => 'nullable'
|
'transaction' => 'nullable',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ class UpdateVersionStore extends FormRequest
|
|||||||
'number' => 'required',
|
'number' => 'required',
|
||||||
'log' => 'required',
|
'log' => 'required',
|
||||||
'force_update' => 'nullable',
|
'force_update' => 'nullable',
|
||||||
'type' => 'required'
|
'type' => 'required',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,13 +3,13 @@
|
|||||||
namespace App\Jobs;
|
namespace App\Jobs;
|
||||||
|
|
||||||
// These are the classes we need to import for our job to work
|
// These are the classes we need to import for our job to work
|
||||||
|
use App\Models\UserSubscriber;
|
||||||
|
use Carbon\Carbon;
|
||||||
use Illuminate\Bus\Queueable;
|
use Illuminate\Bus\Queueable;
|
||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
use Illuminate\Foundation\Bus\Dispatchable;
|
use Illuminate\Foundation\Bus\Dispatchable;
|
||||||
use Illuminate\Queue\InteractsWithQueue;
|
use Illuminate\Queue\InteractsWithQueue; // Your model for tracking user subscriptions
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
use App\Models\UserSubscriber; // Your model for tracking user subscriptions
|
|
||||||
use Carbon\Carbon;
|
|
||||||
use Illuminate\Support\Facades\Http;
|
use Illuminate\Support\Facades\Http;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
@@ -42,6 +42,7 @@ class CheckBazaarSubscription implements ShouldQueue
|
|||||||
// If there's no purchase token, we can't do anything, so we stop.
|
// If there's no purchase token, we can't do anything, so we stop.
|
||||||
if (! $purchase_token) {
|
if (! $purchase_token) {
|
||||||
Log::info('Job skipped: No purchase token for UserSubscriber ID: '.$this->userSubscriber->id);
|
Log::info('Job skipped: No purchase token for UserSubscriber ID: '.$this->userSubscriber->id);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -48,7 +48,6 @@ class Book extends Model
|
|||||||
return $this->hasMany(Branch::class);
|
return $this->hasMany(Branch::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static function searchLimit($searchTerm)
|
public static function searchLimit($searchTerm)
|
||||||
{
|
{
|
||||||
return self::where('title', 'LIKE', "%{$searchTerm}%")->limit(3)->get();
|
return self::where('title', 'LIKE', "%{$searchTerm}%")->limit(3)->get();
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ class Branch extends Model
|
|||||||
|
|
||||||
protected $fillable = ['title', 'number', 'chapter_id', 'part_id', 'volum_id', 'law_id', 'book_id', 'section_id', 'gate_id', 'division_id'];
|
protected $fillable = ['title', 'number', 'chapter_id', 'part_id', 'volum_id', 'law_id', 'book_id', 'section_id', 'gate_id', 'division_id'];
|
||||||
|
|
||||||
|
|
||||||
public function art()
|
public function art()
|
||||||
{
|
{
|
||||||
return $this->hasMany(Art::class);
|
return $this->hasMany(Art::class);
|
||||||
|
|||||||
14
app/Models/BylawCodificationLink.php
Normal file
14
app/Models/BylawCodificationLink.php
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class BylawCodificationLink extends Model
|
||||||
|
{
|
||||||
|
protected $table = 'bylaw_codification_links';
|
||||||
|
|
||||||
|
public $timestamps = false;
|
||||||
|
|
||||||
|
protected $fillable = ['source_entity_type', 'source_entity_id', 'target_entity_type', 'target_entity_id', 'link_type', 'effective_date', 'justification', 'created_at'];
|
||||||
|
}
|
||||||
34
app/Models/BylawDocument.php
Normal file
34
app/Models/BylawDocument.php
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class BylawDocument extends Model
|
||||||
|
{
|
||||||
|
protected $table = 'bylaw_documents';
|
||||||
|
|
||||||
|
protected $fillable = ['title', 'category_id', 'approval_authority_id', 'approval_date', 'promulgation_authority_id', 'promulgation_date', 'promulgation_number', 'official_gazette_number', 'official_gazette_date', 'execution_date', 'bylaw_type', 'global_status', 'pdf_file_path', 'is_published', 'description'];
|
||||||
|
|
||||||
|
protected $casts = ['is_published' => 'boolean'];
|
||||||
|
|
||||||
|
public function category()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(BylawSubjectCategory::class, 'category_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function approvalAuthority()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(BylawLegalAuthority::class, 'approval_authority_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function promulgationAuthority()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(BylawLegalAuthority::class, 'promulgation_authority_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function nodes()
|
||||||
|
{
|
||||||
|
return $this->hasMany(BylawNode::class, 'document_id');
|
||||||
|
}
|
||||||
|
}
|
||||||
12
app/Models/BylawLegalAuthority.php
Normal file
12
app/Models/BylawLegalAuthority.php
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class BylawLegalAuthority extends Model
|
||||||
|
{
|
||||||
|
protected $table = 'bylaw_legal_authorities';
|
||||||
|
|
||||||
|
protected $fillable = ['name', 'authority_type', 'description'];
|
||||||
|
}
|
||||||
27
app/Models/BylawNode.php
Normal file
27
app/Models/BylawNode.php
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class BylawNode extends Model
|
||||||
|
{
|
||||||
|
protected $table = 'bylaw_nodes';
|
||||||
|
|
||||||
|
protected $fillable = ['document_id', 'parent_id', 'node_type_id', 'node_identifier', 'title', 'node_content', 'sort_order', 'valid_from', 'valid_to', 'node_status'];
|
||||||
|
|
||||||
|
public function document()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(BylawDocument::class, 'document_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function parent()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(self::class, 'parent_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function type()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(BylawNodeType::class, 'node_type_id');
|
||||||
|
}
|
||||||
|
}
|
||||||
12
app/Models/BylawNodeType.php
Normal file
12
app/Models/BylawNodeType.php
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class BylawNodeType extends Model
|
||||||
|
{
|
||||||
|
protected $table = 'bylaw_node_types';
|
||||||
|
|
||||||
|
protected $fillable = ['name', 'hierarchy_level'];
|
||||||
|
}
|
||||||
17
app/Models/BylawSubjectCategory.php
Normal file
17
app/Models/BylawSubjectCategory.php
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class BylawSubjectCategory extends Model
|
||||||
|
{
|
||||||
|
protected $table = 'bylaw_subject_categories';
|
||||||
|
|
||||||
|
protected $fillable = ['parent_id', 'name', 'slug', 'sort_order'];
|
||||||
|
|
||||||
|
public function parent()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(self::class, 'parent_id');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -11,22 +11,19 @@ class Category extends Model
|
|||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'name',
|
'name',
|
||||||
'type'
|
'type',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function laws()
|
public function laws()
|
||||||
{
|
{
|
||||||
return $this->hasMany(Law::class);
|
return $this->hasMany(Law::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static function getType()
|
public static function getType()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'hagigi' => 'حقیقی',
|
'hagigi' => 'حقیقی',
|
||||||
'kifari' => 'کیفری'
|
'kifari' => 'کیفری',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ class Chapter extends Model
|
|||||||
return $this->hasMany(Gate::class);
|
return $this->hasMany(Gate::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function branch()
|
public function branch()
|
||||||
{
|
{
|
||||||
return $this->hasMany(Branch::class);
|
return $this->hasMany(Branch::class);
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ class Division extends Model
|
|||||||
|
|
||||||
protected $fillable = ['title', 'number', 'book_id', 'volum_id', 'law_id'];
|
protected $fillable = ['title', 'number', 'book_id', 'volum_id', 'law_id'];
|
||||||
|
|
||||||
|
|
||||||
public function sections()
|
public function sections()
|
||||||
{
|
{
|
||||||
return $this->hasMany(Section::class);
|
return $this->hasMany(Section::class);
|
||||||
@@ -47,7 +46,6 @@ class Division extends Model
|
|||||||
return $this->hasMany(Art::class);
|
return $this->hasMany(Art::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function gates()
|
public function gates()
|
||||||
{
|
{
|
||||||
return $this->hasMany(Gate::class);
|
return $this->hasMany(Gate::class);
|
||||||
@@ -67,5 +65,4 @@ class Division extends Model
|
|||||||
{
|
{
|
||||||
return self::where('title', 'LIKE', "%{$searchTerm}%")->limit(3)->get();
|
return self::where('title', 'LIKE', "%{$searchTerm}%")->limit(3)->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ class Folder extends Model
|
|||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'user_id',
|
'user_id',
|
||||||
'name'
|
'name',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function arts()
|
public function arts()
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ class FolderArt extends Model
|
|||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'folder_id',
|
'folder_id',
|
||||||
'art_id'
|
'art_id',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function arts()
|
public function arts()
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ class Gate extends Model
|
|||||||
return $this->hasMany(Branch::class);
|
return $this->hasMany(Branch::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function art()
|
public function art()
|
||||||
{
|
{
|
||||||
return $this->hasMany(Art::class);
|
return $this->hasMany(Art::class);
|
||||||
@@ -38,6 +37,4 @@ class Gate extends Model
|
|||||||
{
|
{
|
||||||
return self::where('title', 'LIKE', "%{$searchTerm}%")->limit(3)->get();
|
return self::where('title', 'LIKE', "%{$searchTerm}%")->limit(3)->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ class JudicialPrecedent extends Model
|
|||||||
'subject',
|
'subject',
|
||||||
'full_text',
|
'full_text',
|
||||||
'issuing_authority',
|
'issuing_authority',
|
||||||
'category_id'
|
'category_id',
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $hidden = ['created_at', 'updated_at'];
|
protected $hidden = ['created_at', 'updated_at'];
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ class Law extends Model
|
|||||||
|
|
||||||
protected $hidden = ['created_at', 'updated_at'];
|
protected $hidden = ['created_at', 'updated_at'];
|
||||||
|
|
||||||
|
|
||||||
public function category()
|
public function category()
|
||||||
{
|
{
|
||||||
return $this->belongsTo(Category::class, 'category_id');
|
return $this->belongsTo(Category::class, 'category_id');
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ class LikeArt extends Model
|
|||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'user_id',
|
'user_id',
|
||||||
'art_id'
|
'art_id',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function art()
|
public function art()
|
||||||
|
|||||||
@@ -11,6 +11,6 @@ class LikeSection extends Model
|
|||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'section_id',
|
'section_id',
|
||||||
'user_id'
|
'user_id',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,6 @@ class Note extends Model
|
|||||||
'user_id',
|
'user_id',
|
||||||
'art_id',
|
'art_id',
|
||||||
'note',
|
'note',
|
||||||
'color_code'
|
'color_code',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ class Order extends Model
|
|||||||
'transaction_id',
|
'transaction_id',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
public function user()
|
public function user()
|
||||||
{
|
{
|
||||||
return $this->belongsTo(User::class);
|
return $this->belongsTo(User::class);
|
||||||
@@ -26,7 +25,7 @@ class Order extends Model
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'paid' => 'پرداخت شده',
|
'paid' => 'پرداخت شده',
|
||||||
'unpaid' => 'پرداخت نشده'
|
'unpaid' => 'پرداخت نشده',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ class Part extends Model
|
|||||||
|
|
||||||
protected $hidden = ['created_at', 'updated_at'];
|
protected $hidden = ['created_at', 'updated_at'];
|
||||||
|
|
||||||
|
|
||||||
public function gates()
|
public function gates()
|
||||||
{
|
{
|
||||||
return $this->hasMany(Gate::class);
|
return $this->hasMany(Gate::class);
|
||||||
@@ -34,7 +33,6 @@ class Part extends Model
|
|||||||
return self::where('title', 'LIKE', "%{$searchTerm}%")->get();
|
return self::where('title', 'LIKE', "%{$searchTerm}%")->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static function searchLimit($searchTerm)
|
public static function searchLimit($searchTerm)
|
||||||
{
|
{
|
||||||
return self::where('title', 'LIKE', "%{$searchTerm}%")->limit(3)->get();
|
return self::where('title', 'LIKE', "%{$searchTerm}%")->limit(3)->get();
|
||||||
|
|||||||
@@ -11,10 +11,9 @@ class RecentArt extends Model
|
|||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'user_id',
|
'user_id',
|
||||||
'law_id'
|
'law_id',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
public function law()
|
public function law()
|
||||||
{
|
{
|
||||||
return $this->belongsTo(Law::class);
|
return $this->belongsTo(Law::class);
|
||||||
|
|||||||
@@ -48,16 +48,13 @@ class Section extends Model
|
|||||||
return $this->hasMany(Art::class);
|
return $this->hasMany(Art::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static function search($searchTerm)
|
public static function search($searchTerm)
|
||||||
{
|
{
|
||||||
return self::where('title', 'LIKE', "%{$searchTerm}%")->get();
|
return self::where('title', 'LIKE', "%{$searchTerm}%")->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static function searchLimit($searchTerm)
|
public static function searchLimit($searchTerm)
|
||||||
{
|
{
|
||||||
return self::where('title', 'LIKE', "%{$searchTerm}%")->limit(3)->get();
|
return self::where('title', 'LIKE', "%{$searchTerm}%")->limit(3)->get();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ class SubscribePlan extends Model
|
|||||||
'is_active',
|
'is_active',
|
||||||
'is_free',
|
'is_free',
|
||||||
'type',
|
'type',
|
||||||
'transaction'
|
'transaction',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function users()
|
public function users()
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ class Suggestion extends Model
|
|||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'user_id',
|
'user_id',
|
||||||
'text'
|
'text',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function user()
|
public function user()
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ class UserSubscriber extends Model
|
|||||||
'product_id',
|
'product_id',
|
||||||
'purchased_at',
|
'purchased_at',
|
||||||
'last_verified_at',
|
'last_verified_at',
|
||||||
'is_free'
|
'is_free',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function subscribe()
|
public function subscribe()
|
||||||
|
|||||||
@@ -14,10 +14,9 @@ class Version extends Model
|
|||||||
'number',
|
'number',
|
||||||
'log',
|
'log',
|
||||||
'force_update',
|
'force_update',
|
||||||
'type'
|
'type',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
protected $hidden = [
|
protected $hidden = [
|
||||||
'created_at',
|
'created_at',
|
||||||
'updated_at',
|
'updated_at',
|
||||||
|
|||||||
@@ -17,10 +17,12 @@ class Volum extends Model
|
|||||||
{
|
{
|
||||||
return $this->belongsTo(Law::class);
|
return $this->belongsTo(Law::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function book()
|
public function book()
|
||||||
{
|
{
|
||||||
return $this->hasMany(Book::class);
|
return $this->hasMany(Book::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function sections()
|
public function sections()
|
||||||
{
|
{
|
||||||
return $this->hasMany(Section::class);
|
return $this->hasMany(Section::class);
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ class AppMarketPurchaseVerifier
|
|||||||
'CAFEBAZAAR-PISHKHAN-API-SECRET' => config('services.app_markets.bazaar_secret'),
|
'CAFEBAZAAR-PISHKHAN-API-SECRET' => config('services.app_markets.bazaar_secret'),
|
||||||
])->get($url);
|
])->get($url);
|
||||||
|
|
||||||
|
|
||||||
if (! $response->successful()) {
|
if (! $response->successful()) {
|
||||||
Log::error('Failed to verify Bazaar subscription', [
|
Log::error('Failed to verify Bazaar subscription', [
|
||||||
'status' => $response->status(),
|
'status' => $response->status(),
|
||||||
|
|||||||
@@ -248,9 +248,9 @@ return [
|
|||||||
'PaymentIdentity' => '',
|
'PaymentIdentity' => '',
|
||||||
'MultiIdentityRows' => [
|
'MultiIdentityRows' => [
|
||||||
[
|
[
|
||||||
"IbanNumber" => '', // Sheba number (with IR)
|
'IbanNumber' => '', // Sheba number (with IR)
|
||||||
"Amount" => 0,
|
'Amount' => 0,
|
||||||
"PaymentIdentity" => '',
|
'PaymentIdentity' => '',
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'description' => 'payment using sadad',
|
'description' => 'payment using sadad',
|
||||||
@@ -414,7 +414,7 @@ return [
|
|||||||
'base_url' => 'https://escrow-api.toman.ir/api/v1',
|
'base_url' => 'https://escrow-api.toman.ir/api/v1',
|
||||||
'shop_slug' => '',
|
'shop_slug' => '',
|
||||||
'auth_code' => '',
|
'auth_code' => '',
|
||||||
'data' => ''
|
'data' => '',
|
||||||
],
|
],
|
||||||
'bitpay' => [
|
'bitpay' => [
|
||||||
'apiPurchaseUrl' => 'http://bitpay.ir/payment/gateway-send',
|
'apiPurchaseUrl' => 'http://bitpay.ir/payment/gateway-send',
|
||||||
@@ -487,5 +487,5 @@ return [
|
|||||||
'toman' => \Shetabit\Multipay\Drivers\Toman\Toman::class,
|
'toman' => \Shetabit\Multipay\Drivers\Toman\Toman::class,
|
||||||
'bitpay' => \Shetabit\Multipay\Drivers\Bitpay\Bitpay::class,
|
'bitpay' => \Shetabit\Multipay\Drivers\Bitpay\Bitpay::class,
|
||||||
'minipay' => \Shetabit\Multipay\Drivers\Minipay\Minipay::class,
|
'minipay' => \Shetabit\Multipay\Drivers\Minipay\Minipay::class,
|
||||||
]
|
],
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -19,12 +19,10 @@ return new class extends Migration
|
|||||||
$table->foreignId('division_id')->after('number')->nullable();
|
$table->foreignId('division_id')->after('number')->nullable();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
Schema::table('parts', function (Blueprint $table) {
|
Schema::table('parts', function (Blueprint $table) {
|
||||||
$table->foreignId('division_id')->after('number')->nullable();
|
$table->foreignId('division_id')->after('number')->nullable();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
Schema::table('gates', function (Blueprint $table) {
|
Schema::table('gates', function (Blueprint $table) {
|
||||||
$table->foreignId('division_id')->after('number')->nullable();
|
$table->foreignId('division_id')->after('number')->nullable();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -11,8 +11,7 @@ return new class extends Migration
|
|||||||
*/
|
*/
|
||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
if(!Schema::hasTable('like_sections'))
|
if (! Schema::hasTable('like_sections')) {
|
||||||
{
|
|
||||||
Schema::create('like_sections', function (Blueprint $table) {
|
Schema::create('like_sections', function (Blueprint $table) {
|
||||||
$table->id();
|
$table->id();
|
||||||
$table->foreignId('user_id');
|
$table->foreignId('user_id');
|
||||||
|
|||||||
@@ -11,8 +11,7 @@ return new class extends Migration
|
|||||||
*/
|
*/
|
||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
if(!Schema::hasTable('like_art'))
|
if (! Schema::hasTable('like_art')) {
|
||||||
{
|
|
||||||
Schema::create('like_art', function (Blueprint $table) {
|
Schema::create('like_art', function (Blueprint $table) {
|
||||||
$table->id();
|
$table->id();
|
||||||
$table->foreignId('art_id');
|
$table->foreignId('art_id');
|
||||||
|
|||||||
128
database/migrations/2026_06_26_000001_create_bylaw_tables.php
Normal file
128
database/migrations/2026_06_26_000001_create_bylaw_tables.php
Normal file
@@ -0,0 +1,128 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
DB::statement('SET FOREIGN_KEY_CHECKS=0');
|
||||||
|
|
||||||
|
Schema::create('bylaw_legal_authorities', function (Blueprint $table) {
|
||||||
|
$table->increments('id');
|
||||||
|
$table->string('name')->unique();
|
||||||
|
$table->enum('authority_type', ['executive', 'judicial', 'legislative', 'administrative', 'other']);
|
||||||
|
$table->text('description')->nullable();
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
|
||||||
|
Schema::create('bylaw_subject_categories', function (Blueprint $table) {
|
||||||
|
$table->increments('id');
|
||||||
|
$table->unsignedInteger('parent_id')->nullable();
|
||||||
|
$table->string('name');
|
||||||
|
$table->string('slug')->unique();
|
||||||
|
$table->integer('sort_order')->default(0);
|
||||||
|
$table->timestamps();
|
||||||
|
|
||||||
|
$table->foreign('parent_id')->references('id')->on('bylaw_subject_categories')->nullOnDelete();
|
||||||
|
});
|
||||||
|
|
||||||
|
Schema::create('bylaw_documents', function (Blueprint $table) {
|
||||||
|
$table->bigIncrements('id');
|
||||||
|
$table->string('title', 1000);
|
||||||
|
$table->unsignedInteger('category_id')->nullable();
|
||||||
|
$table->unsignedInteger('approval_authority_id')->nullable();
|
||||||
|
$table->date('approval_date')->nullable();
|
||||||
|
$table->unsignedInteger('promulgation_authority_id')->nullable();
|
||||||
|
$table->date('promulgation_date')->nullable();
|
||||||
|
$table->string('promulgation_number', 100)->nullable();
|
||||||
|
$table->string('official_gazette_number', 100)->nullable();
|
||||||
|
$table->date('official_gazette_date')->nullable();
|
||||||
|
$table->date('execution_date')->nullable();
|
||||||
|
$table->enum('bylaw_type', ['executive', 'delegated', 'independent']);
|
||||||
|
$table->enum('global_status', ['valid', 'explicitly_repealed', 'implicitly_repealed', 'annulled', 'expired', 'draft'])->default('valid');
|
||||||
|
$table->string('pdf_file_path', 500)->nullable();
|
||||||
|
$table->boolean('is_published')->default(true);
|
||||||
|
$table->text('description')->nullable();
|
||||||
|
$table->timestamps();
|
||||||
|
|
||||||
|
$table->foreign('category_id')->references('id')->on('bylaw_subject_categories')->nullOnDelete();
|
||||||
|
$table->foreign('approval_authority_id')->references('id')->on('bylaw_legal_authorities')->nullOnDelete();
|
||||||
|
$table->foreign('promulgation_authority_id')->references('id')->on('bylaw_legal_authorities')->nullOnDelete();
|
||||||
|
$table->index(['approval_date', 'promulgation_date'], 'idx_bylaw_dates');
|
||||||
|
$table->index('global_status', 'idx_bylaw_status');
|
||||||
|
});
|
||||||
|
|
||||||
|
Schema::create('bylaw_node_types', function (Blueprint $table) {
|
||||||
|
$table->increments('id');
|
||||||
|
$table->string('name', 50)->unique();
|
||||||
|
$table->integer('hierarchy_level');
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
|
||||||
|
Schema::create('bylaw_nodes', function (Blueprint $table) {
|
||||||
|
$table->bigIncrements('id');
|
||||||
|
$table->unsignedBigInteger('document_id');
|
||||||
|
$table->unsignedBigInteger('parent_id')->nullable();
|
||||||
|
$table->unsignedInteger('node_type_id');
|
||||||
|
$table->string('node_identifier', 50)->nullable();
|
||||||
|
$table->string('title', 500)->nullable();
|
||||||
|
$table->longText('node_content')->nullable();
|
||||||
|
$table->integer('sort_order')->default(0);
|
||||||
|
$table->date('valid_from')->nullable();
|
||||||
|
$table->date('valid_to')->nullable();
|
||||||
|
$table->enum('node_status', ['valid', 'repealed', 'annulled', 'amended', 'suspended'])->default('valid');
|
||||||
|
$table->timestamps();
|
||||||
|
|
||||||
|
$table->foreign('document_id')->references('id')->on('bylaw_documents')->cascadeOnDelete();
|
||||||
|
$table->foreign('parent_id')->references('id')->on('bylaw_nodes')->cascadeOnDelete();
|
||||||
|
$table->foreign('node_type_id')->references('id')->on('bylaw_node_types')->restrictOnDelete();
|
||||||
|
$table->index(['document_id', 'parent_id'], 'idx_node_tree');
|
||||||
|
$table->index(['node_status', 'valid_from', 'valid_to'], 'idx_node_temporal');
|
||||||
|
});
|
||||||
|
|
||||||
|
Schema::table('bylaw_nodes', function (Blueprint $table) {
|
||||||
|
$table->fullText(['node_content', 'title'], 'ft_idx_content');
|
||||||
|
});
|
||||||
|
|
||||||
|
Schema::create('bylaw_codification_links', function (Blueprint $table) {
|
||||||
|
$table->bigIncrements('id');
|
||||||
|
$table->enum('source_entity_type', ['bylaw_node', 'bylaw_doc', 'law_doc', 'court_verdict', 'advisory_opinion']);
|
||||||
|
$table->unsignedBigInteger('source_entity_id');
|
||||||
|
$table->enum('target_entity_type', ['bylaw_node', 'bylaw_doc', 'law_doc', 'court_verdict', 'advisory_opinion']);
|
||||||
|
$table->unsignedBigInteger('target_entity_id');
|
||||||
|
$table->enum('link_type', ['repeals_explicitly', 'repeals_implicitly', 'annuls_entirely', 'annuls_partially', 'amends', 'adds_to', 'interprets', 'is_executive_bylaw_of']);
|
||||||
|
$table->date('effective_date')->nullable();
|
||||||
|
$table->text('justification')->nullable();
|
||||||
|
$table->timestamp('created_at')->useCurrent();
|
||||||
|
|
||||||
|
$table->unique(['source_entity_type', 'source_entity_id', 'target_entity_type', 'target_entity_id', 'link_type'], 'idx_unique_link');
|
||||||
|
$table->index(['target_entity_type', 'target_entity_id'], 'idx_target_search');
|
||||||
|
});
|
||||||
|
|
||||||
|
DB::table('bylaw_node_types')->insertOrIgnore([
|
||||||
|
['id' => 1, 'name' => 'متن کامل آییننامه', 'hierarchy_level' => 1, 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
]);
|
||||||
|
|
||||||
|
DB::table('bylaw_subject_categories')->insertOrIgnore([
|
||||||
|
['id' => 9, 'name' => 'آیین نامه ها', 'slug' => 'bylaws', 'sort_order' => 0, 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
]);
|
||||||
|
|
||||||
|
DB::statement('SET FOREIGN_KEY_CHECKS=1');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
DB::statement('SET FOREIGN_KEY_CHECKS=0');
|
||||||
|
Schema::dropIfExists('bylaw_codification_links');
|
||||||
|
Schema::dropIfExists('bylaw_nodes');
|
||||||
|
Schema::dropIfExists('bylaw_node_types');
|
||||||
|
Schema::dropIfExists('bylaw_documents');
|
||||||
|
Schema::dropIfExists('bylaw_subject_categories');
|
||||||
|
Schema::dropIfExists('bylaw_legal_authorities');
|
||||||
|
DB::statement('SET FOREIGN_KEY_CHECKS=1');
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
@extends('admin.layouts.app')
|
||||||
|
@section('content')
|
||||||
|
<form method="post" action="{{ route('bylaw-codification-link.store') }}">@csrf
|
||||||
|
<input class="form-control mb-2" name="source_entity_type" placeholder="source_entity_type">
|
||||||
|
<input class="form-control mb-2" name="source_entity_id" type="number">
|
||||||
|
<input class="form-control mb-2" name="target_entity_type" placeholder="target_entity_type">
|
||||||
|
<input class="form-control mb-2" name="target_entity_id" type="number">
|
||||||
|
<input class="form-control mb-2" name="link_type" placeholder="link_type">
|
||||||
|
<input class="form-control mb-2" name="effective_date" type="date">
|
||||||
|
<textarea class="form-control mb-2" name="justification"></textarea>
|
||||||
|
<button class="btn btn-primary">ذخیره</button></form>@endsection
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
@extends('admin.layouts.app')
|
||||||
|
@section('content')
|
||||||
|
<div class="card"><div class="card-body"><a class="btn btn-primary mb-3" href="{{ route('bylaw-codification-link.create') }}">افزودن</a><table class="table"><thead><tr><th>منبع</th><th>هدف</th><th>نوع</th><th>عملیات</th></tr></thead><tbody>@foreach($items as $item)<tr><td>{{ $item->source_entity_type }}#{{ $item->source_entity_id }}</td><td>{{ $item->target_entity_type }}#{{ $item->target_entity_id }}</td><td>{{ $item->link_type }}</td><td><a class="btn btn-sm btn-primary" href="{{ route('bylaw-codification-link.edit', $item) }}">ویرایش</a></td></tr>@endforeach</tbody></table>{{ $items->links() }}</div></div>@endsection
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
@extends('admin.layouts.app')
|
||||||
|
@section('content')
|
||||||
|
<form method="post" action="{{ route('bylaw-codification-link.update', $bylawCodificationLink) }}">@csrf @method('PUT')
|
||||||
|
<input class="form-control mb-2" name="source_entity_type" value="{{ $bylawCodificationLink->source_entity_type }}">
|
||||||
|
<input class="form-control mb-2" name="source_entity_id" type="number" value="{{ $bylawCodificationLink->source_entity_id }}">
|
||||||
|
<input class="form-control mb-2" name="target_entity_type" value="{{ $bylawCodificationLink->target_entity_type }}">
|
||||||
|
<input class="form-control mb-2" name="target_entity_id" type="number" value="{{ $bylawCodificationLink->target_entity_id }}">
|
||||||
|
<input class="form-control mb-2" name="link_type" value="{{ $bylawCodificationLink->link_type }}">
|
||||||
|
<input class="form-control mb-2" name="effective_date" type="date" value="{{ $bylawCodificationLink->effective_date }}">
|
||||||
|
<textarea class="form-control mb-2" name="justification">{{ $bylawCodificationLink->justification }}</textarea>
|
||||||
|
<button class="btn btn-primary">بروزرسانی</button></form>@endsection
|
||||||
15
resources/views/admin/bylaw-document/create.blade.php
Normal file
15
resources/views/admin/bylaw-document/create.blade.php
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
@extends('admin.layouts.app')
|
||||||
|
@section('content')
|
||||||
|
<form method="post" action="{{ route('bylaw-document.store') }}">@csrf
|
||||||
|
<input class="form-control mb-2" name="title" placeholder="عنوان">
|
||||||
|
<select class="form-control mb-2" name="category_id"><option value="">دسته</option>@foreach($categories as $item)<option value="{{ $item->id }}">{{ $item->name }}</option>@endforeach</select>
|
||||||
|
<select class="form-control mb-2" name="approval_authority_id"><option value="">مرجع تصویب</option>@foreach($authorities as $item)<option value="{{ $item->id }}">{{ $item->name }}</option>@endforeach</select>
|
||||||
|
<select class="form-control mb-2" name="promulgation_authority_id"><option value="">مرجع ابلاغ</option>@foreach($authorities as $item)<option value="{{ $item->id }}">{{ $item->name }}</option>@endforeach</select>
|
||||||
|
<input class="form-control mb-2" name="approval_date" type="date"><input class="form-control mb-2" name="promulgation_date" type="date"><input class="form-control mb-2" name="execution_date" type="date">
|
||||||
|
<input class="form-control mb-2" name="promulgation_number" placeholder="شماره ابلاغیه"><input class="form-control mb-2" name="official_gazette_number" placeholder="شماره روزنامه رسمی">
|
||||||
|
<select class="form-control mb-2" name="bylaw_type"><option value="executive">executive</option><option value="delegated">delegated</option><option value="independent">independent</option></select>
|
||||||
|
<select class="form-control mb-2" name="global_status"><option value="valid">valid</option><option value="explicitly_repealed">explicitly_repealed</option><option value="implicitly_repealed">implicitly_repealed</option><option value="annulled">annulled</option><option value="expired">expired</option><option value="draft">draft</option></select>
|
||||||
|
<input class="form-control mb-2" name="pdf_file_path" placeholder="pdf path">
|
||||||
|
<textarea class="form-control mb-2" name="description"></textarea>
|
||||||
|
<label><input type="checkbox" name="is_published" value="1" checked> منتشر شده</label>
|
||||||
|
<button class="btn btn-primary">ذخیره</button></form>@endsection
|
||||||
4
resources/views/admin/bylaw-document/index.blade.php
Normal file
4
resources/views/admin/bylaw-document/index.blade.php
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
@extends('admin.layouts.app')
|
||||||
|
@section('content')
|
||||||
|
<div class="card"><div class="card-body"><a class="btn btn-primary mb-3" href="{{ route('bylaw-document.create') }}">افزودن</a>
|
||||||
|
<table class="table"><thead><tr><th>عنوان</th><th>نوع</th><th>وضعیت</th><th>عملیات</th></tr></thead><tbody>@foreach($items as $item)<tr><td>{{ $item->title }}</td><td>{{ $item->bylaw_type }}</td><td>{{ $item->global_status }}</td><td><a class="btn btn-sm btn-primary" href="{{ route('bylaw-document.edit', $item) }}">ویرایش</a></td></tr>@endforeach</tbody></table>{{ $items->links() }}</div></div>@endsection
|
||||||
15
resources/views/admin/bylaw-document/update.blade.php
Normal file
15
resources/views/admin/bylaw-document/update.blade.php
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
@extends('admin.layouts.app')
|
||||||
|
@section('content')
|
||||||
|
<form method="post" action="{{ route('bylaw-document.update', $bylawDocument) }}">@csrf @method('PUT')
|
||||||
|
<input class="form-control mb-2" name="title" value="{{ $bylawDocument->title }}">
|
||||||
|
<select class="form-control mb-2" name="category_id"><option value="">دسته</option>@foreach($categories as $item)<option value="{{ $item->id }}" @selected($bylawDocument->category_id===$item->id)>{{ $item->name }}</option>@endforeach</select>
|
||||||
|
<select class="form-control mb-2" name="approval_authority_id"><option value="">مرجع تصویب</option>@foreach($authorities as $item)<option value="{{ $item->id }}" @selected($bylawDocument->approval_authority_id===$item->id)>{{ $item->name }}</option>@endforeach</select>
|
||||||
|
<select class="form-control mb-2" name="promulgation_authority_id"><option value="">مرجع ابلاغ</option>@foreach($authorities as $item)<option value="{{ $item->id }}" @selected($bylawDocument->promulgation_authority_id===$item->id)>{{ $item->name }}</option>@endforeach</select>
|
||||||
|
<input class="form-control mb-2" name="approval_date" type="date" value="{{ $bylawDocument->approval_date }}"><input class="form-control mb-2" name="promulgation_date" type="date" value="{{ $bylawDocument->promulgation_date }}"><input class="form-control mb-2" name="execution_date" type="date" value="{{ $bylawDocument->execution_date }}">
|
||||||
|
<input class="form-control mb-2" name="promulgation_number" value="{{ $bylawDocument->promulgation_number }}"><input class="form-control mb-2" name="official_gazette_number" value="{{ $bylawDocument->official_gazette_number }}">
|
||||||
|
<select class="form-control mb-2" name="bylaw_type">@foreach(['executive','delegated','independent'] as $type)<option value="{{ $type }}" @selected($bylawDocument->bylaw_type===$type)>{{ $type }}</option>@endforeach</select>
|
||||||
|
<select class="form-control mb-2" name="global_status">@foreach(['valid','explicitly_repealed','implicitly_repealed','annulled','expired','draft'] as $status)<option value="{{ $status }}" @selected($bylawDocument->global_status===$status)>{{ $status }}</option>@endforeach</select>
|
||||||
|
<input class="form-control mb-2" name="pdf_file_path" value="{{ $bylawDocument->pdf_file_path }}">
|
||||||
|
<textarea class="form-control mb-2" name="description">{{ $bylawDocument->description }}</textarea>
|
||||||
|
<label><input type="checkbox" name="is_published" value="1" @checked($bylawDocument->is_published)> منتشر شده</label>
|
||||||
|
<button class="btn btn-primary">بروزرسانی</button></form>@endsection
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
@extends('admin.layouts.app')
|
||||||
|
@section('content')
|
||||||
|
<form method="post" action="{{ route('bylaw-legal-authority.store') }}">@csrf
|
||||||
|
<input class="form-control mb-2" name="name" placeholder="نام">
|
||||||
|
<select class="form-control mb-2" name="authority_type"><option value="executive">executive</option><option value="judicial">judicial</option><option value="legislative">legislative</option><option value="administrative">administrative</option><option value="other">other</option></select>
|
||||||
|
<textarea class="form-control mb-2" name="description" placeholder="توضیحات"></textarea>
|
||||||
|
<button class="btn btn-primary">ذخیره</button>
|
||||||
|
</form>
|
||||||
|
@endsection
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
@extends('admin.layouts.app')
|
||||||
|
@section('content')
|
||||||
|
<div class="card"><div class="card-body">
|
||||||
|
<a class="btn btn-primary mb-3" href="{{ route('bylaw-legal-authority.create') }}">افزودن</a>
|
||||||
|
<table class="table"><thead><tr><th>نام</th><th>نوع</th><th>عملیات</th></tr></thead><tbody>@foreach($items as $item)<tr><td>{{ $item->name }}</td><td>{{ $item->authority_type }}</td><td><a class="btn btn-sm btn-primary" href="{{ route('bylaw-legal-authority.edit', $item) }}">ویرایش</a></td></tr>@endforeach</tbody></table>
|
||||||
|
{{ $items->links() }}
|
||||||
|
</div></div>
|
||||||
|
@endsection
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
@extends('admin.layouts.app')
|
||||||
|
@section('content')
|
||||||
|
<form method="post" action="{{ route('bylaw-legal-authority.update', $bylawLegalAuthority) }}">@csrf @method('PUT')
|
||||||
|
<input class="form-control mb-2" name="name" value="{{ $bylawLegalAuthority->name }}">
|
||||||
|
<select class="form-control mb-2" name="authority_type">@foreach(['executive','judicial','legislative','administrative','other'] as $type)<option value="{{ $type }}" @selected($bylawLegalAuthority->authority_type===$type)>{{ $type }}</option>@endforeach</select>
|
||||||
|
<textarea class="form-control mb-2" name="description">{{ $bylawLegalAuthority->description }}</textarea>
|
||||||
|
<button class="btn btn-primary">بروزرسانی</button>
|
||||||
|
</form>
|
||||||
|
@endsection
|
||||||
6
resources/views/admin/bylaw-node-type/create.blade.php
Normal file
6
resources/views/admin/bylaw-node-type/create.blade.php
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
@extends('admin.layouts.app')
|
||||||
|
@section('content')
|
||||||
|
<form method="post" action="{{ route('bylaw-node-type.store') }}">@csrf
|
||||||
|
<input class="form-control mb-2" name="name" placeholder="نام">
|
||||||
|
<input class="form-control mb-2" name="hierarchy_level" type="number" value="1">
|
||||||
|
<button class="btn btn-primary">ذخیره</button></form>@endsection
|
||||||
3
resources/views/admin/bylaw-node-type/index.blade.php
Normal file
3
resources/views/admin/bylaw-node-type/index.blade.php
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
@extends('admin.layouts.app')
|
||||||
|
@section('content')
|
||||||
|
<div class="card"><div class="card-body"><a class="btn btn-primary mb-3" href="{{ route('bylaw-node-type.create') }}">افزودن</a><table class="table"><thead><tr><th>نام</th><th>سطح</th><th>عملیات</th></tr></thead><tbody>@foreach($items as $item)<tr><td>{{ $item->name }}</td><td>{{ $item->hierarchy_level }}</td><td><a class="btn btn-sm btn-primary" href="{{ route('bylaw-node-type.edit', $item) }}">ویرایش</a></td></tr>@endforeach</tbody></table>{{ $items->links() }}</div></div>@endsection
|
||||||
6
resources/views/admin/bylaw-node-type/update.blade.php
Normal file
6
resources/views/admin/bylaw-node-type/update.blade.php
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
@extends('admin.layouts.app')
|
||||||
|
@section('content')
|
||||||
|
<form method="post" action="{{ route('bylaw-node-type.update', $bylawNodeType) }}">@csrf @method('PUT')
|
||||||
|
<input class="form-control mb-2" name="name" value="{{ $bylawNodeType->name }}">
|
||||||
|
<input class="form-control mb-2" name="hierarchy_level" type="number" value="{{ $bylawNodeType->hierarchy_level }}">
|
||||||
|
<button class="btn btn-primary">بروزرسانی</button></form>@endsection
|
||||||
13
resources/views/admin/bylaw-node/create.blade.php
Normal file
13
resources/views/admin/bylaw-node/create.blade.php
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
@extends('admin.layouts.app')
|
||||||
|
@section('content')
|
||||||
|
<form method="post" action="{{ route('bylaw-node.store') }}">@csrf
|
||||||
|
<select class="form-control mb-2" name="document_id">@foreach($documents as $item)<option value="{{ $item->id }}">{{ $item->title }}</option>@endforeach</select>
|
||||||
|
<select class="form-control mb-2" name="parent_id"><option value="">والد ندارد</option>@foreach($parents as $item)<option value="{{ $item->id }}">{{ $item->title ?? $item->id }}</option>@endforeach</select>
|
||||||
|
<select class="form-control mb-2" name="node_type_id">@foreach($types as $item)<option value="{{ $item->id }}">{{ $item->name }}</option>@endforeach</select>
|
||||||
|
<input class="form-control mb-2" name="node_identifier" placeholder="شناسه">
|
||||||
|
<input class="form-control mb-2" name="title" placeholder="عنوان">
|
||||||
|
<textarea class="form-control mb-2" name="node_content"></textarea>
|
||||||
|
<input class="form-control mb-2" name="sort_order" type="number" value="0">
|
||||||
|
<input class="form-control mb-2" name="valid_from" type="date"><input class="form-control mb-2" name="valid_to" type="date">
|
||||||
|
<select class="form-control mb-2" name="node_status"><option value="valid">valid</option><option value="repealed">repealed</option><option value="annulled">annulled</option><option value="amended">amended</option><option value="suspended">suspended</option></select>
|
||||||
|
<button class="btn btn-primary">ذخیره</button></form>@endsection
|
||||||
3
resources/views/admin/bylaw-node/index.blade.php
Normal file
3
resources/views/admin/bylaw-node/index.blade.php
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
@extends('admin.layouts.app')
|
||||||
|
@section('content')
|
||||||
|
<div class="card"><div class="card-body"><a class="btn btn-primary mb-3" href="{{ route('bylaw-node.create') }}">افزودن</a><table class="table"><thead><tr><th>سند</th><th>نوع</th><th>عنوان</th><th>عملیات</th></tr></thead><tbody>@foreach($items as $item)<tr><td>{{ $item->document?->title }}</td><td>{{ $item->type?->name }}</td><td>{{ $item->title }}</td><td><a class="btn btn-sm btn-primary" href="{{ route('bylaw-node.edit', $item) }}">ویرایش</a></td></tr>@endforeach</tbody></table>{{ $items->links() }}</div></div>@endsection
|
||||||
13
resources/views/admin/bylaw-node/update.blade.php
Normal file
13
resources/views/admin/bylaw-node/update.blade.php
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
@extends('admin.layouts.app')
|
||||||
|
@section('content')
|
||||||
|
<form method="post" action="{{ route('bylaw-node.update', $bylawNode) }}">@csrf @method('PUT')
|
||||||
|
<select class="form-control mb-2" name="document_id">@foreach($documents as $item)<option value="{{ $item->id }}" @selected($bylawNode->document_id===$item->id)>{{ $item->title }}</option>@endforeach</select>
|
||||||
|
<select class="form-control mb-2" name="parent_id"><option value="">والد ندارد</option>@foreach($parents as $item)<option value="{{ $item->id }}" @selected($bylawNode->parent_id===$item->id)>{{ $item->title ?? $item->id }}</option>@endforeach</select>
|
||||||
|
<select class="form-control mb-2" name="node_type_id">@foreach($types as $item)<option value="{{ $item->id }}" @selected($bylawNode->node_type_id===$item->id)>{{ $item->name }}</option>@endforeach</select>
|
||||||
|
<input class="form-control mb-2" name="node_identifier" value="{{ $bylawNode->node_identifier }}">
|
||||||
|
<input class="form-control mb-2" name="title" value="{{ $bylawNode->title }}">
|
||||||
|
<textarea class="form-control mb-2" name="node_content">{{ $bylawNode->node_content }}</textarea>
|
||||||
|
<input class="form-control mb-2" name="sort_order" type="number" value="{{ $bylawNode->sort_order }}">
|
||||||
|
<input class="form-control mb-2" name="valid_from" type="date" value="{{ $bylawNode->valid_from }}"><input class="form-control mb-2" name="valid_to" type="date" value="{{ $bylawNode->valid_to }}">
|
||||||
|
<select class="form-control mb-2" name="node_status">@foreach(['valid','repealed','annulled','amended','suspended'] as $status)<option value="{{ $status }}" @selected($bylawNode->node_status===$status)>{{ $status }}</option>@endforeach</select>
|
||||||
|
<button class="btn btn-primary">بروزرسانی</button></form>@endsection
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
@extends('admin.layouts.app')
|
||||||
|
@section('content')
|
||||||
|
<form method="post" action="{{ route('bylaw-subject-category.store') }}">@csrf
|
||||||
|
<input class="form-control mb-2" name="name" placeholder="نام">
|
||||||
|
<input class="form-control mb-2" name="slug" placeholder="slug">
|
||||||
|
<input class="form-control mb-2" name="sort_order" type="number" value="0">
|
||||||
|
<select class="form-control mb-2" name="parent_id"><option value="">والد ندارد</option>@foreach($parents as $parent)<option value="{{ $parent->id }}">{{ $parent->name }}</option>@endforeach</select>
|
||||||
|
<button class="btn btn-primary">ذخیره</button></form>@endsection
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
@extends('admin.layouts.app')
|
||||||
|
@section('content')
|
||||||
|
<div class="card"><div class="card-body"><a class="btn btn-primary mb-3" href="{{ route('bylaw-subject-category.create') }}">افزودن</a>
|
||||||
|
<table class="table"><thead><tr><th>نام</th><th>اسلاگ</th><th>عملیات</th></tr></thead><tbody>@foreach($items as $item)<tr><td>{{ $item->name }}</td><td>{{ $item->slug }}</td><td><a class="btn btn-sm btn-primary" href="{{ route('bylaw-subject-category.edit', $item) }}">ویرایش</a></td></tr>@endforeach</tbody></table>{{ $items->links() }}</div></div>@endsection
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
@extends('admin.layouts.app')
|
||||||
|
@section('content')
|
||||||
|
<form method="post" action="{{ route('bylaw-subject-category.update', $bylawSubjectCategory) }}">@csrf @method('PUT')
|
||||||
|
<input class="form-control mb-2" name="name" value="{{ $bylawSubjectCategory->name }}">
|
||||||
|
<input class="form-control mb-2" name="slug" value="{{ $bylawSubjectCategory->slug }}">
|
||||||
|
<input class="form-control mb-2" name="sort_order" type="number" value="{{ $bylawSubjectCategory->sort_order }}">
|
||||||
|
<select class="form-control mb-2" name="parent_id"><option value="">والد ندارد</option>@foreach($parents as $parent)<option value="{{ $parent->id }}" @selected($bylawSubjectCategory->parent_id===$parent->id)>{{ $parent->name }}</option>@endforeach</select>
|
||||||
|
<button class="btn btn-primary">بروزرسانی</button></form>@endsection
|
||||||
@@ -231,6 +231,20 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="javascript:%20void(0);" class="has-arrow waves-effect">
|
||||||
|
<i class="mdi mdi-gavel"></i>
|
||||||
|
<span>آییننامهها</span>
|
||||||
|
</a>
|
||||||
|
<ul class="sub-menu" aria-expanded="false">
|
||||||
|
<li><a href="{{ route('bylaw-document.index') }}">لیست اسناد</a></li>
|
||||||
|
<li><a href="{{ route('bylaw-document.create') }}">افزودن سند جدید</a></li>
|
||||||
|
<li><a href="{{ route('bylaw-legal-authority.index') }}">مراجع قانونی</a></li>
|
||||||
|
<li><a href="{{ route('bylaw-subject-category.index') }}">دستهبندی موضوعی</a></li>
|
||||||
|
<li><a href="{{ route('bylaw-node-type.index') }}">انواع گره</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
|
||||||
<li>
|
<li>
|
||||||
<a href="javascript:%20void(0);" class="has-arrow waves-effect">
|
<a href="javascript:%20void(0);" class="has-arrow waves-effect">
|
||||||
<i class="mdi mdi-format-list-bulleted"></i>
|
<i class="mdi mdi-format-list-bulleted"></i>
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use App\Http\Controllers\api\HomeController;
|
|
||||||
use App\Http\Controllers\api\ArtController;
|
use App\Http\Controllers\api\ArtController;
|
||||||
use App\Http\Controllers\api\AuthController;
|
use App\Http\Controllers\api\AuthController;
|
||||||
use App\Http\Controllers\api\BookController;
|
use App\Http\Controllers\api\BookController;
|
||||||
@@ -8,6 +7,7 @@ use App\Http\Controllers\api\CategoriesController;
|
|||||||
use App\Http\Controllers\api\ChapterController;
|
use App\Http\Controllers\api\ChapterController;
|
||||||
use App\Http\Controllers\api\FolderController;
|
use App\Http\Controllers\api\FolderController;
|
||||||
use App\Http\Controllers\api\GateController;
|
use App\Http\Controllers\api\GateController;
|
||||||
|
use App\Http\Controllers\api\HomeController;
|
||||||
use App\Http\Controllers\api\LawController;
|
use App\Http\Controllers\api\LawController;
|
||||||
use App\Http\Controllers\api\NoteController;
|
use App\Http\Controllers\api\NoteController;
|
||||||
use App\Http\Controllers\api\NotificationController;
|
use App\Http\Controllers\api\NotificationController;
|
||||||
|
|||||||
@@ -3,17 +3,22 @@
|
|||||||
use App\Http\Controllers\Admin\ArtController;
|
use App\Http\Controllers\Admin\ArtController;
|
||||||
use App\Http\Controllers\Admin\BookController;
|
use App\Http\Controllers\Admin\BookController;
|
||||||
use App\Http\Controllers\Admin\BranchController;
|
use App\Http\Controllers\Admin\BranchController;
|
||||||
use App\Http\Controllers\Admin\CategoriesController;
|
use App\Http\Controllers\Admin\BylawCodificationLinkController;
|
||||||
|
use App\Http\Controllers\Admin\BylawDocumentController;
|
||||||
|
use App\Http\Controllers\Admin\BylawLegalAuthorityController;
|
||||||
|
use App\Http\Controllers\Admin\BylawNodeController;
|
||||||
|
use App\Http\Controllers\Admin\BylawNodeTypeController;
|
||||||
|
use App\Http\Controllers\Admin\BylawSubjectCategoryController;
|
||||||
use App\Http\Controllers\Admin\CategoryController;
|
use App\Http\Controllers\Admin\CategoryController;
|
||||||
use App\Http\Controllers\Admin\ChapterController;
|
use App\Http\Controllers\Admin\ChapterController;
|
||||||
use App\Http\Controllers\Admin\DivisionController;
|
use App\Http\Controllers\Admin\DivisionController;
|
||||||
use App\Http\Controllers\Admin\GateController;
|
use App\Http\Controllers\Admin\GateController;
|
||||||
use App\Http\Controllers\Admin\HomeController;
|
use App\Http\Controllers\Admin\HomeController;
|
||||||
use App\Http\Controllers\Admin\JudicialPrecedentController;
|
|
||||||
use App\Http\Controllers\Admin\JudicialPrecedentCategoryController;
|
use App\Http\Controllers\Admin\JudicialPrecedentCategoryController;
|
||||||
|
use App\Http\Controllers\Admin\JudicialPrecedentController;
|
||||||
use App\Http\Controllers\Admin\LawController;
|
use App\Http\Controllers\Admin\LawController;
|
||||||
use App\Http\Controllers\Admin\LegalOpinionController;
|
|
||||||
use App\Http\Controllers\Admin\LegalOpinionCategoryController;
|
use App\Http\Controllers\Admin\LegalOpinionCategoryController;
|
||||||
|
use App\Http\Controllers\Admin\LegalOpinionController;
|
||||||
use App\Http\Controllers\Admin\NotificationController;
|
use App\Http\Controllers\Admin\NotificationController;
|
||||||
use App\Http\Controllers\Admin\PartController;
|
use App\Http\Controllers\Admin\PartController;
|
||||||
use App\Http\Controllers\Admin\SectionController;
|
use App\Http\Controllers\Admin\SectionController;
|
||||||
@@ -47,5 +52,11 @@ Route::middleware(['auth',config('jetstream.auth_session')])->group(function ()
|
|||||||
Route::resource('judicial-precedent-category', JudicialPrecedentCategoryController::class);
|
Route::resource('judicial-precedent-category', JudicialPrecedentCategoryController::class);
|
||||||
Route::resource('legal-opinion', LegalOpinionController::class);
|
Route::resource('legal-opinion', LegalOpinionController::class);
|
||||||
Route::resource('legal-opinion-category', LegalOpinionCategoryController::class);
|
Route::resource('legal-opinion-category', LegalOpinionCategoryController::class);
|
||||||
|
Route::resource('bylaw-legal-authority', BylawLegalAuthorityController::class);
|
||||||
|
Route::resource('bylaw-subject-category', BylawSubjectCategoryController::class);
|
||||||
|
Route::resource('bylaw-document', BylawDocumentController::class);
|
||||||
|
Route::resource('bylaw-node-type', BylawNodeTypeController::class);
|
||||||
|
Route::resource('bylaw-node', BylawNodeController::class);
|
||||||
|
Route::resource('bylaw-codification-link', BylawCodificationLinkController::class);
|
||||||
Route::get('suggestions', [SuggestionController::class, 'index'])->name('suggestions.index');
|
Route::get('suggestions', [SuggestionController::class, 'index'])->name('suggestions.index');
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user