add api route for calculator

This commit is contained in:
aslan 2024-03-06 15:20:16 +03:00
parent b095a0f51b
commit 6fa24915be
2 changed files with 14 additions and 6 deletions

View File

@ -22,12 +22,12 @@ class PageController extends Controller
public function directions()
{
// $directions = DB::table('faculties')
// ->join('departments', 'faculties.id', '=', 'departments.faculty_id')
// ->join('directions', 'departments.id', '=', 'directions.department_id')
// ->select('faculties.name as faculties.name', 'directions.name', 'directions.id')
// ->groupBy('faculties.name')
// ->get();
$directions = DB::table('faculties')
->join('departments', 'faculties.id', '=', 'departments.faculty_id')
->join('directions', 'departments.id', '=', 'directions.department_id')
->select('faculties.name as faculties.name', 'directions.name', 'directions.id')
->groupBy('faculties.name')
->get();
$faculties = Faculty::all();
// $infBez = $faculties->find(FacultyEnum::InfBez->value);
// $query = `select faculties.name, directions.name, directions.id
@ -45,4 +45,9 @@ class PageController extends Controller
// }
return view('new-design.bakalavr-special', compact('faculties'));
}
public function calculator($request)
{
return response()->json($request);
}
}

View File

@ -1,5 +1,6 @@
<?php
use App\Http\Controllers\admin\PageController;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
@ -17,3 +18,5 @@ use Illuminate\Support\Facades\Route;
Route::middleware('auth:sanctum')->get('/user', function (Request $request) {
return $request->user();
});
Route::post('/calc', [PageController::class, 'calculator'])->name('calculator');