feat: add bylaw management features including documents, legal authorities, subject categories, and nodes
This commit is contained in:
@@ -33,6 +33,7 @@ class JudicialPrecedentController extends Controller
|
||||
{
|
||||
$arts = Art::all();
|
||||
$categories = JudicialPrecedentCategory::all();
|
||||
|
||||
return view('admin.judicial-precedent.create', compact('arts', 'categories'));
|
||||
}
|
||||
|
||||
@@ -46,7 +47,7 @@ class JudicialPrecedentController extends Controller
|
||||
'issuing_authority' => 'nullable|string',
|
||||
'category_id' => 'nullable|exists:judicial_precedent_categories,id',
|
||||
'art_ids' => 'nullable|array',
|
||||
'art_ids.*' => 'exists:arts,id'
|
||||
'art_ids.*' => 'exists:arts,id',
|
||||
]);
|
||||
|
||||
$judicialPrecedent = JudicialPrecedent::create([
|
||||
@@ -55,10 +56,10 @@ class JudicialPrecedentController extends Controller
|
||||
'subject' => $validated['subject'],
|
||||
'full_text' => $validated['full_text'],
|
||||
'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'])) {
|
||||
$judicialPrecedent->arts()->attach($validated['art_ids']);
|
||||
}
|
||||
|
||||
@@ -70,25 +71,25 @@ class JudicialPrecedentController extends Controller
|
||||
$arts = Art::all();
|
||||
$categories = JudicialPrecedentCategory::all();
|
||||
$selectedArtIds = $judicialPrecedent->arts->pluck('id')->toArray();
|
||||
|
||||
|
||||
return view('admin.judicial-precedent.update', compact('judicialPrecedent', 'arts', 'categories', 'selectedArtIds'));
|
||||
}
|
||||
|
||||
public function update(Request $request, JudicialPrecedent $judicialPrecedent)
|
||||
{
|
||||
$validated = $request->validate([
|
||||
'ruling_number' => 'required|unique:judicial_precedents,ruling_number,' . $judicialPrecedent->id,
|
||||
'ruling_number' => 'required|unique:judicial_precedents,ruling_number,'.$judicialPrecedent->id,
|
||||
'ruling_date' => 'required|date',
|
||||
'subject' => 'required|string',
|
||||
'full_text' => 'required|string',
|
||||
'issuing_authority' => 'nullable|string',
|
||||
'category_id' => 'nullable|exists:judicial_precedent_categories,id',
|
||||
'art_ids' => 'nullable|array',
|
||||
'art_ids.*' => 'exists:arts,id'
|
||||
'art_ids.*' => 'exists:arts,id',
|
||||
]);
|
||||
|
||||
$judicialPrecedent->update($validated);
|
||||
|
||||
|
||||
$judicialPrecedent->arts()->sync($validated['art_ids'] ?? []);
|
||||
|
||||
return redirect(route('judicial-precedent.edit', $judicialPrecedent->id));
|
||||
@@ -97,6 +98,7 @@ class JudicialPrecedentController extends Controller
|
||||
public function destroy(JudicialPrecedent $judicialPrecedent)
|
||||
{
|
||||
$judicialPrecedent->delete();
|
||||
|
||||
return redirect(route('judicial-precedent.index'));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user