maikealame/laravel-auto

Laravel 辅助工具,为您的项目几乎提供一切功能

安装量: 4,400

依赖者: 0

建议者: 0

安全: 0

星标: 42

关注者: 5

分支: 2

开放问题: 2

类型:package

1.1.3 2023-01-13 23:02 UTC

README

logo

Laravel Auto

Laravel 辅助包,提供与其他任何工具相比都更为自动化的列表功能,包括筛选、排序和分页。

Wiki: https://maikealame.github.io/laravel-auto/

Latest Version Software License Total Downloads

您可以根据需要创建自己的布局和样式,不包括任何布局的 HTML/CSS!

此包仅提供 Eloquent 中非常自动化的查询,并使用 Blade 指令。

您可以使用它而不使用 Blade 指令,例如 Vue.js 和 React,但需要手动实现后端调用和布局渲染。

table image

table image

$categories = Topic::from("topics as t")
            ->select("t.*")
            ->leftJoin("portals as p", "p.id","=","t.portal_id")
            ->autoWhere()->autoSort()->autoPaginate();

table image

table image

if (Request::has("filter")) {
    if (isset(Request::get("filter")['keyword'])) {
        $keyword = Request::get("filter")['keyword'];
        Auto::setField("notifications.title", $keyword);
        Auto::setField("notifications.description", $keyword);
    }
}
$notifications = Notification::select("notifications.*", "notification_users.readed_at")
            ->groupBy("notifications.id")
            ->leftJoin("notifications_users", "notifications.id", "=", "notifications_users.notification_id")
            ->leftJoin("notifications_roles", "notifications.id", "=", "notifications_roles.notification_id")
            ->leftJoin("notifications_departments", "notifications.id", "=", "notifications_departments.notification_id")
            ->autoWhere(['or' => ["notifications.title", "notifications.description"]])
            ->autoSort(["notifications.updated_at", "desc"])->autoPaginate();

table image

$enterprises = Enterprises::from("enterprises as e"))
            ->select("e.*")
            ->leftJoin("enterprise_indicators_enterprises as iei","eie.enterprise_id","=","e.id")
            ->groupBy("e.id")
            ->autoWhere()->autoSort()->autoPaginate();

table image

请参阅 https://maikealame.github.io/laravel-auto/

  1. 视图
  2. 控制器
  3. 模型