我有一个前缀为admin
的路由组:
Route::group(['prefix' => 'admin'], function(){
Route::get('/', 'AdminController@method');
});
我想要/admin/dashboard/
和/admin/blogmanager/
这样的网址,基本上,{strong> admin
前缀下的任意网址都要映射到相同的控制器method
没有逐个列出每个网址。我想要一个url模式接受所有网址,只要它以admin
为前缀
答案 0 :(得分:1)
你可以用func renderer(renderer: SCNSceneRenderer, didRenderScene scene: SCNScene, atTime time: NSTimeInterval) {
if let texture = AppManager.sharedInstance.currentSceneDrawable?.texture where !texture.framebufferOnly {
AppManager.sharedInstance.currentSceneDrawable = nil
// Get image from texture
let image = texture.toImage()
// Use the image for video recording
}
}
extension MTLTexture {
func bytes() -> UnsafeMutablePointer<Void> {
let width = self.width
let height = self.height
let rowBytes = self.width * 4
let p = malloc(width * height * 4) //Beware for memory leak
self.getBytes(p, bytesPerRow: rowBytes, fromRegion: MTLRegionMake2D(0, 0, width, height), mipmapLevel: 0)
return p
}
func toImage() -> UIImage? {
var uiImage: UIImage?
let p = bytes()
let pColorSpace = CGColorSpaceCreateDeviceRGB()
let rawBitmapInfo = CGImageAlphaInfo.NoneSkipFirst.rawValue | CGBitmapInfo.ByteOrder32Little.rawValue
let bitmapInfo:CGBitmapInfo = CGBitmapInfo(rawValue: rawBitmapInfo)
let selftureSize = self.width * self.height * 4
let rowBytes = self.width * 4
let provider = CGDataProviderCreateWithData(nil, p, selftureSize, {_,_,_ in })!
if let cgImage = CGImageCreate(self.width, self.height, 8, 32, rowBytes, pColorSpace, bitmapInfo, provider, nil, true, CGColorRenderingIntent.RenderingIntentDefault) {
uiImage = UIImage(CGImage: cgImage)
}
return uiImage
}
func toImageAsJpeg(compressionQuality: CGFloat) -> UIImage? {
}
}
方法做到这一点,但它已经从Laravel中删除了,我觉得它很好,因为所有路径都应该是明确的。
您可以使用CRUD控制器的Route::resource()
。
答案 1 :(得分:0)
您可以使用{any}语法:
Route::group(['prefix' => 'admin'], function(){
Route::get('{any}', 'AdminController@handle');
});
具有前缀admin的每个路由都将由AdminController处理。
如果您需要以下网址:/ admin / profile / post,...使用:
Route::get('{any}', 'AdminController@handle')->where('any', '.*');
答案 2 :(得分:0)
您可以使用:
Route::group(['prefix' => 'admin'], function(){
Route::get('{any_url?}', 'AdminController@method');
});
这个带有前缀admin的所有路由都将由AdminController处理。 你的AdminController应该是这样的。
Class AdminController extends Controller{
public function method($any_url = NULL){
//Put some conditions here
}
}