public function testDasherize() { $values = ['foo' => 'foo', 'foo_bar' => 'foo-bar', 'fooBar' => 'foo-bar']; foreach ($values as $value => $expected) { $actual = Str::dasherize($value); $this->assertSame($expected, $actual, "Did not dasherize '{$value}' correctly"); } }
/** * Convert a model key into a resource attribute key. * * @param $modelKey * @return string */ protected function keyForAttribute($modelKey) { return $this->hyphenated ? Str::dasherize($modelKey) : $modelKey; }