.
This commit is contained in:
26
app/Company.php
Normal file
26
app/Company.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class Company
|
||||
*
|
||||
* @package App
|
||||
* @property integer $id
|
||||
* @property string $name
|
||||
* @property integer $monthly_payer
|
||||
* @mixin \Eloquent
|
||||
* @property \Carbon\Carbon|null $created_at
|
||||
* @property \Carbon\Carbon|null $updated_at
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Company whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Company whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Company whereMonthlyPayer($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Company whereName($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Company whereUpdatedAt($value)
|
||||
*/
|
||||
class Company extends Model
|
||||
{
|
||||
//
|
||||
}
|
||||
30
app/Confirm.php
Normal file
30
app/Confirm.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* App\Confirm
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $company_id
|
||||
* @property int $term_id
|
||||
* @property string $term_date
|
||||
* @property \Carbon\Carbon|null $created_at
|
||||
* @property \Carbon\Carbon|null $updated_at
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Confirm whereCompanyId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Confirm whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Confirm whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Confirm whereTermDate($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Confirm whereTermId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Confirm whereUpdatedAt($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class Confirm extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'company_id', 'term_id', 'term_date',
|
||||
];
|
||||
|
||||
}
|
||||
42
app/Console/Kernel.php
Normal file
42
app/Console/Kernel.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console;
|
||||
|
||||
use Illuminate\Console\Scheduling\Schedule;
|
||||
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
||||
|
||||
class Kernel extends ConsoleKernel
|
||||
{
|
||||
/**
|
||||
* The Artisan commands provided by your application.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $commands = [
|
||||
//
|
||||
];
|
||||
|
||||
/**
|
||||
* Define the application's command schedule.
|
||||
*
|
||||
* @param \Illuminate\Console\Scheduling\Schedule $schedule
|
||||
* @return void
|
||||
*/
|
||||
protected function schedule(Schedule $schedule)
|
||||
{
|
||||
// $schedule->command('inspire')
|
||||
// ->hourly();
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the commands for the application.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function commands()
|
||||
{
|
||||
$this->load(__DIR__.'/Commands');
|
||||
|
||||
require base_path('routes/console.php');
|
||||
}
|
||||
}
|
||||
51
app/Exceptions/Handler.php
Normal file
51
app/Exceptions/Handler.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exceptions;
|
||||
|
||||
use Exception;
|
||||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
||||
|
||||
class Handler extends ExceptionHandler
|
||||
{
|
||||
/**
|
||||
* A list of the exception types that are not reported.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $dontReport = [
|
||||
//
|
||||
];
|
||||
|
||||
/**
|
||||
* A list of the inputs that are never flashed for validation exceptions.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $dontFlash = [
|
||||
'password',
|
||||
'password_confirmation',
|
||||
];
|
||||
|
||||
/**
|
||||
* Report or log an exception.
|
||||
*
|
||||
* @param \Exception $exception
|
||||
* @return void
|
||||
*/
|
||||
public function report(Exception $exception)
|
||||
{
|
||||
parent::report($exception);
|
||||
}
|
||||
|
||||
/**
|
||||
* Render an exception into an HTTP response.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Exception $exception
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function render($request, Exception $exception)
|
||||
{
|
||||
return parent::render($request, $exception);
|
||||
}
|
||||
}
|
||||
32
app/Http/Controllers/Auth/ForgotPasswordController.php
Normal file
32
app/Http/Controllers/Auth/ForgotPasswordController.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
|
||||
|
||||
class ForgotPasswordController extends Controller
|
||||
{
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Password Reset Controller
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This controller is responsible for handling password reset emails and
|
||||
| includes a trait which assists in sending these notifications from
|
||||
| your application to your users. Feel free to explore this trait.
|
||||
|
|
||||
*/
|
||||
|
||||
use SendsPasswordResetEmails;
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('guest');
|
||||
}
|
||||
}
|
||||
39
app/Http/Controllers/Auth/LoginController.php
Normal file
39
app/Http/Controllers/Auth/LoginController.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Foundation\Auth\AuthenticatesUsers;
|
||||
|
||||
class LoginController extends Controller
|
||||
{
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Login Controller
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This controller handles authenticating users for the application and
|
||||
| redirecting them to your home screen. The controller uses a trait
|
||||
| to conveniently provide its functionality to your applications.
|
||||
|
|
||||
*/
|
||||
|
||||
use AuthenticatesUsers;
|
||||
|
||||
/**
|
||||
* Where to redirect users after login.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $redirectTo = '/';
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('guest')->except('logout');
|
||||
}
|
||||
}
|
||||
17
app/Http/Controllers/Auth/RegisterController.php
Normal file
17
app/Http/Controllers/Auth/RegisterController.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Support\Facades\Redirect;
|
||||
|
||||
class RegisterController extends Controller
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
Redirect::to('/')->send();
|
||||
// $this->middleware('guest');
|
||||
}
|
||||
|
||||
}
|
||||
39
app/Http/Controllers/Auth/ResetPasswordController.php
Normal file
39
app/Http/Controllers/Auth/ResetPasswordController.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Foundation\Auth\ResetsPasswords;
|
||||
|
||||
class ResetPasswordController extends Controller
|
||||
{
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Password Reset Controller
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This controller is responsible for handling password reset requests
|
||||
| and uses a simple trait to include this behavior. You're free to
|
||||
| explore this trait and override any methods you wish to tweak.
|
||||
|
|
||||
*/
|
||||
|
||||
use ResetsPasswords;
|
||||
|
||||
/**
|
||||
* Where to redirect users after resetting their password.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $redirectTo = '/';
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('guest');
|
||||
}
|
||||
}
|
||||
34
app/Http/Controllers/Configuration/CompanyController.php
Normal file
34
app/Http/Controllers/Configuration/CompanyController.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Configuration;
|
||||
|
||||
use App\Company;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CompanyController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$companies = Company::all();
|
||||
return view('configuration.companies', compact('companies'));
|
||||
}
|
||||
|
||||
public function edit(Request $request, $id)
|
||||
{
|
||||
if ($id) {
|
||||
$company = Company::find($id);
|
||||
} else {
|
||||
$company = Company::getModel();
|
||||
}
|
||||
if ($request->post()) {
|
||||
$company->name = $request->get('name');
|
||||
$company->monthly_payer = $request->get('monthly_payer');
|
||||
$company->save();
|
||||
return redirect()->route('company')->with('success', 'Uloženo');
|
||||
}
|
||||
|
||||
return view('configuration.company.edit', compact('company'));
|
||||
|
||||
}
|
||||
}
|
||||
38
app/Http/Controllers/Configuration/TermController.php
Normal file
38
app/Http/Controllers/Configuration/TermController.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Configuration;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Term;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class TermController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$terms = Term::orderBy('id', 'desc')->get();
|
||||
return view('configuration.terms', compact('terms'));
|
||||
}
|
||||
|
||||
public function edit(Request $request, $id)
|
||||
{
|
||||
if ($id) {
|
||||
$term = Term::find($id);
|
||||
} else {
|
||||
$term = Term::getModel();
|
||||
}
|
||||
if ($request->post()) {
|
||||
$term->day = (int)$request->get('day');
|
||||
$term->month = $request->get('month');
|
||||
$term->inter = (int)$request->get('inter');
|
||||
$term->applies_to = (int)$request->get('applies_to');
|
||||
$term->name = (string)$request->get('name');
|
||||
$term->desc = (string)$request->get('desc');
|
||||
$term->save();
|
||||
return redirect()->route('terms')->with('success', 'Uloženo');
|
||||
}
|
||||
|
||||
return view('configuration.term.edit', compact('term'));
|
||||
|
||||
}
|
||||
}
|
||||
34
app/Http/Controllers/Controller.php
Normal file
34
app/Http/Controllers/Controller.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||
use Illuminate\Routing\Controller as BaseController;
|
||||
use Illuminate\Foundation\Validation\ValidatesRequests;
|
||||
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
||||
use Route;
|
||||
|
||||
class Controller extends BaseController
|
||||
{
|
||||
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
|
||||
|
||||
public $menu = [];
|
||||
public function __construct()
|
||||
{
|
||||
$this->menu = [
|
||||
'company' => ['link' => url('configuration'), 'name' => __('Firmy'), 'active' => false],
|
||||
'term' => ['link' => url('configuration/terms'), 'name' => __('Termíny'), 'active' => false],
|
||||
];
|
||||
|
||||
$controller = class_basename(Route::currentRouteAction());
|
||||
|
||||
list($controller) = explode('@', $controller);
|
||||
$controller = strtolower(str_replace('Controller', '', $controller));
|
||||
if (isset($this->menu[$controller])) {
|
||||
$this->menu[$controller]['active'] = true;
|
||||
}
|
||||
|
||||
\View::share('menu', $this->menu);
|
||||
}
|
||||
|
||||
}
|
||||
112
app/Http/Controllers/DashboardController.php
Normal file
112
app/Http/Controllers/DashboardController.php
Normal file
@@ -0,0 +1,112 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Company;
|
||||
use App\Confirm;
|
||||
use App\Term;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class DashboardController extends Controller
|
||||
{
|
||||
/**
|
||||
* Show the application dashboard.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$terms = Term::all();
|
||||
$companies = Company::all();
|
||||
$q = [];
|
||||
$m = [];
|
||||
$comp = [];
|
||||
foreach ($companies as $company) {
|
||||
if ($company->monthly_payer) {
|
||||
$m[] = $company;
|
||||
} else {
|
||||
$q[] = $company;
|
||||
}
|
||||
$comp[] = $company->getAttributes() + ['checked' => false];
|
||||
}
|
||||
$confirms = Confirm::orderBy('term_date')->get();
|
||||
$list = [];
|
||||
$date = date('Y-01-01');
|
||||
while (true) {
|
||||
$c = [];
|
||||
foreach ($confirms as $confirm) {
|
||||
if ($confirm->term_date == $date) {
|
||||
$c[$confirm->company_id.'_'.$confirm->term_id] = $confirm;
|
||||
}
|
||||
}
|
||||
foreach ($terms as $term) {
|
||||
if ($term->applies_to) {
|
||||
if (($term->applies_to == 1 && ! count($m)) || ($term->applies_to == 2 && ! count($q))) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
[$year, $month, $day] = explode('-', $date);
|
||||
if ($day == $term->day && $term->month == null && $term->inter == 0) {
|
||||
foreach ($comp as $item=>$value) {
|
||||
if (isset($c[$comp[$item]['id'] . '_' . $term->id])) {
|
||||
$comp[$item]['checked'] = true;
|
||||
} else {
|
||||
$comp[$item]['checked'] = false;
|
||||
}
|
||||
}
|
||||
$list[] =
|
||||
(object) ['id' => $term->id, 'div' => $year.(int)$month, 'date' => $date, 'name' => $term->name, 'desc' => $term->desc, 'companies' => $comp];
|
||||
} elseif ($day == $term->day && $term->month == $month && $term->inter == 2) {
|
||||
foreach ($comp as $item=>$value) {
|
||||
if (isset($c[$comp[$item]['id'] . '_' . $term->id])) {
|
||||
$comp[$item]['checked'] = true;
|
||||
} else {
|
||||
$comp[$item]['checked'] = false;
|
||||
}
|
||||
}
|
||||
$list[] =
|
||||
(object) ['id' => $term->id, 'div' => $year.(int)$month, 'date' => $date, 'name' => $term->name, 'desc' => $term->desc, 'companies' => (object)$comp];
|
||||
}
|
||||
}
|
||||
$date = date('Y-m-d', strtotime("$date +1 DAYS"));
|
||||
if ($year != date('Y')) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return view('dashboard', compact('list'));
|
||||
}
|
||||
|
||||
public function ajax(Request $request)
|
||||
{
|
||||
$return = [
|
||||
'status' => 'error'
|
||||
];
|
||||
if ($request->isMethod('post')) {
|
||||
$date = $request->get('date');
|
||||
$company = (int)$request->get('company');
|
||||
$term = (int)$request->get('term');
|
||||
$checked = $request->get('checked');
|
||||
if ($date && $company && $term) {
|
||||
if ('true' == $checked) {
|
||||
$confirm = Confirm::firstOrNew([
|
||||
'term_date' => $date,
|
||||
'company_id' => $company,
|
||||
'term_id' => $term,
|
||||
]);
|
||||
$confirm->save();
|
||||
} else {
|
||||
$confirm = Confirm::where('term_date', $date)->where('company_id', $company)
|
||||
->where('term_id', $term)->first();
|
||||
$confirm->delete();
|
||||
}
|
||||
|
||||
$request->session()->flash('message', 'Uloženo');
|
||||
$request->session()->flash('message-type', 'success');
|
||||
return response()->json(['status' => 'success']);
|
||||
}
|
||||
}
|
||||
|
||||
return response()->json($return);
|
||||
}
|
||||
}
|
||||
64
app/Http/Kernel.php
Normal file
64
app/Http/Kernel.php
Normal file
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http;
|
||||
|
||||
use Illuminate\Foundation\Http\Kernel as HttpKernel;
|
||||
|
||||
class Kernel extends HttpKernel
|
||||
{
|
||||
/**
|
||||
* The application's global HTTP middleware stack.
|
||||
*
|
||||
* These middleware are run during every request to your application.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $middleware = [
|
||||
\Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::class,
|
||||
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
|
||||
\App\Http\Middleware\TrimStrings::class,
|
||||
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
|
||||
\App\Http\Middleware\TrustProxies::class,
|
||||
// \Illuminate\Auth\Middleware\Authenticate::class,
|
||||
];
|
||||
|
||||
/**
|
||||
* The application's route middleware groups.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $middlewareGroups = [
|
||||
'web' => [
|
||||
\App\Http\Middleware\EncryptCookies::class,
|
||||
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
|
||||
\Illuminate\Session\Middleware\StartSession::class,
|
||||
\Illuminate\Session\Middleware\AuthenticateSession::class,
|
||||
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
|
||||
\App\Http\Middleware\VerifyCsrfToken::class,
|
||||
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||
],
|
||||
|
||||
'api' => [
|
||||
'throttle:60,1',
|
||||
'bindings',
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* The application's route middleware.
|
||||
*
|
||||
* These middleware may be assigned to groups or used individually.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $routeMiddleware = [
|
||||
'auth' => \Illuminate\Auth\Middleware\Authenticate::class,
|
||||
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
|
||||
'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
|
||||
'can' => \Illuminate\Auth\Middleware\Authorize::class,
|
||||
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
|
||||
'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
|
||||
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
|
||||
];
|
||||
}
|
||||
17
app/Http/Middleware/EncryptCookies.php
Normal file
17
app/Http/Middleware/EncryptCookies.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Cookie\Middleware\EncryptCookies as Middleware;
|
||||
|
||||
class EncryptCookies extends Middleware
|
||||
{
|
||||
/**
|
||||
* The names of the cookies that should not be encrypted.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $except = [
|
||||
//
|
||||
];
|
||||
}
|
||||
26
app/Http/Middleware/RedirectIfAuthenticated.php
Normal file
26
app/Http/Middleware/RedirectIfAuthenticated.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class RedirectIfAuthenticated
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @param string|null $guard
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next, $guard = null)
|
||||
{
|
||||
if (Auth::guard($guard)->check()) {
|
||||
return redirect('/home');
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
}
|
||||
18
app/Http/Middleware/TrimStrings.php
Normal file
18
app/Http/Middleware/TrimStrings.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Foundation\Http\Middleware\TrimStrings as Middleware;
|
||||
|
||||
class TrimStrings extends Middleware
|
||||
{
|
||||
/**
|
||||
* The names of the attributes that should not be trimmed.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $except = [
|
||||
'password',
|
||||
'password_confirmation',
|
||||
];
|
||||
}
|
||||
23
app/Http/Middleware/TrustProxies.php
Normal file
23
app/Http/Middleware/TrustProxies.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Fideloper\Proxy\TrustProxies as Middleware;
|
||||
|
||||
class TrustProxies extends Middleware
|
||||
{
|
||||
/**
|
||||
* The trusted proxies for this application.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $proxies;
|
||||
|
||||
/**
|
||||
* The headers that should be used to detect proxies.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $headers = Request::HEADER_X_FORWARDED_ALL;
|
||||
}
|
||||
17
app/Http/Middleware/VerifyCsrfToken.php
Normal file
17
app/Http/Middleware/VerifyCsrfToken.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;
|
||||
|
||||
class VerifyCsrfToken extends Middleware
|
||||
{
|
||||
/**
|
||||
* The URIs that should be excluded from CSRF verification.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $except = [
|
||||
//
|
||||
];
|
||||
}
|
||||
32
app/Providers/AppServiceProvider.php
Normal file
32
app/Providers/AppServiceProvider.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class AppServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Bootstrap any application services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
Schema::defaultStringLength(191);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register any application services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
if ($this->app->environment() !== 'production') {
|
||||
$this->app->register(\Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class);
|
||||
}
|
||||
//
|
||||
}
|
||||
}
|
||||
30
app/Providers/AuthServiceProvider.php
Normal file
30
app/Providers/AuthServiceProvider.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
|
||||
|
||||
class AuthServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* The policy mappings for the application.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $policies = [
|
||||
'App\Model' => 'App\Policies\ModelPolicy',
|
||||
];
|
||||
|
||||
/**
|
||||
* Register any authentication / authorization services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
$this->registerPolicies();
|
||||
|
||||
//
|
||||
}
|
||||
}
|
||||
21
app/Providers/BroadcastServiceProvider.php
Normal file
21
app/Providers/BroadcastServiceProvider.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Illuminate\Support\Facades\Broadcast;
|
||||
|
||||
class BroadcastServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Bootstrap any application services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
Broadcast::routes();
|
||||
|
||||
require base_path('routes/channels.php');
|
||||
}
|
||||
}
|
||||
32
app/Providers/EventServiceProvider.php
Normal file
32
app/Providers/EventServiceProvider.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
|
||||
|
||||
class EventServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* The event listener mappings for the application.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $listen = [
|
||||
'App\Events\Event' => [
|
||||
'App\Listeners\EventListener',
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* Register any events for your application.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
parent::boot();
|
||||
|
||||
//
|
||||
}
|
||||
}
|
||||
73
app/Providers/RouteServiceProvider.php
Normal file
73
app/Providers/RouteServiceProvider.php
Normal file
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||
|
||||
class RouteServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* This namespace is applied to your controller routes.
|
||||
*
|
||||
* In addition, it is set as the URL generator's root namespace.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $namespace = 'App\Http\Controllers';
|
||||
|
||||
/**
|
||||
* Define your route model bindings, pattern filters, etc.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
//
|
||||
|
||||
parent::boot();
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the routes for the application.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function map()
|
||||
{
|
||||
$this->mapApiRoutes();
|
||||
|
||||
$this->mapWebRoutes();
|
||||
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the "web" routes for the application.
|
||||
*
|
||||
* These routes all receive session state, CSRF protection, etc.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function mapWebRoutes()
|
||||
{
|
||||
Route::middleware('web')
|
||||
->namespace($this->namespace)
|
||||
->group(base_path('routes/web.php'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the "api" routes for the application.
|
||||
*
|
||||
* These routes are typically stateless.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function mapApiRoutes()
|
||||
{
|
||||
Route::prefix('api')
|
||||
->middleware('api')
|
||||
->namespace($this->namespace)
|
||||
->group(base_path('routes/api.php'));
|
||||
}
|
||||
}
|
||||
80
app/Term.php
Normal file
80
app/Term.php
Normal file
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class Term
|
||||
*
|
||||
* @package App
|
||||
* @property integer $id
|
||||
* @property integer $day
|
||||
* @property integer $month
|
||||
* @property integer $inter
|
||||
* @property integer $applies_to
|
||||
* @property string $name
|
||||
* @property string $desc
|
||||
* @mixin \Eloquent
|
||||
* @property \Carbon\Carbon|null $created_at
|
||||
* @property \Carbon\Carbon|null $updated_at
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Term whereAppliesTo($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Term whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Term whereDay($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Term whereDesc($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Term whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Term whereInter($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Term whereMonth($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Term whereName($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Term whereUpdatedAt($value)
|
||||
*/
|
||||
class Term extends Model
|
||||
{
|
||||
public static function getDays($value = null)
|
||||
{
|
||||
$days = range(1, 31);
|
||||
$days = array_combine($days, $days);
|
||||
$days[-1] = 'poslední den';
|
||||
if ($value === null) {
|
||||
return $days;
|
||||
}
|
||||
return $days[$value];
|
||||
}
|
||||
|
||||
public static function getMonths($value = null)
|
||||
{
|
||||
$months = range(1, 12);
|
||||
$months = array_combine($months, $months);
|
||||
$months = ['' => ''] + $months;
|
||||
if ($value === null) {
|
||||
return $months;
|
||||
}
|
||||
return $months[$value];
|
||||
}
|
||||
|
||||
public static function getInter($value = null)
|
||||
{
|
||||
$inter = [
|
||||
0 => 'měsíčně',
|
||||
1 => 'čtvrtletně',
|
||||
2 => 'ročně',
|
||||
];
|
||||
if ($value === null) {
|
||||
return $inter;
|
||||
}
|
||||
return $inter[$value];
|
||||
}
|
||||
|
||||
public static function getAppliesTo($value = null)
|
||||
{
|
||||
$applies_to = [
|
||||
0 => 'měsíční i čtvrtletní',
|
||||
1 => 'měsíční',
|
||||
2 => 'čtvrtletní',
|
||||
];
|
||||
if ($value === null) {
|
||||
return $applies_to;
|
||||
}
|
||||
return $applies_to[$value];
|
||||
}
|
||||
}
|
||||
49
app/User.php
Normal file
49
app/User.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
|
||||
/**
|
||||
* App\User
|
||||
*
|
||||
* @property-read \Illuminate\Notifications\DatabaseNotificationCollection|\Illuminate\Notifications\DatabaseNotification[] $notifications
|
||||
* @mixin \Eloquent
|
||||
* @property int $id
|
||||
* @property string $name
|
||||
* @property string $email
|
||||
* @property string $password
|
||||
* @property string|null $remember_token
|
||||
* @property \Carbon\Carbon|null $created_at
|
||||
* @property \Carbon\Carbon|null $updated_at
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\User whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\User whereEmail($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\User whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\User whereName($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\User wherePassword($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\User whereRememberToken($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\User whereUpdatedAt($value)
|
||||
*/
|
||||
class User extends Authenticatable
|
||||
{
|
||||
use Notifiable;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'name', 'email', 'password',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be hidden for arrays.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $hidden = [
|
||||
'password', 'remember_token',
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user