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.
324. break;
325. default:
326. $color = 'bg-grey';
327. }
328.
329. return $color;
330. }
331.
332.
333. public static function view(Int $id)
334. {
335. $where = [];
336. $where[] = ['int:id', $id];
337.
338. $perpa = \Perpa\Company::viewSql();
339. DB::where($where);
340. $company = DB::get($perpa . 'AS perpa')->row();
341. #output(DB::stringQuery());
342. return $company;
343. }