1 | <?php |
||
13 | class BaseController extends Controller |
||
14 | { |
||
15 | /** |
||
16 | * @var string Path to js bundle |
||
17 | */ |
||
18 | public $jsBundle = 'front.js'; |
||
19 | /** |
||
20 | * @var string Path to css bundle |
||
21 | */ |
||
22 | public $cssBundle = 'front.css'; |
||
23 | |||
24 | /** |
||
25 | * @return string Return CSS bundle |
||
26 | */ |
||
27 | public function getCssBundle() |
||
31 | |||
32 | /** |
||
33 | * @return string Return JS bundle |
||
34 | */ |
||
35 | public function getJsBundle() |
||
39 | |||
40 | /** |
||
41 | * Load the model based on its primary key value or WHERE condition. |
||
42 | * If the model is not found or access denied, a 404 HTTP exception will be thrown. |
||
43 | * |
||
44 | * @param ActiveRecord $model |
||
45 | * @param int|array $id primary key or WHERE condition |
||
46 | * @param callable $checkAccess |
||
47 | * @return ActiveRecord |
||
48 | * @throws NotFoundHttpException |
||
49 | */ |
||
50 | public function loadModel($model, $id, $checkAccess = null) |
||
60 | |||
61 | /** |
||
62 | * Show alert message |
||
63 | * |
||
64 | * @param string $type success|error |
||
65 | * @param string $message |
||
66 | * @param string $url If null go Home |
||
67 | */ |
||
68 | public function alert($type, $message, $url = null) |
||
73 | |||
74 | /** |
||
75 | * HTTP Response |
||
76 | * |
||
77 | * @param mixed $data |
||
78 | * @param string $format The response format |
||
79 | * @see http://www.yiiframework.com/doc-2.0/yii-web-response.html |
||
80 | */ |
||
81 | public function response($data, $format = \yii\web\Response::FORMAT_JSON) |
||
86 | } |
||
87 |