php laravel优化注释类

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php laravel优化注释类相关的知识,希望对你有一定的参考价值。

# laravel优化注释类
<?php
/**
 * Created by PhpStorm.
 * User: code
 * Date: 2018-12-14
 * Time: 09:08
 */

namespace App\Helper\Traits\Doc;

use App\Models\Model;
use Illuminate\Support\HigherOrderCollectionProxy;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Query\Builder as QueryBuilder;

/**
 * collection类
 *
 * @property-read HigherOrderCollectionProxy|Builder|QueryBuilder|Model $average
 * @property-read HigherOrderCollectionProxy|Builder|QueryBuilder|Model $avg        返回集合中所有项目的平均值
 * @property-read HigherOrderCollectionProxy|Builder|QueryBuilder|Model $contains   用来判断该集合是否含有指定的项目
 * @property-read HigherOrderCollectionProxy|Builder|QueryBuilder|Model $each       遍历集合中的项目,并将之传入给定的回调函数,返回当前上一个集合
 * @property-read HigherOrderCollectionProxy|Builder|QueryBuilder|Model $every      会创建一个包含第 n 个元素的新集合
 * @property-read HigherOrderCollectionProxy|Builder|QueryBuilder|Model $filter     以给定的回调函数筛选集合,只留下那些通过判断测试的项目
 * @property-read HigherOrderCollectionProxy|Builder|QueryBuilder|Model $first      返回集合中,第一个通过给定测试的元素
 * @property-read HigherOrderCollectionProxy|Builder|QueryBuilder|Model $flatMap
 * @property-read HigherOrderCollectionProxy|Builder|QueryBuilder|Model $groupBy    根据给定的键替集合内的项目分组
 * @property-read HigherOrderCollectionProxy|Builder|QueryBuilder|Model $keyBy
 * @property-read HigherOrderCollectionProxy|Builder|QueryBuilder|Model $map        和each一样,但集合内部是map之后的调用方法的返回结果的集合
 * @property-read HigherOrderCollectionProxy|Builder|QueryBuilder|Model $max
 * @property-read HigherOrderCollectionProxy|Builder|QueryBuilder|Model $min
 * @property-read HigherOrderCollectionProxy|Builder|QueryBuilder|Model $partition
 * @property-read HigherOrderCollectionProxy|Builder|QueryBuilder|Model $reject      以给定的回调函数筛选集合
 * @property-read HigherOrderCollectionProxy|Builder|QueryBuilder|Model $sortBy
 * @property-read HigherOrderCollectionProxy|Builder|QueryBuilder|Model $sortByDesc
 * @property-read HigherOrderCollectionProxy|Builder|QueryBuilder|Model $sum
 * @property-read HigherOrderCollectionProxy|Builder|QueryBuilder|Model $unique
 */
trait DocCollectionTrait
{

}
<?php
/**
 * Created by PhpStorm.
 * User: code
 * Date: 2018-12-14
 * Time: 16:59
 */

namespace App\Repositories\Common\Traits\Doc;

use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Query\Builder as QueryBuilder;

/**
 * model类
 *
 * @mixin \Illuminate\Database\Eloquent\Builder
 *
 * @method static $this|Builder|QueryBuilder where($column, $operator = null, $value = null, $boolean = 'and')
 * @method static $this|Builder|QueryBuilder whereIn($column, $values, $boolean = 'and', $not = false)
 * @method static mixed insert(array $values)   // 看\Illuminate\Database\Query\Builder::insert
 * @method static mixed create(array $values)
 * @method static $this|Builder|QueryBuilder orderBy($column, $direction = 'asc')
 * @method static $this|Builder|QueryBuilder firstOrNew(array $attributes)
 * @method static $this|mixed|QueryBuilder find($id, $columns = ['*'])
 * @method static $this|mixed|QueryBuilder findOrFail($id, $columns = ['*']) 查找数据,如果没有就报错
 * @method static $this|Builder|QueryBuilder updateOrCreate(array $attributes, array $values = [])
 * @method static QueryBuilder from($table)
 *
 * @method DocCollectionTrait get($columns = ['*']) 查找列表数据
 *
 * @package App\Repositories\Common\Traits\Doc
 */
trait DocModelTrait
{

}

以上是关于php laravel优化注释类的主要内容,如果未能解决你的问题,请参考以下文章

10个技巧优化PHP程序Laravel 5框架

Laravel框架开发规范-修订版

理解laravel---1.2 控制反转2

php性能优化 --- laravel 性能优化

laravel 性能提升

优化PHP程序Laravel 5框架的10个技巧