Skip to content

Commit

Permalink
Administration cockpit. Globally accessible and managable configs. Se…
Browse files Browse the repository at this point in the history
…parated startpage, login and app. Radio got bootstrap outfit, chat area and also information area hinting current streaming state
  • Loading branch information
Denis Wentland committed Dec 10, 2020
1 parent ea88b1c commit bcda347
Show file tree
Hide file tree
Showing 44 changed files with 1,915 additions and 907 deletions.
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ ICECAST_ADMIN_PASSWORD=
ICECAST_MOUNT_NAME=predigt.ogg
ICECAST_MOUNT_USER=
ICECAST_MOUNT_PASSWORD=
ICECAST_PORT=8008
ICECAST_PORT=8080

CHABAA_ADMIN_USER=
CHABAA_ADMIN_PASSWORD=
Expand Down
4 changes: 2 additions & 2 deletions app/Http/Controllers/Auth/RegisterController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use App\Http\Controllers\Controller;
use App\Providers\RouteServiceProvider;
use App\User;
use App\Model\User;
use Illuminate\Foundation\Auth\RegistersUsers;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Validator;
Expand Down Expand Up @@ -60,7 +60,7 @@ protected function validator(array $data)
* Create a new user instance after a valid registration.
*
* @param array $data
* @return \App\User
* @return \App\Model\User
*/
protected function create(array $data)
{
Expand Down
14 changes: 9 additions & 5 deletions app/Http/Controllers/HomeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
use App\Enum\ChatChannels;
use App\Enum\StreamingType;
use App\Events\MessageReceivedEvent;
use App\Message;
use App\User;
use App\Model\Message;
use App\Model\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Config;
Expand All @@ -31,7 +31,7 @@ public function __construct()
*
* @return \Illuminate\Contracts\Support\Renderable
*/
public function index()
public function home()
{
return view('home');
}
Expand Down Expand Up @@ -90,7 +90,10 @@ public function userSettings(Request $request)
*/
public function radio()
{
return view('radio');
$streamingServerPort = Config::get('app.streaming_server_port');
$audioSource = url(request()->getSchemeAndHttpHost() . ':8080/' . config('chabaa.ICECAST_MOUNT_NAME'));
return view('radio')
->with('audioSource', $audioSource);
}

/**
Expand All @@ -110,7 +113,8 @@ public function library()
*/
public function announcements()
{
return view('work-in-progress');

return view('announcements-management');
}

/**
Expand Down
183 changes: 183 additions & 0 deletions app/Http/Controllers/ManagementController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
<?php

namespace App\Http\Controllers;

use App\Model\Config;
use App\Model\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Redirect;

class ManagementController extends Controller
{
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
if(Auth::id() !== User::ADMIN_USER_ID) {
// TODO debug blocking
return;
}

$this->middleware('auth');
}


/**
* Show the application dashboard.
*
* @return \Illuminate\Contracts\Support\Renderable
*/
public function home()
{
return view('management.home');
}

/**
* church characteristics stipulation
*
* @return \Illuminate\Contracts\Support\Renderable
*/
public function church(Request $request)
{
if($request->getMethod() === 'GET') {
return view('management.church');
}
$request->all();
dump($request->all());
$config = Config::where('config','management.church.name')->first();
if(empty($config)) {
$config = new Config();
}
$config->config = 'management.church.name';
$config->value = $request->get('name');
$config->save();

$config = Config::where('config','management.church.street')->first();
if(empty($config)) {
$config = new Config();
}
$config->config = 'management.church.street';
$config->value = $request->get('street');
$config->save();

$config = Config::where('config','management.church.zip')->first();
if(empty($config)) {
$config = new Config();
}
$config->config = 'management.church.zip';
$config->value = $request->get('zip');
$config->save();

$config = Config::where('config','management.church.city')->first();
if(empty($config)) {
$config = new Config();
}

$config->config = 'management.church.city';
$config->value = $request->get('city');
$config->save();

return Redirect::to('management/church');
}

/**
* general app configuration
*
* @return \Illuminate\Contracts\Support\Renderable
*/
public function general()
{
return view('management.general');
}

/**
* church service lifestream configuration
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function videoStreaming()
{
return view('management.video-streaming');
}

/**
* church user management
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function user()
{
return view('management.user');
}

/**
* church user management apply settings
*/
public function userSettings(Request $request)
{
$name = $request->get('name');
$streamingVideoType = $request->get('streamingVideoType');
$request->session()->put('name', $name);
$request->session()->put('streamingVideoType', $streamingVideoType);

$request->session()->flash('info', 'die Einstellungen wurden übernommen');
;
return redirect()->to(route('user',__('routes.user')));
}

/**
* radio
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function radio()
{
return view('management.radio');
}

/**
* library
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function library()
{
return view('management.library');
}

/**
* announcements
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function announcements()
{

return view('management.announcements');
}

/**
* chat
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function chat(Request $request)
{

return view('management.chat');
}

/**
* recordings
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function recordings()
{
return view('management.recordings');
}
}
1 change: 0 additions & 1 deletion app/Http/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ class Kernel extends HttpKernel
//TODO: Double Check Cors addition
\Fruitcake\Cors\HandleCors::class,
\App\Http\Middleware\TrustProxies::class,
\Fruitcake\Cors\HandleCors::class,
\App\Http\Middleware\CheckForMaintenanceMode::class,
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
\App\Http\Middleware\TrimStrings::class,
Expand Down
10 changes: 10 additions & 0 deletions app/Model/Config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

namespace App\Model;

use Illuminate\Database\Eloquent\Model;
class Config extends Model
{
protected $table = "config";

}
2 changes: 1 addition & 1 deletion app/Message.php → app/Model/Message.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace App;
namespace App\Model;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Date;
Expand Down
2 changes: 1 addition & 1 deletion app/User.php → app/Model/User.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace App;
namespace App\Model;

use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Foundation\Auth\User as Authenticatable;
Expand Down
8 changes: 7 additions & 1 deletion app/Providers/AppServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace App\Providers;

use App\Model\Config;
use Illuminate\Support\Arr;
use Illuminate\Support\ServiceProvider;

class AppServiceProvider extends ServiceProvider
Expand All @@ -23,6 +25,10 @@ public function register()
*/
public function boot()
{
//
if(\Schema::hasTable('config')) {
$arr = \App\Model\Config::all(['config', 'value'])->toArray();
$arr = Arr::pluck($arr, 'value', 'config');
view()->share('config', $arr);
}
}
}
6 changes: 4 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
"php": "^7.2.5",
"alexusmai/laravel-file-manager": "^2.4",
"fideloper/proxy": "^4.2",
"fruitcake/laravel-cors": "^1.0",
"fruitcake/laravel-cors": "^2.0",
"guzzlehttp/guzzle": "^6.3",
"happyworm/jplayer": "2.*",
"kg-bot/laravel-localization-to-vue": "^1.6",
"laravel/framework": "^7.0",
"laravel/tinker": "^2.0",
Expand All @@ -31,7 +32,8 @@
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true
"sort-packages": true,
"component-dir": "public/js"
},
"extra": {
"laravel": {
Expand Down
Loading

0 comments on commit bcda347

Please sign in to comment.