/** * Retorna o utltimo id informado. * @return mixed */ public static function getRouteId($name = null) { $route = $name === null ? Route::current() : Route::getRoutes()->getByName($name); $last = Str::last(Str::before($route->uri())); $id_name = Str::startsWith($last, '{') ? str_replace(['{', '}'], '', $last) : sprintf('%s_id', $last); return Route::input($id_name); }
public function testBefore() { $str = Str::before('NetForce/Sistemas/Ultima'); $this->assertEquals('NetForce/Sistemas', $str); }