/** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @param string $content * @return mixed */ public function handle($request, Closure $next, $content) { $title_separator = Option::get('title_separator'); //获取标题的分隔符设置值 Title::addPreffix($content . $title_separator); return $next($request); }
/** * @param int $offset * @param int $count * @return array * @throws \Exception */ public static function getReviews($offset = 0, $count = 20) { $response = Vk::call('board.getComments', ['group_id' => Option::get('vk-group-id'), 'topic_id' => Option::get('vk-board-topic-id'), 'offset' => $offset, 'count' => $count]); $response = $response['response']; $reviews = array_slice($response['comments'], 1); return [$response['comments'][0], $reviews]; }
public function posts() { $data = ['group' => ['id' => Option::get('vk-group-id'), 'name' => Option::get('vk-group-name'), 'photo' => Option::get('vk-group-photo'), 'integrated-date' => Carbon::createFromTimestamp(Option::get('vk-group-integrated-date'))]]; if (Option::has('vk-group-updated-date')) { $data['group']['updated-date'] = Carbon::createFromTimestamp(Option::get('vk-group-updated-date')); } $posts = Post::where('deleted_at', '=', null)->paginate(6); $data['posts'] = $posts; $display = view('admin.integration.imports.posts', $data)->render(); return Admin::view($display, 'Записи со стены'); }
public function save(SettingsFormRequest $request) { $option = new Option(); if ($option->get('main', 'status') == "firstrun") { $option->set('main', 'status', 'running'); } $option->set('settings', 'name', $request->sitename); $option->set('settings', 'tagline', $request->tagline); $success = "Settings saved."; return View::make('admin.settings')->with('success', $success); }
/** * Bootstrap any application services. * * @return void */ public function boot() { setlocale(LC_ALL, 'ru_RU.UTF-8'); Carbon::setLocale(config('app.locale')); \Shortcode::register('slider', '\\App\\Shortcode\\Slider'); \Shortcode::register('section', '\\App\\Shortcode\\Section'); \Shortcode::register('iframe', '\\App\\Shortcode\\Iframe'); \Shortcode::register('timeline', '\\App\\Shortcode\\Timeline'); if (\DB::getDoctrineSchemaManager()->tablesExist('options')) { Option::observe(new OptionObserver()); if (Option::has('vk-user-token')) { Vk::setAccessToken(Option::get('vk-user-token')); } } }
/** * @param $topic_id * @return mixed * @throws \Exception */ public function boardTopicSet($topic_id) { $response = Vk::call('board.getComments', ['group_id' => Option::get('vk-group-id'), 'topic_id' => $topic_id, 'count' => 0]); $comments = $response['response']['comments'][0]; Option::set('vk-board-topic-id', $topic_id); Option::set('vk-board-integrated-date', time()); Option::set('vk-reviews-count', $comments); Session::flash('flash_message', 'vk-board-topic-integrated'); Session::flash('flash_type', 'success'); return redirect(route('admin.integration')); }
/** * @param $attachmentData * @param $data */ protected static function _prepareAttachmentPoll($attachmentData, &$data) { $pollData = $attachmentData['poll']; $data['type'] = $attachmentData['type']; $data['id'] = Option::get('vk-group-id') . '_' . $pollData['poll_id']; $data['title'] = 'В записи имеется голосование, подробности смотрите в источнике.'; }
<?php use App\Option; /* |-------------------------------------------------------------------------- | Application Routes |-------------------------------------------------------------------------- | | Here is where you can register all of the routes for an application. | It's a breeze. Simply tell Laravel the URIs it should respond to | and give it the controller to call when that URI is requested. | */ Route::group([], function () { //设置站点名为后缀 Title::addSuffix(Option::get('site_name')); Route::get('/', ['middleware' => 'pretitle:首页', function () { return view('welcome'); }]); // Authentication routes... Route::get('auth/login', 'Auth\\AuthController@getLogin'); Route::post('auth/login', 'Auth\\AuthController@postLogin'); Route::get('auth/logout', 'Auth\\AuthController@getLogout'); // Registration routes... Route::get('auth/register', 'Auth\\AuthController@getRegister'); Route::post('auth/register', 'Auth\\AuthController@postRegister'); });
<?php use App\Option; Admin::menu()->url('/')->label('Dashboard')->icon('fa-dashboard'); Admin::menu(\App\Page::class)->label('Страницы')->icon('fa-file-text'); Admin::menu(\App\Slide::class)->label('Слайды')->icon('fa-picture-o'); Admin::menu(\App\ScheduleAndCost::class)->label('Расписание и стоимость')->icon('fa-list-alt'); Admin::menu()->url('integration')->label('Интеграция')->icon('fa-angle-double-up')->items(function () { Admin::menu()->url('integration')->label('Подключение')->icon('fa-plus'); if (\DB::getDoctrineSchemaManager()->tablesExist('options')) { if (!is_null(Option::get('vk-user-id')) && !is_null(Option::get('vk-group-id'))) { Admin::menu(\App\Post::class)->label('Посты')->icon('fa-file-text-o'); if (!is_null(Option::get('vk-board-topic-id'))) { Admin::menu(\App\Review::class)->label('Отзывы')->icon('fa-comments-o'); } } } }); Admin::menu()->url('history')->label('История')->icon('fa-history')->items(function () { Admin::menu(\App\HistoryDate::class)->label('Даты')->icon('fa-calendar'); Admin::menu(\App\HistoryEvent::class)->label('События')->icon('fa-tasks'); });