skip to Main Content

Bug with Laravel Eloquent query buldier

I found a weird situation when nesting in a query a where with a orWhereNull. The result is returning rows with values that are neither null nor correct This is the code: $query = Document::where("active", true)->where("type_id", $document_type->id); if($selected) { $query->where(function($q)…

VIEW QUESTION

how to access REST API in laravel 10?

I'm working on a project using laravel 10 that uses REST API but I'm getting a 404 not found error when I tried to test the url http://localhost/api/v1/continent with GET request in Postman. this is my routes/api.php: Route::prefix('v1')->name('v1.')->group(function() { Route::get('continent',…

VIEW QUESTION

Making a CommonController in laravel

Most of my controllers in laravel look the same Example: class CourseController extends Controller { public function index(Request $request) { $courses = Course::query(); $courses = $this->commonIndex($courses, $request); return CourseResource::collection($courses); } public function store(StoreCourseRequest $request) { $course = Course::create($request->validated); return CourseResource::make($course);…

VIEW QUESTION
Back To Top
Search