Skip to content

How can I get the request URL Trucker is hitting? #30

@mikemike

Description

@mikemike

I'm using a REST API that is a little unusual (a mix of GET and POST params - we have no control over the API unfortunately), so I need to make some amends to how Trucker hits it for certain requests.

The problem is that I'm unsure how to check what URL Trucker is hitting.

I'm using the following code inside a model:

<?php

namespace App\Models\Api;

use App\Models\Api\ApiModel;
use Trucker\Facades\ConditionFactory;

class VehicleManufacturer extends ApiModel
{
	protected $uri = "manufacturers";

	static function whereSlug($slug) {
		$conditions = ConditionFactory::build();
		$conditions->addCondition('makeSlug', '=', $slug);
		$conditions->setLogicalOperator($conditions->getLogicalOperatorAnd());

		$results = VehicleManufacturer::all($conditions);

		dd($results);

		return $results;
	}
}

How would I get the URL here?

I know I can get getURI() on a model instance, but I'm not sure how to do it on an all() call, which includes the conditions (which is what I'm interested in).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions