Permalink
Browse files

Initial commit

  • Loading branch information...
Povilas Korop
Povilas Korop committed Feb 28, 2018
0 parents commit ae1dc29f13525420c8c77dcf6e5d315a48b9c174
Showing 1,386 changed files with 321,894 additions and 0 deletions.
@@ -0,0 +1,33 @@
APP_NAME=Laravel
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_LOG_LEVEL=debug
APP_URL=http://localhost

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret

BROADCAST_DRIVER=log
CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null

PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
@@ -0,0 +1,5 @@
* text=auto
*.css linguist-vendored
*.scss linguist-vendored
*.js linguist-vendored
CHANGELOG.md export-ignore
@@ -0,0 +1,12 @@
/node_modules
/public/hot
/public/storage
/storage/*.key
/vendor
/.idea
/.vagrant
Homestead.json
Homestead.yaml
npm-debug.log
yarn-error.log
.env
@@ -0,0 +1,113 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\SoftDeletes;
/**
* Class Booking
*
* @package App
* @property string $customer
* @property string $room
* @property string $time_from
* @property string $time_to
* @property text $additional_information
*/
class Booking extends Model
{
use SoftDeletes;
protected $fillable = ['time_from', 'time_to', 'additional_information', 'customer_id', 'room_id'];
/**
* Set to null if empty
* @param $input
*/
public function setCustomerIdAttribute($input)
{
$this->attributes['customer_id'] = $input ? $input : null;
}
/**
* Set to null if empty
* @param $input
*/
public function setRoomIdAttribute($input)
{
$this->attributes['room_id'] = $input ? $input : null;
}
/**
* Set attribute to date format
* @param $input
*/
public function setTimeFromAttribute($input)
{
if ($input != null && $input != '') {
$this->attributes['time_from'] = Carbon::createFromFormat(config('app.date_format') . ' H:i', $input)->format('Y-m-d H:i');
} else {
$this->attributes['time_from'] = null;
}
}
/**
* Get attribute from date format
* @param $input
*
* @return string
*/
public function getTimeFromAttribute($input)
{
$zeroDate = str_replace(['Y', 'm', 'd'], ['0000', '00', '00'], config('app.date_format') . ' H:i:s');
if ($input != $zeroDate && $input != null) {
return Carbon::createFromFormat('Y-m-d H:i:s', $input)->format(config('app.date_format') . ' H:i:s');
} else {
return '';
}
}
/**
* Set attribute to date format
* @param $input
*/
public function setTimeToAttribute($input)
{
if ($input != null && $input != '') {
$this->attributes['time_to'] = Carbon::createFromFormat(config('app.date_format') . ' H:i', $input)->format('Y-m-d H:i');
} else {
$this->attributes['time_to'] = null;
}
}
/**
* Get attribute from date format
* @param $input
*
* @return string
*/
public function getTimeToAttribute($input)
{
$zeroDate = str_replace(['Y', 'm', 'd'], ['0000', '00', '00'], config('app.date_format') . ' H:i');
if ($input != $zeroDate && $input != null) {
return Carbon::createFromFormat('Y-m-d H:i:s', $input)->format(config('app.date_format') . ' H:i:s');
} else {
return '';
}
}
public function customer()
{
return $this->belongsTo(Customer::class, 'customer_id')->withTrashed();
}
public function room()
{
return $this->belongsTo(Room::class, 'room_id')->withTrashed();
}
}
@@ -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');
}
}
@@ -0,0 +1,23 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
/**
* Class Country
*
* @package App
* @property string $shortcode
* @property string $title
* @property string $name
*/
class Country extends Model
{
use SoftDeletes;
protected $fillable = ['shortcode', 'title', 'name'];
}
@@ -0,0 +1,45 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
/**
* Class Customer
*
* @package App
* @property string $first_name
* @property string $last_name
* @property string $address
* @property string $phone
* @property string $email
* @property string $country
*/
class Customer extends Model
{
use SoftDeletes;
protected $fillable = ['first_name', 'last_name', 'address', 'phone', 'email', 'country_id'];
/**
* Set to null if empty
* @param $input
*/
public function setCountryIdAttribute($input)
{
$this->attributes['country_id'] = $input ? $input : null;
}
public function country()
{
return $this->belongsTo(Country::class, 'country_id')->withTrashed();
}
public function getFullNameAttribute()
{
return $this->first_name . ' ' . $this->last_name;
}
}
@@ -0,0 +1,68 @@
<?php
namespace App\Exceptions;
use Exception;
use Illuminate\Auth\AuthenticationException;
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.
*
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
*
* @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);
}
/**
* Convert an authentication exception into a response.
*
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Auth\AuthenticationException $exception
* @return \Illuminate\Http\Response
*/
protected function unauthenticated($request, AuthenticationException $exception)
{
return $request->expectsJson()
? response()->json(['message' => 'Unauthenticated.'], 401)
: redirect()->guest(route('auth.login'));
}
}
Oops, something went wrong.

0 comments on commit ae1dc29

Please sign in to comment.