草庐IT

control-delete

全部标签

php - 从 SilverStripe UploadField 中删除 "Edit"和 "Delete from files"

通过Silverstripe3.2我正在使用UploadFieldinafrontendform它工作正常,看起来也不错:但是我想从上传的文件中删除不需要的“编辑”和“从文件中删除”操作。这是我正在使用的UploadField初始化代码://uploadfield$uploadField=newUploadField('File','UploadFile');$uploadField->setCanAttachExisting(false);$uploadField->setCanPreviewFolder(false);$uploadField->relationAutoSettin

php - 奏鸣曲管理员 : Prevent Admin From Deleting His Own Account

我在symfony2项目中使用sonatadmin。有时管理员用户可能会不小心删除自己的帐户。如何防止管理员用户删除自己的帐户?谢谢! 最佳答案 要防止管理员删除自己的帐户,您需要按照ADVANCEDCONFIGURATION为奏鸣曲用户定义自己的CRUDControlleradmin:#AdminClassesuser:class:Sonata\UserBundle\Admin\Entity\UserAdmincontroller:YourUserBundle:CRUDtranslation:SonataUserBundle然后在

php - 我们可以在 controller laravel 中使用 helper 吗?

我是laravel的新手,我在Cakephp方面有很好的经验。在Cakephp中,我们仅对View使用帮助程序但我已经在laravel中看到了我退出的代码,我们也在Controller中使用了帮助程序。在controller中使用helper好不好?如果是,那么请告诉我,在Controller中使用助手有什么缺点或优点?请建议我... 最佳答案 如果您谈论的是全局Laravelhelpers,那么是的,您可以在应用程序的任何地方使用它们(Controller、模型、View、中间件、routes.php等),因为它们是全局助手。您还

php - 如何在不使用 ZF2.. 中的任何 Controller 对象的情况下访问 module.php 中的 Controller 插件?

我想在module.php中添加错误处理以在flashmessenger中添加所有错误消息并重定向到特定页面(在我的要求中):publicfunctionhandleError(MvcEvent$e){$exception=$e->getParam('exception');$controller=$e->getTarget();//echo$exception->getMessage();exit;if(!$e->getApplication()->getServiceManager()->get('AuthService')->hasIdentity()){$controller-

php - Laravel 后 Controller 方法和 PostController 不工作

我的Laravel博客项目postcontroller的get方法可以工作,但post方法不工作。我重定向Post方法。但是根据我的代码,它应该返回到我的管理页面。我的Controller代码是validate($request,['title'=>'required|max:120|unique:posts','author'=>'required|max:80','body'=>'required']);$post=newPost();$post->title=$request['title'];$post->author=$request['author'];$post->bod

php - Laravel Controller 获取限制数量的项目

在我的Controller中$items=Item::all();我只想得到前6个项目如何更改代码? 最佳答案 使用take()方法:$items=Item::take(6)->get(); 关于php-LaravelController获取限制数量的项目,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/questions/38930388/

php - 在 Laravel 5.1 中找不到 "Class ' app\Http\Controllers\Controller'

我是Laravel的新手,在学习教程时遇到此错误。这是我在“testController.php”中的代码。这是我的“routes.php”。'test','uses'=>'testController@getHome',]);Route::get('about',['as'=>'about','uses'=>'testController@getAbout',]);我收到这个错误:Class'app\Http\Controllers\Controller'notfound我该如何修复这个错误? 最佳答案 让我们一步一步来。1。检查

php - 如何在 Controller laravel 中使用获取对象

我在Controller中有一个函数可以删除类别及其图像文件。但我无法访问路径属性。我收到此错误未定义属性:Illuminate\Database\Eloquent\Collection::$path。它正在返回路径,但我无法使用它。publicfunctionremove($id){//$category=Category::find($id)->delete();$category_image=CategoryImage::where('category_id','=',$id)->get(['path']);echo$category_image->path;//returnba

php - 将数据从 Controller 传递到 Blade View laravel

我正在尝试通过href将参数发送到从事件列表到事件页面的页面。我的路线是Route::get('eventpage','EventController@index')->name('eventpage');我的事件Controller是query('id');$event=DB::table('events')->where('id',$id)->get();$pics=DB::table('pictures')->where('event_id',$id)->get();$n=count($pics);//thenumberofpicturesforaparticulareventr

PHP Symfony2 : Delete a temp file after response

我有一个生成图像并在响应中返回图像的Controller。useFOS\RestBundle\Controller\AnnotationsasRest;useSymfony\Component\HttpFoundation\BinaryFileResponse;.../***@Rest\Get("/image/{name}")*/publicfunctiongetImage($name){$imageService=$this->get('image.service');$tempImage=$imageService->genImage($name);returnnewBinaryF