52 lines
1.5 KiB
PHP
52 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Admin;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Services\Admin\ManageThoughtsService;
|
|
use Illuminate\Http\Request;
|
|
use App\Models\UserThought;
|
|
|
|
class ManageThoughtsController extends Controller
|
|
{
|
|
public function __construct(ManageThoughtsService $manageThoughtsService)
|
|
{
|
|
$this->manageThoughtsService = $manageThoughtsService;
|
|
}
|
|
|
|
public function view_manage_thoughts(Request $request)
|
|
{
|
|
$manage_thoughts =$this->manageThoughtsService->view_manage_thoughts($request);
|
|
// dd($manage_thoughts);
|
|
return view('Admin.Pages.manage_cms.manage_thoughts.manage_thoughts')->with(['manage_thought'=>$manage_thoughts]);
|
|
}
|
|
|
|
public function insert_thoughts(Request $request)
|
|
{
|
|
// dd($request);
|
|
$thoughts = $this->manageThoughtsService->insert_thoughts($request);
|
|
return response()->json(['success' => true,'status'=>200]);
|
|
}
|
|
|
|
|
|
public function update_thought(Request $request)
|
|
{
|
|
$updateThought = $this->manageThoughtsService->update_thought($request);
|
|
return response()->json(['success2' => true,'status'=>200]);
|
|
}
|
|
|
|
public function change_manage_thoughts_Status(Request $request)
|
|
{
|
|
$status = UserThought::find($request->thought_id);
|
|
$status->is_active = $request->status;
|
|
$status->save();
|
|
return response()->json(['success'=>'Status change successfully.']);
|
|
}
|
|
|
|
public function delete_thought($id)
|
|
{
|
|
$Thoughts = UserThought::find($id)->delete();
|
|
}
|
|
}
|
|
|