Пример #1
0
 public function index()
 {
     $users = User::all()->count();
     $trusts = Trusts::groupBy("registry")->get()->count();
     $articles = Article::all()->count();
     return view('admin/dashboard')->with(['users' => $users, 'trusts' => $trusts, 'articles' => $articles]);
 }
Пример #2
0
 public function treemap($cat = "branch")
 {
     $year_max = max(Trusts::select("year")->groupBy("year")->get()->toArray());
     $year = $year_max["year"];
     $definitions = Definitions::all();
     $category = $definitions->where("name", $cat)->first();
     $category = $category ? $category : $definitions->where("name", "branch")->first();
     $trusts = Trusts::groupBy("registry")->select("id", "branch", "type", "scope", "theme", "unit", "settlor", "fiduciary", 'income', 'yield', 'expenses', 'availability', 'initial_amount', 'year')->where("year", $year)->get();
     return view("single-graph")->with(["year" => $year, "trusts" => $trusts, "category" => $category]);
 }
Пример #3
0
 public function index()
 {
     $main_article = Article::all()->first();
     $articles = Article::all();
     $categories = ['branch', 'type', 'scope', 'theme', 'unit', 'settlor', 'fiduciary'];
     $year_max = max(Trusts::select("year")->groupBy("year")->get()->toArray());
     $year = $year_max["year"];
     $definitions = Definitions::all();
     $category = $definitions->where("name", "branch")->first();
     $trusts = Trusts::groupBy("registry")->select("id", "branch", "type", "scope", "theme", "unit", "settlor", "fiduciary", 'income', 'yield', 'expenses', 'availability', 'initial_amount', 'year')->where("year", $year)->get();
     return view('home')->with(['main_article' => $main_article, 'articles' => $articles, 'file_url' => '/images/articles/', 'months' => $this->months, 'trusts' => $trusts, 'categories' => $categories, 'category' => $category, 'definitions' => $definitions, 'year' => $year]);
 }
Пример #4
0
 public function Trusts($orderBy = "availability", $year = 0, $order = 0, $textfields = 0)
 {
     $query = Trusts::groupBy("registry");
     if ($year) {
         $query->where("year", $year);
     }
     if (in_array($orderBy, $this->num_fields)) {
         $query->orderBy($orderBy . "_num", $order ? "desc" : "asc");
     } else {
         $query->orderBy("availability_num", $order ? "desc" : "asc");
     }
     $fields = ["id"];
     $fields = array_merge($fields, $this->num_fields, $this->string_fields);
     $fields[] = "designation";
     if ($textfields) {
         $fields = array_merge($fields, $this->text_fields);
     }
     $query->select($fields);
     $response = $query->get();
     return response()->json($response)->header('Access-Control-Allow-Origin', '*');
 }