Пример #1
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     //
     $total_trusts = Trusts::count();
     $definitions = Definitions::all();
     $years = Trusts::select('year')->groupBy('year')->lists('year');
     return view('watsonv2', ['total' => $total_trusts, 'years' => $years, 'definitions' => $definitions]);
 }
Пример #2
0
 public function index()
 {
     $categories = ['branch', 'type', 'scope', 'theme', 'unit', 'settlor', 'fiduciary'];
     $definitions = Definitions::all();
     $trusts = Trusts::select('id', 'registry', 'income', 'yield', 'expenses', 'availability', 'year', 'initial_date')->get();
     $registries = Trusts::select("id", "registry", "designation")->groupBy("registry")->get();
     return view('data', ['trusts' => $trusts, 'categories' => $categories, 'definitions' => $definitions, 'registries' => $registries]);
 }
Пример #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
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index($registry)
 {
     //
     $trusts = Trusts::where('registry', $registry)->orderBy('year', 'asc')->get()->toArray();
     if (empty($trusts)) {
         $trust = Trusts::find($registry)->toArray();
         $trusts = [$trust];
     } else {
         $trust = $trusts[0];
     }
     $definitions = Definitions::all();
     return view('Gregson', ['trusts' => $trusts, 'selected' => $trust, 'definitions' => $definitions]);
 }
Пример #5
0
 public function registry(Request $request, $registry = null)
 {
     // [ NO SE SELECCIONA NINGÚN REGISTRO ]
     if (empty($registry)) {
         // obtiene un registro al azar
         $registry = Trusts::all()->lists('registry')->random();
         // obtiene todos los fideicomisos con el mismo registro
         $response = Trusts::where('registry', $registry)->select($this->registry_fields)->get();
         // los regresa en JSONxCORS
         return response()->json($response)->header('Access-Control-Allow-Origin', '*');
     } else {
         // separa los registros
         $list = explode('|', $registry);
         // obtiene todos los fideicomisos con el mismo registro
         $response = Trusts::whereIn('registry', $list)->select($this->registry_fields)->get();
         // los regresa en JSONxCORS
         return response()->json($response)->header('Access-Control-Allow-Origin', '*');
     }
 }
Пример #6
0
 public function updateTrust(Request $request, $id)
 {
     $trust = Trusts::find($id);
     $trust->update($request->all());
     return redirect('trusts/update/' . $trust->id);
 }
Пример #7
0
 public function Categories($name, $page = 0, $category = "branch", $year = 0, $textfields = 0, $full = 0)
 {
     $trusts = $year ? Trusts::where("year", $year) : Trusts::where("year", ">", "2000");
     if (in_array($category, $this->categories)) {
         $trusts->where($category, $name);
     } else {
         $trusts->where("branch", $name);
     }
     $fields = ["id"];
     $fields = array_merge($fields, $this->num_fields, $this->string_fields);
     if ($textfields) {
         $fields = array_merge($fields, $this->text_fields);
     }
     $trusts->select($fields);
     if (!$full) {
         $trusts->groupBy('registry');
     }
     $trusts = $trusts->orderBy("id")->skip($page * self::MAX_PAGE_SIZE)->take(self::MAX_PAGE_SIZE)->get();
     return response()->json($trusts)->header('Access-Control-Allow-Origin', '*');
 }
Пример #8
0
 /**
  * Regresa el número de fideicomosos en la búsqueda
  *
  * @return Number
  */
 private function _count_result($settings)
 {
     $query = Trusts::whereIn('year', $settings['years']);
     $fields = array_merge($this->string_fields, $this->text_fields);
     $query = $query->where(array_shift($fields), 'like', '%' . $settings['query'] . '%');
     foreach ($fields as $field) {
         $query = $query->orWhere($field, 'like', '%' . $settings['query'] . '%');
     }
     return $query->count();
 }