/** * Fetch link by url * * @param $url * * @return mixed */ public function byUrl($url) { return Link::whereUrl($url)->first(); }
public function test_gets_url_by_hash() { Link::create(['url' => 'http://laracasts.com', 'hash' => 'asdfg']); $url = Little::getUrlByHash('asdfg'); $this->assertEquals('http://laracasts.com', $url); }