2myPersimmon:laravel项目

非归类用法

 

1简易信息聚合(也叫聚合内容)是一种RSS基于XML标准:标准的XML格式

 

 

插件Suin\RSSWriter; 文章,有时间实现以下https://www.cnblogs.com/longmsdu/articles/5043561.html

 

 

3

foreach ($lists as $key => &$comment) {//就不用使用$list[$key][]’’

$comment[‘md5’]=md5($coommet[‘email’]);

}

4Parsedown 是PHP 的 Markdown 解析器

$comment_text = strip_tags($request->markdown);

$comment->content = (new \Parsedown())->text($comment_text);

$comment->markdown = $request->markdown;

 

5

$this->client_id = $request->ip();//好像是request还是获取ip

 

6七牛上传

通过这个网站生成头像并上传到七牛

public function cacheGravatar($email)

{

    $gravatar = sprintf("https://cn.gravatar.com/avatar/%s?d=identicon&s=60", md5(strtolower(trim($email))));

    $disk = QiniuStorage::disk('qiniu');

    $fileName = 'avatar_' . date('Y-m-d');

    $disk->fetch($gravatar, $fileName);

    $download = $disk->downloadUrl($fileName, config('filesystems.disks.qiniu.protocol'));

    return $download->getUrl();

}

 

7 php artisan route:list --name=categorys

 Domain | Method    | URI                           | Name              | Action                                                   | Middleware |

+--------+-----------+-------------------------------+-------------------+----------------------------------------------------------+------------+

|        | GET|HEAD  | myp/categorys                 | categorys.index   | App\Http\Controllers\Backend\CategorysController@index   | web,auth   |

|        | POST      | myp/categorys                 | categorys.store   | App\Http\Controllers\Backend\CategorysController@store   | web,auth   |

|        | GET|HEAD  | myp/categorys/create          | categorys.create  | App\Http\Controllers\Backend\CategorysController@create  | web,auth   |

|        | PUT|PATCH | myp/categorys/{category}      | categorys.update  | App\Http\Controllers\Backend\CategorysController@update  | web,auth   |

|        | GET|HEAD  | myp/categorys/{category}      | categorys.show    | App\Http\Controllers\Backend\CategorysController@show    | web,auth   |

|        | DELETE    | myp/categorys/{category}      | categorys.destroy | App\Http\Controllers\Backend\CategorysController@destroy | web,auth   |

|        | GET|HEAD  | myp/categorys/{category}/edit | categorys.edit    | App\Http\Controllers\Backend\CategorysController@edit    | web,auth

 

8

NauxLiu/auto-correct

自动给中英文之间加入合理的空格并纠正专用名词大小写

 

$categorys->category_description = $correct->convert($request->category_description);

9BaiduPush

(必须) 接入了baidu ping服务,当发布文章的时候,自动向百度搜索引擎提交地址。

这是什么

 

10软删除

要启用模型的软删除功能,可以使用模型上的Illuminate\Database\Eloquent\SoftDeletestrait并添加deleted_at列到$dates属性:

class Posts extends Model

{

    use SoftDeletes;

 

    /**

     * 应该被调整为日期的属性

     *

     * @var array

     */

    protected $dates = ['deleted_at'];

 

包含软删除模型

正如上面提到的,软删除模型将会自动从查询结果中排除,但是,如果你想要软删除模型出现在查询结果中,可以使用withTrashed方法:

$flights = App\Flight::withTrashed()

                ->where('account_id', 1)

                ->get();

withTrashed方法也可以用于关联查询中:

$flight->history()->withTrashed()->get();

6.4.2 只获取软删除模型

onlyTrashed方法之获取软删除模型:

$flights = App\Flight::onlyTrashed()

                ->where('airline_id', 1)

                ->get();

6.4.3 恢复软删除模型

有时候你希望恢复一个被软删除的模型,可以使用restore方法:

$flight->restore();

你还可以在查询中使用restore方法来快速恢复多个模型:

App\Flight::withTrashed()

        ->where('airline_id', 1)

        ->restore();

 

完全真正的删除

$result = Posts::whereIn('id', $request->ids)->forceDelete();

 

11设置密码

public function update(Request $request)

{

    $this->validate($request, [

        'password'=>'required|min:8|confirmed',

        'password_confirmation' => 'required|min:8'

    ]);

    $result = $request->user()->fill([

        'password' => Hash::make($request->password)

    ])->save();

    return response()->json(['status' => !$result ? 'error' : 'success']);

}//laravel用的Hash:make

http://laravelacademy.org/post/203.html

 

12百度翻译BaiduTranslates

 

public function translates($params)

{

    $translates = new BaiduTranslates();

    $data = $translates->exec($params);

    return $data;

}

 

 

+++++

1migrate

2qiniu封装//FileController.php

3怎么处理内容,过滤内容,markdown

4视图

5 好用的 Simplemde Markdown 编辑器

 

posted @ 2017-11-15 23:51  克维拉  阅读(139)  评论(0)    收藏  举报