我的形式有一个模态
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel">Image Tag Description</h4>
</div>
<div class="modal-body">
<p id="desc">
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.
</p>
<h2 id="cost">Cost : 20$</h2>
</div> …Run Code Online (Sandbox Code Playgroud) 我使用了自定义验证.但它不起作用.这是我的模特
class Manufacture extends \yii\db\ActiveRecord
{
public function rules()
{
return [
[['model_no'], 'safe'],
['model_no', 'customValidation', 'skipOnEmpty' => false, 'skipOnError' => false],
];
}
public function customValidation($attribute, $params)
{
if($this->model_no=='test')
{
$this->addError($attribute,'add proper data.');
}
}
}
Run Code Online (Sandbox Code Playgroud)
在控制器中
public function actionCreate()
{
if ($model->load(Yii::$app->request->post())) {
if ($model->validate()) {
//some code
}
}
}
Run Code Online (Sandbox Code Playgroud)
这里我在安全中添加了属性,但我的错误仍然没有在视图中显示.
我使用dropzone扩展来上传图像.它像魅力一样工作.但我想上传文档文件doc,docx,xls,xlsx.
$this->widget('ext.dropzone.EDropzone', array(
'model' => $model,
'attribute' => 'image_name',
'url' => Yii::app()->request->baseUrl.'/jobMaster/ImageUpload',
'mimeTypes' => array('image/jpeg', 'image/png','image/jpg'),
'onSuccess' => 'succcesupload',
//'maxFilesize'=> 5,
'options' => array(
'addRemoveLinks'=> true,
'removedfile'=> "js:function(file) {
var name = file.name;
$.ajax({
type: 'POST',
url: '".$this->createUrl('/jobMaster/deleteImageUpload')."',
data: 'id='+name,
dataType: 'html'
});
var _ref;
return (_ref = file.previewElement) != null ? _ref.parentNode.removeChild(file.previewElement) : void 0;
}"
)
));
Run Code Online (Sandbox Code Playgroud)
但我不知道如何改变这个小部件.
我改变
'mimeTypes' => array('image/jpeg', 'image/png','image/jpg','file/doc','file/xls','file/xlsx','file/docx'),
Run Code Online (Sandbox Code Playgroud)
但它不起作用.有答案吗?
我正在使用laravel 5.1
我正在使用laravel路线。
我使用Form / Html进行插入/更新,但卡在更新记录的路由中。
这是在routes.php中重定向到编辑页面的路由
Route::get('/company/edit/{id}','CompanyMasterController@edit');
Run Code Online (Sandbox Code Playgroud)
在我的CompanyMasterController.php中
public function edit($id)
{
$company = CompanyMasters::find($id);
return view('companymaster.edit', compact('company'));
}
Run Code Online (Sandbox Code Playgroud)
我在edit.blade.php中的操作
{!! Form::model($company,['method' => 'PATCH','action'=>['CompanyMasterController@update','id'=>$company->id]]) !!}
Run Code Online (Sandbox Code Playgroud)
并在routes.php中执行此操作的路线
Route::put('/company/update/{id}','CompanyMasterController@update');
Run Code Online (Sandbox Code Playgroud)
我的控制器动作用于更新。
public function update($id)
{
$bookUpdate=Request::all();
$book= CompanyMasters::find($id);
$book->update($bookUpdate);
return redirect('/company/index');
}
Run Code Online (Sandbox Code Playgroud)
现在,当我单击提交按钮时,它会给我:
RouteCollection.php中的MethodNotAllowedHttpException
我究竟做错了什么?
我是laravel的全新人物.我安装了laravel 5.2.我在laravel完成了CRUD.现在我想整合laravel身份验证包.所以我选择zizaco \委托.
我按照文档链接的每个步骤.但我不明白出了什么问题.在doc中没有提到我必须在哪个文件中添加以下代码.
$owner = new Role();
$owner->name = 'owner';
$owner->display_name = 'Project Owner'; // optional
$owner->description = 'User is the owner of a given project'; // optional
$owner->save();
$admin = new Role();
$admin->name = 'admin';
$admin->display_name = 'User Administrator'; // optional
$admin->description = 'User is allowed to manage and edit other users'; // optional
$admin->save();
Run Code Online (Sandbox Code Playgroud)
和其他下面的代码在文档中.
甚至
class User extends Model implements AuthenticatableContract,
AuthorizableContract,
CanResetPasswordContract
Run Code Online (Sandbox Code Playgroud)
没有提到有关实现类.
我做
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
use Illuminate\Contracts\Auth\Access\Authorizable as AuthorizableContract;
use …Run Code Online (Sandbox Code Playgroud) 我在我的项目之一中使用 Imagick 扩展。这对我来说是新的。
以下是我的代码。
$pdfPath = $config['upload_path'] . '/' . $fileName;
$im = new imagick();
$im->setResolution(300, 300);
$im->readImage($pdfPath);
$im->setImageFormat('jpeg');
$im->setImageCompression(imagick::COMPRESSION_JPEG);
$im->setImageCompressionQuality(100);
$im->writeImage($config['upload_path'] . '/' . str_replace('pdf', 'jpeg', $fileName));
$im->clear();
$im->destroy();
Run Code Online (Sandbox Code Playgroud)
这使我的图像质量非常差。所有文本都转换为黑色背景。图像也无法正确显示。请参阅下图,该图是从 PDF 转换而来的。
请帮我。
php ×3
jquery ×2
dropzone.js ×1
entrust ×1
fullcalendar ×1
imagick ×1
javascript ×1
jpeg ×1
laravel-5.1 ×1
laravel-5.2 ×1
pdf ×1
yii ×1