110. //--------------------------------------------------------------------------------------------------
111. public function view()
112. {
113. $auth = md5(date('Ymd'));
114. $key = \URI::key();
115. if ($key != $auth) {
116. DB::where('int:is_active', true);
117. }
118. $id = \URI::view();
119. $company = Perpa\Company::view($id);
120.
121.
122. if (empty($company)) {
123. redirect(URL::site('page-not-found'));
124. }
125.
126. if ($company->id !== $company->parent_id) {
127. $url = str_replace('view/'.$company->id, 'view/'.$company->parent_id, URL::current() );
128. Redirect::action( $url);
129.
330. break;
331. default:
332. $color = 'bg-grey';
333. }
334.
335. return $color;
336. }
337.
338.
339. public static function view(Int $id)
340. {
341. $where = [];
342. $where[] = ['int:id', $id];
343.
344. $perpa = \Perpa\Company::viewSql();
345. DB::where($where);
346. $company = DB::get($perpa . 'AS perpa')->row();
347. #output(DB::stringQuery());
348. return $company;
349. }