Skip to content

Commit a0e6c6f

Browse files
committed
Merge pull request #18 from JohannLai/dev
Fixed some bug
2 parents 4847687 + 51d38ca commit a0e6c6f

17 files changed

Lines changed: 81 additions & 92 deletions

File tree

dnf/app/Http/Controllers/Backend/Blog/CategoryController.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ public function updateCategory(CategoryRequest $request)
7171
*/
7272
public function deleteCategory()
7373
{
74-
$id = Input::get('id',false);
75-
if($id==1)return Js::error(Lang::get('params.10007'));
74+
$id = Input::get('id',false);
75+
//if($id==1)return Js::error(Lang::get('params.10007'));
7676

7777
$category = CategoryModel::find($id);
7878
if(!$category)return Js::response(Lang::get('params.10005',false));
@@ -88,6 +88,7 @@ public function deleteCategory()
8888
foreach($article_ids as $article_id){
8989
$article = ArticleModel::where('id','=',$article_id)->delete();
9090
};
91+
9192
CategoryModel::deleteById($id);
9293
ActionModel::createOneAction('16',$category->category);
9394
return Js::response(null,true,false);

dnf/app/Http/Controllers/Backend/Product/ProductController.php

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,15 @@ public function __construct()
2929
$user = Auth::id();
3030
}
3131

32+
33+
public function getProduct()
34+
{
35+
$datas = ProductModel::all();
36+
return view('backend.product.index', compact('datas'));
37+
}
38+
39+
40+
3241
/**
3342
* 页面 :产品添加页面
3443
* @return Response
@@ -58,19 +67,6 @@ public function update()
5867

5968

6069

61-
/**
62-
* 页面:产品列表
63-
* @return Response
64-
*/
65-
public function getProduct()
66-
{
67-
$datas = ProductModel::all();
68-
69-
return view('backend.product.index', [
70-
'datas' => $datas,
71-
]);
72-
}
73-
7470

7571

7672

dnf/app/Http/Requests/ArticleRequest.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,14 @@ public function authorize()
2525
public function rules()
2626
{
2727
return [
28-
'title'=> "required|between:1,20",
28+
'title'=> "required|between:1,50",
2929
'author'=> 'required|between:1,15',
3030
'category_id'=>'required',
3131
'description' => 'required',
3232
'tag_id' => 'required',
3333
'source'=> 'required|between:1,60',
3434
'description' => 'required',
35-
'img_URL'=>'URL',
36-
'content'=>'required',
35+
'content'=>'required',
3736
];
3837
}
3938

@@ -54,10 +53,10 @@ public function messages()
5453
'category_id.required'=>$rules['required']['category_id'],
5554
'tag_id.required'=> $rules['required']['tag_id'],
5655
'description.required'=>$rules['required']['description'],
57-
'img_URL.url'=> $rules['URL'],
56+
'img_URL.url'=> $rules['required'],
5857
'source.required'=> $rules['required']['source'],
59-
'source.between'=>$rules['between']['source'].':min ~ :max',
60-
'content.required' => $rules['required']['content'],
58+
'source.between'=>$rules['between']['source'].':min ~ :max',
59+
'content.required' => $rules['required']['content'],
6160
];
6261
}
6362

dnf/app/Http/routes.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -549,19 +549,21 @@
549549

550550
Route::group(array('prefix' => 'product'),function () {
551551
#页面: 产品案例列表
552-
route::get('/',array(
553-
'as'=> 'backend_product_product_index',
554-
'uses'=>'Backend\Product\ProductController@getProduct'
552+
Route::get('/index',array(
553+
'as'=> 'backend_product_product_index',
554+
'uses'=>'Backend\Product\ProductController@getProduct'
555555
));
556556
#页面: 新建产品案例
557+
558+
557559
Route::get('/create',array(
558560
'as'=> 'backend_product_product_create',
559561
'uses'=>'Backend\Product\ProductController@_create'
560562
));
561563

562564
# 产品案例发表
563565
Route::post('/create',array(
564-
'as' => 'backend_blog_articles_create',
566+
'as' => 'backend_product_product_create',
565567
'uses' => 'Backend\Product\ProductController@createProduct'
566568
));
567569

dnf/app/Models/Backend/blog/Category.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class Category extends BaseModel{
2525

2626
public static function deleteById($id)
2727
{
28-
return static::delete($id);
28+
return static::destroy($id);
2929
}
3030

3131
/*

dnf/app/Models/Backend/product/Product.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class Product extends BaseModel {
1111
*/
1212
use SoftDeletes;
1313
protected $dates = ['deleted_at'];
14-
14+
1515

1616
protected $table = 'product';
1717

dnf/config/database.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@
5555
'mysql' => [
5656
'driver' => 'mysql',
5757
'host' => env('DB_HOST', 'localhost'),
58-
'database' => env('DB_DATABASE', 'forge'),
59-
'username' => env('DB_USERNAME', 'forge'),
60-
'password' => env('DB_PASSWORD', ''),
58+
'database' => env('DB_DATABASE', 'dnf'),
59+
'username' => env('DB_USERNAME', 'root'),
60+
'password' => env('DB_PASSWORD', '123qwe'),
6161
'charset' => 'utf8',
6262
'collation' => 'utf8_unicode_ci',
6363
'prefix' => env('DB_DATABASE_PREFIX', 'dnf_'),

dnf/resources/views/backend/aboutus/create.blade.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
@extends('backend.layouts.dashboard')
2-
3-
@section('title')
2+
('title')
43
{{ Lang::get('backend.title.aboutus.create') }}
54
@stop
65

dnf/resources/views/backend/blog/category.blade.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@
124124
</div>
125125
</div>
126126
</div>
127-
127+
128128
</div><!--/.modal-body-->
129129
<div class="modal-footer">
130130
<button type="submit" class="btn btn-primary" >保存</button>
@@ -173,7 +173,7 @@
173173
1
174174
var creator = $(this).parent().siblings("td.creator").text() ;
175175
$("#update-creator").val(creator);
176-
176+
177177
var updater_id = $(this).siblings($("#updater_id")).attr("value") ;
178178
$("#update-creator-id").val(updater_id);
179179

dnf/resources/views/backend/blog/create.blade.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<label for="title" class="col-sm-1 control-label">图片:</label>
2424
<div class="col-sm-10">
2525
<div class="has-feedback">
26-
<img width="300" id="img" src="{{{$data->img_URL or ''}}}">
26+
<img width="300" id="demo-img" src="{{{$data->img_URL or ''}}}">
2727
<input type="hidden" name="img_URL" id="img_URL" value="{{{$data->img_URL or ''}}}" >
2828
<br>
2929
<button class="btn btn-primary" type="button" onclick="uploadPic('demo-img');" style="padding: 8px 63px 9px 55px;"/>上传图片</button>
@@ -101,7 +101,7 @@
101101
<label for="description" class="col-md-1 control-label">{{ Lang::get('backend.form.blog.description')}}:</label>
102102
<div class="col-sm-9">
103103
<div class="has-feedback">
104-
<input type="text" class="form-control" name="description" id="description" value="{{ $data->description or old('description') }}" placeholder="@lang('backend.messages.input-source')">
104+
<input type="text" class="form-control" name="description" id="description" value="{{ $data->description or old('description') }}" placeholder="@lang('backend.messages.input-description')">
105105
<i class="fa fa-asterisk form-control-feedback"></i>
106106
</div>
107107
</div>

0 commit comments

Comments
 (0)