Compare commits

79 Commits

Author SHA1 Message Date
kplaczek
1aee7cdc02 Interactive menu 2019-02-27 21:44:55 +01:00
ba3f2e954a Merge branch 'issue-65' of krzysiej/paper-pi into master 2018-10-26 08:58:18 +02:00
kplaczek
fbffeec3a3 Added way to recieve text messages and printing them. 2018-10-26 08:13:01 +02:00
817b573258 Merge branch 'issue-57' of krzysiej/paper-pi into master 2018-10-04 22:41:06 +02:00
kplaczek
d08bdc0893 Fixed save note without a title. 2018-10-04 22:40:22 +02:00
b052fa50db Merge branch 'issue-pi-8' of krzysiej/paper-pi into master 2018-10-04 22:35:10 +02:00
kplaczek
efad44ea57 Added database example. Modified place for a database to be database folder. 2018-10-04 18:58:11 +02:00
23f3d647e0 Merge branch 'issue-59' of krzysiej/paper-pi into master 2018-09-28 10:29:11 +02:00
kplaczek
954cadd874 Fix previous commit. Now it works as intended and not always hiding private notes. 2018-09-28 10:27:00 +02:00
2b33c35049 Merge branch 'issue-59' of krzysiej/paper-pi into master 2018-09-19 20:05:47 +02:00
kplaczek
fcfc0bd58a Add checkbox to set note as private. When note is private then no one can see them from non local network. 2018-09-19 20:04:35 +02:00
31e65c4730 Merge branch 'issue-28' of krzysiej/paper-pi into master 2018-08-19 10:08:27 +02:00
kplaczek
6fb933a86c Saveing data after each print, saved or quick note. Increased trafficar radius to 2,5km from 2km. 2018-08-19 10:06:34 +02:00
e76edbb531 Merge branch 'issue-45' of krzysiej/paper-pi into master 2018-08-16 22:08:43 +02:00
kplaczek
081aa0f7a4 Print status after printing single note. 2018-08-16 22:07:59 +02:00
0afea8ead6 Merge branch 'issue-53' of krzysiej/paper-pi into master 2018-08-15 19:14:23 +02:00
kplaczek
41b7d5778d Added information about available traficars in a given area to printed info. 2018-08-15 19:12:53 +02:00
kplaczek
cee945f561 Merge branch 'master' of https://git.pi.techtube.pl/krzysiej/paper-pi 2018-08-12 12:36:06 +02:00
f806edb7b3 Merge branch 'issue-37' of krzysiej/paper-pi into master 2018-08-12 12:35:38 +02:00
kplaczek
76ae18e82a Merge remote-tracking branch 'origin/master' 2018-08-12 12:24:55 +02:00
kplaczek
23220819d5 Fixed printing informations about nearest traficar car. Increased size of printed image from 300 to 370px. 2018-08-12 12:21:16 +02:00
a839befc41 Merge branch 'issue-49' of krzysiej/paper-pi into master 2018-07-29 17:13:20 +02:00
kplaczek
7a5e7a5d9d Breaking up text to 32 character length on space. 2018-07-29 17:05:26 +02:00
611628c753 Merge branch 'issue-46' of krzysiej/paper-pi into master 2018-07-16 18:12:57 +02:00
kplaczek
4fdd43dc4e Bug where everytime before printing paper would gram word from vocabulary, not just when there is a shortcode in a content. 2018-07-16 18:11:46 +02:00
5512990704 Merge branch 'issue-32' of krzysiej/paper-pi into master 2018-07-08 12:53:43 +02:00
kplaczek
9187702634 Removed duplicate favicon line. 2018-07-08 12:52:44 +02:00
kplaczek
4b2dedc8f2 Added favicons, manifest,json and bunch of various size icons. 2018-07-08 12:10:16 +02:00
a3e8c19795 Merge branch 'issue-26' of krzysiej/paper-pi into master 2018-07-05 08:40:36 +02:00
kplaczek
178853874f Added route phpdoc 2018-07-05 08:39:19 +02:00
kplaczek
0b3d25d013 Clicking on icon next to note title will filter list to notes that has been assigned with clicked icon. 2018-07-05 08:37:52 +02:00
42c61feff8 Merge branch 'issue-37' of krzysiej/paper-pi into master 2018-07-04 20:59:27 +02:00
kplaczek
b4aa26ee17 Nearest traficar inforations. 2018-07-04 20:57:28 +02:00
bfe04f94ca Merge branch 'issue-35' of krzysiej/paper-pi into master 2018-06-21 22:29:43 +02:00
kplaczek
5d75992372 Proper form reseting after printing. 2018-06-21 22:23:49 +02:00
dcbb7e21f3 Merge branch 'issue-30' of krzysiej/paper-pi into master 2018-06-11 08:58:05 +02:00
kplaczek
db3f7772a6 Added tests to vocabulary and ability to print by key press 2018-05-18 21:47:43 +02:00
625193e99e Merge branch 'issue-23' of krzysiej/paper-pi into master 2018-05-13 12:09:26 +02:00
0df6753bd2 Merge branch 'issue-25' of krzysiej/paper-pi into master 2018-05-06 21:04:22 +02:00
kplaczek
e5f44b92e4 Printing data on numpad key press, first version. Settings page for mapping key to actions. 2018-05-06 21:03:42 +02:00
kplaczek
283c5b905e Fixed issue with selecting iocns by clicking icon next to saved note title. 2018-04-28 00:03:54 +02:00
de000d0403 Merge branch 'issue-21' of krzysiej/paper-pi into master 2018-04-22 18:46:11 +02:00
kplaczek
2f55d8491a Fixed bug with displaying icon for the notes without one set. 2018-04-22 18:45:19 +02:00
6f29248e8b Merge branch 'issue-19' of krzysiej/paper-pi into master 2018-04-22 00:04:23 +02:00
kplaczek
817479415f fixed issue with wrong array indexes 2018-04-21 13:27:58 +02:00
b0ba390cb5 Merge branch 'issue-14' of krzysiej/paper-pi into master 2018-04-19 23:31:05 +02:00
kplaczek
9f3c5a1487 Fixed regex 2018-04-19 23:30:27 +02:00
b66e08bc5b Merge branch 'issue-10' of krzysiej/paper-pi into master 2018-04-19 23:10:16 +02:00
kplaczek
f82fbd0e5a replaced random function with mt_random 2018-04-19 23:09:34 +02:00
556e7adfab Merge branch 'issue-14' of krzysiej/paper-pi into master 2018-04-19 23:07:03 +02:00
kplaczek
ec776f837e Merge remote-tracking branch 'origin/master'
# Conflicts:
#	app/Paper/HtmlToPos.php
2018-04-19 23:04:55 +02:00
kplaczek
2a242ff7ed Removes before printing lines with ! or # as a leading characer even after some space characters in front. 2018-04-19 23:01:12 +02:00
fbac17281a Merge branch 'issue-14' of krzysiej/paper-pi into master 2018-04-19 23:00:44 +02:00
kplaczek
501a64e0c7 Removes before printing lines with ! or # as a leading characer even after some space characters in front. 2018-04-19 22:59:47 +02:00
b68bf4b2e1 Merge branch 'issue-10' of krzysiej/paper-pi into master 2018-04-17 18:01:34 +02:00
kplaczek
680e52e2b4 Added a way to check if there is a [ number, number2 ] in a text and then replace that with a random number from that range. 2018-04-17 18:00:06 +02:00
kplaczek
7be360c01d Fixed typo. 2018-04-16 17:22:21 +02:00
kplaczek
8e181ec4c6 Added a paper config file with airly settings, fixed some minor issues with airly data not being printed. 2018-04-15 20:09:08 +02:00
1f1743adc2 Merge branch 'issue-7' of krzysiej/paper-pi into master 2018-04-15 15:44:19 +02:00
kplaczek
31802d2290 Added flash messages about printing notes, quick notes and cinemas repertoire. Fixed some minor issues about cinema repertoires. 2018-04-15 15:42:00 +02:00
kplaczek
9167740fa5 Merge remote-tracking branch 'origin/master' into issue-7 2018-04-15 14:35:46 +02:00
aff9697420 Merge branch 'issue-4' of krzysiej/paper-pi into master 2018-04-14 12:41:39 +02:00
kplaczek
56b656d1e7 Added Gdynskie centrum filmowe to cinemas. 2018-04-14 12:40:56 +02:00
kplaczek
42801c93e9 Refactored CinemaCity repertoire fetcher. 2018-04-09 22:56:51 +02:00
kplaczek
162a736f12 Flash message. 2018-04-09 07:20:27 +02:00
kplaczek
60611015e5 Cinema City class added. Need some extra work though. 2018-04-07 20:30:18 +02:00
kplaczek
d68020d056 Updated helios and multikino classes and interface they are implementing. 2018-04-05 22:38:20 +02:00
400b330d37 Merge branch 'issue-2' of krzysiej/paper-pi into master 2018-04-04 22:37:32 +02:00
kplaczek
45058a01dc #2 Removed unnecessary js and css files 2018-04-04 22:33:44 +02:00
kplaczek
46d32b2cec Merge branch 'issue-1'
# Conflicts:
#	public/js/printer.js
2018-04-04 22:10:28 +02:00
kplaczek
5e33b072d6 Merge branch 'issue-1' of http://pi.techtube.pl:3000/krzysiej/paper-pi into issue-1
# Conflicts:
#	public/js/printer.js
2018-04-04 19:59:28 +02:00
kplaczek
bcc445f75a issue #1 reset form resets selected icon to empty 2018-04-04 19:57:07 +02:00
kplaczek
bdf5f88c94 Merge branch 'issue-1'
# Conflicts:
#	.env.example
#	.gitattributes
#	.gitignore
#	app/Console/Kernel.php
#	app/Exceptions/Handler.php
#	app/Http/Controllers/Auth/ForgotPasswordController.php
#	app/Http/Controllers/Auth/LoginController.php
#	app/Http/Controllers/Auth/RegisterController.php
#	app/Http/Controllers/Auth/ResetPasswordController.php
#	app/Http/Controllers/Controller.php
#	app/Http/Controllers/Main.php
#	app/Http/Kernel.php
#	app/Http/Middleware/EncryptCookies.php
#	app/Http/Middleware/RedirectIfAuthenticated.php
#	app/Http/Middleware/TrimStrings.php
#	app/Http/Middleware/VerifyCsrfToken.php
#	app/Paper/Paper.php
#	app/Providers/AppServiceProvider.php
#	app/Providers/AuthServiceProvider.php
#	app/Providers/BroadcastServiceProvider.php
#	app/Providers/EventServiceProvider.php
#	app/Providers/RouteServiceProvider.php
#	app/User.php
#	artisan
#	bootstrap/app.php
#	bootstrap/autoload.php
#	bootstrap/cache/.gitignore
#	composer.json
#	composer.lock
#	config/app.php
#	config/auth.php
#	config/broadcasting.php
#	config/cache.php
#	config/database.php
#	config/filesystems.php
#	config/mail.php
#	config/queue.php
#	config/services.php
#	config/session.php
#	config/view.php
#	database/.gitignore
#	database/factories/ModelFactory.php
#	database/migrations/2014_10_12_000000_create_users_table.php
#	database/migrations/2014_10_12_100000_create_password_resets_table.php
#	database/seeds/DatabaseSeeder.php
#	package.json
#	phpunit.xml
#	public/.htaccess
#	public/css/accordion.css
#	public/css/accordion.min.css
#	public/css/ad.css
#	public/css/ad.min.css
#	public/css/app.css
#	public/css/breadcrumb.css
#	public/css/breadcrumb.min.css
#	public/css/button.css
#	public/css/button.min.css
#	public/css/card.css
#	public/css/card.min.css
#	public/css/checkbox.css
#	public/css/checkbox.min.css
#	public/css/comment.css
#	public/css/comment.min.css
#	public/css/container.css
#	public/css/container.min.css
#	public/css/dimmer.css
#	public/css/dimmer.min.css
#	public/css/divider.css
#	public/css/divider.min.css
#	public/css/dropdown.css
#	public/css/dropdown.min.css
#	public/css/embed.css
#	public/css/embed.min.css
#	public/css/feed.css
#	public/css/feed.min.css
#	public/css/flag.css
#	public/css/flag.min.css
#	public/css/form.css
#	public/css/form.min.css
#	public/css/grid.css
#	public/css/grid.min.css
#	public/css/header.css
#	public/css/header.min.css
#	public/css/icon.css
#	public/css/icon.min.css
#	public/css/image.css
#	public/css/image.min.css
#	public/css/input.css
#	public/css/input.min.css
#	public/css/item.css
#	public/css/item.min.css
#	public/css/label.css
#	public/css/label.min.css
#	public/css/list.css
#	public/css/list.min.css
#	public/css/loader.css
#	public/css/loader.min.css
#	public/css/menu.css
#	public/css/menu.min.css
#	public/css/message.css
#	public/css/message.min.css
#	public/css/modal.css
#	public/css/modal.min.css
#	public/css/nag.css
#	public/css/nag.min.css
#	public/css/popup.css
#	public/css/popup.min.css
#	public/css/progress.css
#	public/css/progress.min.css
#	public/css/rail.css
#	public/css/rail.min.css
#	public/css/rating.css
#	public/css/rating.min.css
#	public/css/reset.css
#	public/css/reset.min.css
#	public/css/reveal.css
#	public/css/reveal.min.css
#	public/css/search.css
#	public/css/search.min.css
#	public/css/segment.css
#	public/css/segment.min.css
#	public/css/semantic.min.css
#	public/css/shape.css
#	public/css/shape.min.css
#	public/css/sidebar.css
#	public/css/sidebar.min.css
#	public/css/site.css
#	public/css/site.min.css
#	public/css/statistic.css
#	public/css/statistic.min.css
#	public/css/step.css
#	public/css/step.min.css
#	public/css/sticky.css
#	public/css/sticky.min.css
#	public/css/tab.css
#	public/css/tab.min.css
#	public/css/table.css
#	public/css/table.min.css
#	public/css/transition.css
#	public/css/transition.min.css
#	public/css/video.css
#	public/css/video.min.css
#	public/favicon.ico
#	public/index.php
#	public/js/printer.js
#	public/js/semantic.min.js
#	public/robots.txt
#	public/web.config
#	resources/assets/js/app.js
#	resources/assets/js/bootstrap.js
#	resources/assets/js/components/Example.vue
#	resources/assets/sass/_variables.scss
#	resources/assets/sass/app.scss
#	resources/lang/en/auth.php
#	resources/lang/en/pagination.php
#	resources/lang/en/passwords.php
#	resources/lang/en/validation.php
#	resources/views/create.blade.php
#	resources/views/layouts/base.blade.php
#	resources/views/list.blade.php
#	routes/api.php
#	routes/channels.php
#	routes/console.php
#	routes/web.php
#	server.php
#	storage/app/.gitignore
#	storage/app/public/.gitignore
#	storage/framework/.gitignore
#	storage/framework/cache/.gitignore
#	storage/framework/sessions/.gitignore
#	storage/framework/views/.gitignore
#	storage/logs/.gitignore
#	tests/CreatesApplication.php
#	tests/Feature/ExampleTest.php
#	tests/TestCase.php
#	tests/Unit/ExampleTest.php
#	webpack.mix.js
#	yarn.lock
2018-04-04 19:55:05 +02:00
kplaczek
20c8d2f763 issue #1 reset form resets selected icon to empty 2018-04-04 19:44:11 +02:00
e1d93fc273 Zaktualizuj 'README.md' 2018-04-04 11:03:41 +02:00
40a7e6dc56 Usuń 'readme.md' 2018-04-04 11:02:47 +02:00
kplaczek
ad53e0c861 Merged older paper pi with the newer, with some recent updates. 2018-04-02 22:34:15 +02:00
Gitea
3c0ebd26ed Merge branch 'master' of http://pi.techtube.pl:3000/krzysiej/paper-pi
Conflicts:
	.gitignore
2017-07-18 09:00:17 +02:00
Gitea
59ac39008d first commit 2017-07-18 08:57:31 +02:00
127 changed files with 17651 additions and 23 deletions

32
.env.example Executable file
View File

@@ -0,0 +1,32 @@
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=mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=

3
.gitattributes vendored Executable file
View File

@@ -0,0 +1,3 @@
* text=auto
*.css linguist-vendored
*.scss linguist-vendored

30
.gitignore vendored Normal file → Executable file
View File

@@ -1,22 +1,10 @@
# ---> Laravel /node_modules
vendor/ /public/storage
node_modules/ /public/hot
npm-debug.log /storage/*.key
/vendor
# Laravel 4 specific /.idea
bootstrap/compiled.php
app/storage/
# Laravel 5 & Lumen specific
public/storage
public/hot
storage/*.key
.env.*.php
.env.php
.env
Homestead.yaml
Homestead.json Homestead.json
Homestead.yaml
# Rocketeer PHP task runner and deployment package. https://github.com/rocketeers/rocketeer .env
.rocketeer/ database/printer.db

3
.htaccess Normal file
View File

@@ -0,0 +1,3 @@
<FilesMatch "\.(ico|pdf|jpg|jpeg|png|gif|html|htm|xml|txt|xsl)$">
Header set Cache-Control "max-age=31536050"
</FilesMatch>

View File

@@ -1,4 +1,40 @@
# paper-pi <p align="center"><img src="https://laravel.com/assets/img/components/logo-laravel.svg"></p>
Webowa aplikacja napisana w PHP pozwalająca na drukowanie za pomocąpodłączonej do raspberry pi drukarki termicznej i zarządzanie zapisanymi wydrukami. <p align="center">
<a href="https://travis-ci.org/laravel/framework"><img src="https://travis-ci.org/laravel/framework.svg" alt="Build Status"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://poser.pugx.org/laravel/framework/d/total.svg" alt="Total Downloads"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://poser.pugx.org/laravel/framework/v/stable.svg" alt="Latest Stable Version"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://poser.pugx.org/laravel/framework/license.svg" alt="License"></a>
</p>
## About Laravel
Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable, creative experience to be truly fulfilling. Laravel attempts to take the pain out of development by easing common tasks used in the majority of web projects, such as:
- [Simple, fast routing engine](https://laravel.com/docs/routing).
- [Powerful dependency injection container](https://laravel.com/docs/container).
- Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage.
- Expressive, intuitive [database ORM](https://laravel.com/docs/eloquent).
- Database agnostic [schema migrations](https://laravel.com/docs/migrations).
- [Robust background job processing](https://laravel.com/docs/queues).
- [Real-time event broadcasting](https://laravel.com/docs/broadcasting).
Laravel is accessible, yet powerful, providing tools needed for large, robust applications. A superb combination of simplicity, elegance, and innovation give you tools you need to build any application with which you are tasked.
## Learning Laravel
Laravel has the most extensive and thorough documentation and video tutorial library of any modern web application framework. The [Laravel documentation](https://laravel.com/docs) is thorough, complete, and makes it a breeze to get started learning the framework.
If you're not in the mood to read, [Laracasts](https://laracasts.com) contains over 900 video tutorials on a range of topics including Laravel, modern PHP, unit testing, JavaScript, and more. Boost the skill level of yourself and your entire team by digging into our comprehensive video library.
## Contributing
Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](http://laravel.com/docs/contributions).
## Security Vulnerabilities
If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell at taylor@laravel.com. All security vulnerabilities will be promptly addressed.
## License
The Laravel framework is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT).

40
app/Console/Kernel.php Executable file
View File

@@ -0,0 +1,40 @@
<?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 Closure based commands for the application.
*
* @return void
*/
protected function commands()
{
require base_path('routes/console.php');
}
}

65
app/Exceptions/Handler.php Executable file
View File

@@ -0,0 +1,65 @@
<?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 should not be reported.
*
* @var array
*/
protected $dontReport = [
\Illuminate\Auth\AuthenticationException::class,
\Illuminate\Auth\Access\AuthorizationException::class,
\Symfony\Component\HttpKernel\Exception\HttpException::class,
\Illuminate\Database\Eloquent\ModelNotFoundException::class,
\Illuminate\Session\TokenMismatchException::class,
\Illuminate\Validation\ValidationException::class,
];
/**
* 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 an unauthenticated response.
*
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Auth\AuthenticationException $exception
* @return \Illuminate\Http\Response
*/
protected function unauthenticated($request, AuthenticationException $exception)
{
if ($request->expectsJson()) {
return response()->json(['error' => 'Unauthenticated.'], 401);
}
return redirect()->guest('login');
}
}

View File

@@ -0,0 +1,93 @@
<?php
/**
* Created by PhpStorm.
* User: k
* Date: 10.02.2017
* Time: 20:10
*/
namespace App\Http\Controllers;
set_time_limit(-1);
use App\Paper\Airly;
use App\Paper\Paper;
use Illuminate\Http\Request;
class AirlyController extends Controller
{
private $paper = null;
public function __construct()
{
$this->paper = new Paper();
}
/**
* get:/airly_all
* @return \Illuminate\Http\RedirectResponse
*/
public function airly_all()
{
$airly = new Airly();
$this->paper->sendImagePrint($airly->icon);
$this->paper->sendHeaderPrint('Jakość powietrza:' . PHP_EOL . date('H:i d-m-Y'));
$airly->setStations(config('paper.airly.stations'));
foreach ($airly->getStations() as $stationId) {
$stationInfo = $airly->getStationInfo($stationId);
$this->paper->sendHeaderPrint($stationInfo['address']['locality'] . ' ' . $stationInfo['address']['route']);
$dataText = $airly->getInformationText($stationId);
$this->paper->sendPrint('', $dataText);
}
return back();
}
public function airly_rzeczypospolitej()
{
$airly = new Airly();
$this->paper->sendImagePrint($airly->icon);
$this->paper->sendHeaderPrint('Jakość powietrza:' . PHP_EOL . date('H:i d-m-Y'));
$airly->setStations([config('paper.airly.rzeczypospolitej')]);
foreach ($airly->getStations() as $stationId) {
$stationInfo = $airly->getStationInfo($stationId);
$this->paper->sendHeaderPrint($stationInfo['address']['locality'] . ' ' . $stationInfo['address']['route']);
$dataText = $airly->getInformationText($stationId);
$this->paper->sendPrint('', $dataText);
}
return back();
}
public function airly_grunwaldzka()
{
$airly = new Airly();
$this->paper->sendImagePrint($airly->icon);
$this->paper->sendHeaderPrint('Jakość powietrza:' . PHP_EOL . date('H:i d-m-Y'));
$airly->setStations([config('paper.airly.grunwaldzka')]);
foreach ($airly->getStations() as $stationId) {
$stationInfo = $airly->getStationInfo($stationId);
$this->paper->sendHeaderPrint($stationInfo['address']['locality'] . ' ' . $stationInfo['address']['route']);
$dataText = $airly->getInformationText($stationId);
$this->paper->sendPrint('', $dataText);
}
return back();
}
public function airly_sowinskiego()
{
$airly = new Airly();
$this->paper->sendImagePrint($airly->icon);
$this->paper->sendHeaderPrint('Jakość powietrza:' . PHP_EOL . date('H:i d-m-Y'));
$airly->setStations([config('paper.airly.sowinskiego')]);
foreach ($airly->getStations() as $stationId) {
$stationInfo = $airly->getStationInfo($stationId);
$this->paper->sendHeaderPrint($stationInfo['address']['locality'] . ' ' . $stationInfo['address']['route']);
$dataText = $airly->getInformationText($stationId);
$this->paper->sendPrint('', $dataText);
}
return back();
}
}

View 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');
}
}

View 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 = '/home';
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest', ['except' => 'logout']);
}
}

View File

@@ -0,0 +1,71 @@
<?php
namespace App\Http\Controllers\Auth;
use App\User;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Validator;
use Illuminate\Foundation\Auth\RegistersUsers;
class RegisterController extends Controller
{
/*
|--------------------------------------------------------------------------
| Register Controller
|--------------------------------------------------------------------------
|
| This controller handles the registration of new users as well as their
| validation and creation. By default this controller uses a trait to
| provide this functionality without requiring any additional code.
|
*/
use RegistersUsers;
/**
* Where to redirect users after registration.
*
* @var string
*/
protected $redirectTo = '/home';
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest');
}
/**
* Get a validator for an incoming registration request.
*
* @param array $data
* @return \Illuminate\Contracts\Validation\Validator
*/
protected function validator(array $data)
{
return Validator::make($data, [
'name' => 'required|max:255',
'email' => 'required|email|max:255|unique:users',
'password' => 'required|min:6|confirmed',
]);
}
/**
* Create a new user instance after a valid registration.
*
* @param array $data
* @return User
*/
protected function create(array $data)
{
return User::create([
'name' => $data['name'],
'email' => $data['email'],
'password' => bcrypt($data['password']),
]);
}
}

View 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 = '/home';
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest');
}
}

View File

@@ -0,0 +1,42 @@
<?php
namespace App\Http\Controllers;
use App\Paper\Paper;
class ClosedShops extends Controller
{
private $icon = 'frown-o';
private $daysClosed = ['11-03','18-03',
'01-04','02-04','08-04','15-04','22-04',
'01-05','03-05','13-05','20-05','31-05',
'10-06','17-06',
'08-07','15-07','22-07',
'12-08','15-08','19-08',
'09-09','16-09','23-09',
'14-10','21-10',
'01-11','11-11','18-11',
'09-12','16-12','25-12','16-12'
];
private $paper;
public function __construct()
{
$this->paper = new Paper();
}
public function tomorrow()
{
$today = new \DateTime();
$tomorrow = $today->modify('+1 day');
if(in_array($tomorrow->format('d-m'), $this->daysClosed)){
$this->paper->sendPrint('Jutro sklepy są zamknięte.', "Jutrzejszy dzień jest dniem \nwolnym od handlu ponieważ jutro \njest święto albo niedziela wolna \nod handlu\n\n".$tomorrow->format('d-m-Y'), $this->icon);
}
}
}

View File

@@ -0,0 +1,13 @@
<?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;
class Controller extends BaseController
{
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
}

View File

@@ -0,0 +1,135 @@
<?php
namespace App\Http\Controllers;
use App\Paper\InteractiveMenu;
use App\Paper\Paper;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
class Keyboard extends Controller
{
public function press(Request $request, $key)
{
$keyboardData = DB::table('keyboard')->where('key', $key)->first();
if (isset($keyboardData) && isset($keyboardData->action)) {
$keyboardAction = explode('_', $keyboardData->action);
$redis = new \Redis();
$redis->connect('127.0.0.1', 6379);
if($keyboardAction[0] == 'interactivemenu' || $redis->get('interactivemenu')){
$interactiveMenu = new InteractiveMenu();
$interactiveMenu->pressed($key);
return;
}
switch ($keyboardAction[0]) {
case 'settings':
$settings = new Settings();
$settings->printMappedKeys();
break;
case 'airly':
$airly = new AirlyController();
switch ($keyboardAction[1]) {
case 'all':
$airly->airly_all();
break;
case 'rzeczypospolitej':
$airly->airly_rzeczypospolitej();
break;
case 'grunwaldzka':
$airly->airly_grunwaldzka();
break;
case 'sowinskiego':
$airly->airly_sowinskiego();
break;
}
break;
case 'note':
switch ($keyboardAction[1]) {
case 'last':
$main = new Main();
$main->noteLast();
break;
case $keyboardAction[1] > 0:
$main = new Main();
$main->printNote((int)$keyboardAction[1]);
break;
}
break;
case 'repertoire':
switch ($keyboardAction[1]) {
case 'all':
switch ($keyboardAction[2]) {
case 'today':
$repertoire = new Repertoire();
$repertoire->today_repertoire($request);
break;
case 'tomorrow':
$repertoire = new Repertoire();
$repertoire->tomorrow_repertoire($request);
break;
}
break;
case 'helios':
switch ($keyboardAction[2]) {
case 'today':
$repertoire = new Repertoire();
$repertoire->today_helios($request);
break;
case 'tomorrow':
$repertoire = new Repertoire();
$repertoire->tomorrow_helios($request);
break;
}
break;
case 'multikino':
switch ($keyboardAction[2]) {
case 'today':
$repertoire = new Repertoire();
$repertoire->today_multikino($request);
break;
case 'tomorrow':
$repertoire = new Repertoire();
$repertoire->tomorrow_multikino($request);
break;
}
break;
case 'cinemacity':
switch ($keyboardAction[2]) {
case 'today':
$repertoire = new Repertoire();
$repertoire->today_cinemacity($request);
break;
case 'tomorrow':
$repertoire = new Repertoire();
$repertoire->tomorrow_cinemacity($request);
break;
}
break;
case 'gdynskiecentrumfilmowe':
switch ($keyboardAction[2]) {
case 'today':
$repertoire = new Repertoire();
$repertoire->today_gdynskiecentrumfilmowe($request);
break;
case 'tomorrow':
$repertoire = new Repertoire();
$repertoire->tomorrow_gdynskiecentrumfilmowe($request);
break;
}
break;
}
break;
}
}
}
}

305
app/Http/Controllers/Main.php Executable file
View File

@@ -0,0 +1,305 @@
<?php
/**
* Created by PhpStorm.
* User: k
* Date: 10.02.2017
* Time: 20:10
*/
namespace App\Http\Controllers;
set_time_limit(-1);
use App\Paper\Paper;
use Illuminate\Support\Facades\DB;
use Intervention\Image\ImageManagerStatic as Image;
use Mike42\Escpos\EscposImage;
use Illuminate\Http\Request;
class Main extends Controller
{
private $paper = null;
const TEMPLATE = 'template';
const NOTE = 'note';
public function __construct()
{
$this->paper = new Paper();
}
/**
* post::/printImage
* @param Request $request
* @return \Illuminate\Http\RedirectResponse
* @throws \Exception
*/
public function imagePrint(Request $request)
{
if ($request->hasFile('photo')) {
$file = $request->photo;
} else {
$file = $request->input('url');
}
$image = Image::make($file);
if ($image->width() > $image->height()) {
$image->rotate(90);
}
$image = $image->greyscale()
->resize(370, null, function ($constraint) {
$constraint->aspectRatio();
$constraint->upsize();
});
$fileName = storage_path('temp.png');
$image->save($fileName, 100);
$img = imagecreatefrompng($fileName);
// imagefilter($img, IMG_FILTER_GRAYSCALE);
$width = imagesx($img);
$height = imagesy($img);
$img_arr = array();
// Parse image (can be combined with dither stage, but combining them is slower.)
for ($y = 0; $y < $height; $y++) {
for ($x = 0; $x < $width; $x++) {
$img_arr[$x][$y] = imagecolorat($img, $x, $y);
}
}
// make a b/w output image.
$output = imagecreate($width, $height);
$black = imagecolorallocate($output, 0, 0, 0); //background color.
$white = imagecolorallocate($output, 0xff, 0xff, 0xff);
for ($y = 1; $y < $height - 3; $y++) {
for ($x = 1; $x < $width - 3; $x++) {
$old = $img_arr[$x][$y];
if ($old > 0xffffff * .5) { // This is the b/w threshold. Currently @ halfway between white and black.
$new = 0xffffff;
imagesetpixel($output, $x, $y, $white); // Only setting white pixels, because the image is already black.
} else {
$new = 0x000000;
}
$quant_error = $old - $new;
$error_diffusion = (1 / 8) * $quant_error; //I can do this because this dither uses 1 value for the applied error diffusion.
//dithering here.
$img_arr[$x + 1][$y] += $error_diffusion;
$img_arr[$x + 2][$y] += $error_diffusion;
$img_arr[$x - 1][$y + 1] += $error_diffusion;
$img_arr[$x][$y + 1] += $error_diffusion;
$img_arr[$x + 1][$y + 1] += $error_diffusion;
$img_arr[$x][$y + 2] += $error_diffusion;
}
}
// plop out a png of the dithered image.
// Header("Content-type: image/png");
imagepng($output, $fileName, 9); //to print to screen
$img = EscposImage::load($fileName, false);
$this->paper->getPrinter()->bitImage($img);
$this->paper->getPrinter()->feed(4);
return back();
}
/**
* get:/
* @param Request $request
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function listView(Request $request)
{
$notes = DB::select('SELECT * FROM note WHERE type = "note" ORDER BY updated_at DESC');
$templates = DB::select('SELECT * FROM note WHERE type = "template" ORDER BY updated_at DESC');
return view('list', [
'notes' => $notes,
'templates' => $templates,
'title' => $request->old('title'),
'text' => $request->old('text'),
'icon_selected' => $request->old('icon'),
'icons' => $this->paper->getIcons()
]);
}
/**
* get:/filte/{$filter?}
* @param Request $request
* @param null $filter
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function filterView(Request $request, $filter = 'empty')
{
$notes = DB::select('SELECT *, CASE WHEN icon IS NULL
THEN \'empty\'
ELSE icon
END AS new_icon FROM note WHERE type = "note" AND new_icon = :icon ORDER BY updated_at DESC', ['icon' => $filter]);
$templates = DB::select('SELECT *, CASE WHEN icon IS NULL
THEN \'empty\'
ELSE icon
END AS new_icon FROM note WHERE type = "template" AND new_icon = :icon ORDER BY updated_at DESC', ['icon' => $filter]);
return view('list', [
'filter' => $filter,
'notes' => $notes,
'templates' => $templates,
'title' => $request->old('title'),
'text' => $request->old('text'),
'icon_selected' => $request->old('icon'),
'icons' => $this->paper->getIcons()
]);
}
/**
* post::/print/{id}
* @param Request $request
* @param $id
* @return \Illuminate\Http\RedirectResponse
*/
public function printText(Request $request, $id)
{
$note = $this->printNote($id);
$request->session()->flash('print_status', 'Wydrukowano notatkę: ' . $note->topic . '!');
return back();
}
public function printNote($noteId)
{
$note = DB::table('note')->where('id', $noteId)->first();
$this->paper->sendPrint($note->topic, $note->text, $note->icon);
return $note;
}
public function noteLast()
{
$note = DB::table('note')->orderBy('id', 'desc')->first();
$this->printNote($note->id);
}
private function templateReplace($input)
{
return str_replace(['[d]', '[m]', '[y]', '[h]', '[i]', '[s]'],
[date('d'), date('m'), date('Y'), date('H'), date('i'), date('s')],
$input);
}
/**
* get::/edit/{id}/{slug}
* post::/edit/{id}/{slug}
* @param Request $request
* @param $id
* @param $slug
* @return \Illuminate\Contracts\View\Factory|\Illuminate\Http\RedirectResponse|\Illuminate\View\View
*/
public function edit(Request $request, $id, $slug = null)
{
$note = DB::table('note')->where('id', $id)->first();
if ($request->isMethod('post')) {
if ($request->exists('save') ||
$request->exists('save_template')) {
if ($note->type == $this::TEMPLATE) {
$id = DB::table('note')
->insertGetId([
'topic' => $this->templateReplace($request->input('title')),
'topic_slug' => str_slug($request->input('title'), '_'),
'text' => $this->templateReplace($request->input('text')),
'icon' => $request->input('icon'),
'type' => self::NOTE,
'private' => $request->input('private', 0),
'created_at' => time(),
'updated_at' => time()
]);
$note = DB::table('note')->where('id', $id)->first();
} else {
DB::table('note')
->where('id', $note->id)
->update([
'topic' => $request->input('title'),
'topic_slug' => str_slug($request->input('title'), '_'),
'text' => $request->input('text'),
'icon' => $request->input('icon'),
'private' => $request->input('private',0),
'updated_at' => time(),
]);
}
} elseif ($request->exists('delete')) {
DB::table('note')
->where('id', $note->id)
->delete();
return redirect()->route('list');
} elseif ($request->exists('print')) {
$this->paper->sendPrint($request->input('title'), $request->input('text'), $request->input('icon'));
$request->session()->flash('print_status', 'Wydrukowano notatkę: ' . (strlen($request->input('title')) ? $request->input('title') : substr($request->input('text'), 0, 20)) . '!');
}
return redirect()->route('edit', ['id' => $note->id, 'slug' => $note->topic_slug]);
} else {
return view('edit', [
'title' => $note->topic,
'text' => $note->text,
'icon_selected' => $note->icon,
'type' => $note->type,
'private' => $note->private,
'id' => $note->id,
'icons' => $this->paper->getIcons(),
'topic_slug' => $note->topic_slug,
]);
}
}
/**
* post::/
* @param Request $request
* @return $this|\Illuminate\Http\RedirectResponse
*/
public function main(Request $request)
{
if ($request->exists('save')) {
$id = DB::table('note')
->insertGetId([
'topic' => $request->input('title'),
'topic_slug' => str_slug($request->input('title'), '_'),
'text' => $request->input('text'),
'icon' => $request->input('icon'),
'type' => self::NOTE,
'private' => $request->input('private',0),
'created_at' => time(),
'updated_at' => time()
]);
$note = DB::table('note')->where('id', $id)->first();
return redirect()->route('edit', ['id' => $note->id, 'slug' => $note->topic_slug]);
} elseif ($request->exists('save_template')) {
$id = DB::table('note')
->insertGetId([
'topic' => $request->input('title'),
'topic_slug' => str_slug($request->input('title'), '_'),
'text' => $request->input('text'),
'icon' => $request->input('icon'),
'type' => self::TEMPLATE,
'private' => $request->input('private',0),
'created_at' => time(),
'updated_at' => time()
]);
$note = DB::table('note')->where('id', $id)->first();
return redirect()->route('edit', ['id' => $note->id, 'slug' => $note->topic_slug]);
} else {
$this->paper->sendPrint($request->input('title'), $request->input('text'), $request->input('icon'));
$request->session()->flash('print_status', 'Wydrukowano szybką notatkę: ' . (strlen($request->input('title')) ? $request->input('title') : substr($request->input('text'), 0, 20)) . '!');
return back()->withInput();
}
}
}

View File

@@ -0,0 +1,110 @@
<?php
namespace App\Http\Controllers;
use App\Paper\CinemaMultikino;
use DiDom\Query;
use Illuminate\Http\Request;
use DiDom\Document;
use App\Paper\Paper;
class PacktPub extends Controller
{
private $main;
private $icon = '/small/book.png';
private $freeBook = 'https://www.packtpub.com/packt/offers/free-learning';
private $loginData;
public function __construct()
{
$this->paper = new Paper();
$this->loginData = array(
'email' => 'krzysiej@gmail.com',
'password' => 'korki1korki1',
'op' => 'Login',
'form_build_id' => '',
'form_id' => 'packt_user_login_form',
);
}
public function today()
{
$data = file_get_contents($this->freeBook);
$document = new Document($data);
// list(,,$id,)= explode('/', $document->first('//form[@id="free-learning-form"]/@action', Query::TYPE_XPATH));
$id = $document->first('//input[@id="free-learning-register-claim-title-nid"]/@value', Query::TYPE_XPATH);
$myBooksRaw = $this->c('https://www.packtpub.com/account/my-ebooks', $this->loginData);
print_r($myBooksRaw);
$myBooks = new Document($myBooksRaw);
// $x = $myBooks->first('//div[@nid="' . $id . '"]', Query::TYPE_XPATH);
var_dump($id);
var_dump('//div[@nid="' . $id . '"]');
$isOwnd = (bool)$myBooks->first('//div[@nid="' . $id . '"]', Query::TYPE_XPATH);
var_dump($isOwnd);
die();
$titleNode = $document->first('.dotd-title h2');
if ($titleNode) {
$title = trim($titleNode->text());
}
$descriptionNodes = $document->find('//div[contains(@class,"dotd-main-book-summary")]/div[not(@class)]', Query::TYPE_XPATH);
$descriptionText = '';
if ($descriptionNodes) {
foreach ($descriptionNodes as $node) {
$descriptionText .= trim($node->text()) . "\n";
}
}
$descriptionText .= "\n\n" . (($isOwnd) ? 'Masz już tę książkę w biblioteczce.' : 'Nie masz jeszcze tej książki.');
$descriptionText .= "\n\n" . date('Y-m-d');
$imageNode = $document->first('//div[contains(@class, "dotd-main-book")]//img[contains(@class, "bookimage")]/@src', Query::TYPE_XPATH);
if ($imageNode) {
$imageNode = str_replace(' ', '%20', $imageNode);
$this->paper->sendPrint($title, $descriptionText, 'https:' . $imageNode, false);
}
}
private function c($url, $postArray = null)
{
$cookie = __DIR__ . '/cookie.txt';
$ch = curl_init();
$useragent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6";
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_FAILONERROR, TRUE);
curl_setopt($ch, CURLOPT_COOKIESESSION, TRUE);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie);
curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
curl_setopt($ch, CURLOPT_URL, $url);
if (!is_null($postArray)) {
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($postArray));
}
$result = curl_exec($ch);
curl_close($ch);
return $result;
}
}

View File

@@ -0,0 +1,27 @@
<?php
namespace App\Http\Controllers;
use App\Paper\Paper;
use Illuminate\Http\Request;
class Plivo extends Controller
{
/** @var Paper */
private $paper;
public function __construct()
{
$this->paper = new Paper();
}
public function recieveSms(Request $request)
{
if ($request->isMethod('post')) {
$this->paper->sendPrint('SMS od '. $request->input('From'), $request->input('Text')."\n\n".date('d-m-Y H:i'), 'envelope-o');
}
}
}

View File

@@ -0,0 +1,150 @@
<?php
namespace App\Http\Controllers;
use App\Paper\CinemaCinemaCity;
use App\Paper\CinemaGdynskieCentrumFilmowe;
use App\Paper\CinemaHelios;
use App\Paper\CinemaMultikino;
use App\Paper\Paper;
use Illuminate\Http\Request;
class Repertoire extends Controller
{
private $main;
private $icon = 'film';
public function __construct()
{
$this->main = new Paper();
}
public function today_cinemacity(Request $request)
{
$cinemacity = new CinemaCinemaCity();
$cinemacity->setCinemaId(1010912);
$cinemacity->setDay(date('Y-m-d'));
$repertuarText = $cinemacity->convertToPrint();
$this->main->sendPrint('', $repertuarText, $this->icon);
$request->session()->flash('print_status', 'Wydrukowano repertuar CinemaCity na dzisiaj!');
return back();
}
public function tomorrow_cinemacity(Request $request)
{
$cinemacity = new CinemaCinemaCity();
$cinemacity->setCinemaId(1010912);
$cinemacity->setDay(date_create()->modify('+1 day')->format('Y-m-d'));
$repertuarText = $cinemacity->convertToPrint();
$this->main->sendPrint('', $repertuarText, $this->icon);
$request->session()->flash('print_status', 'Wydrukowano repertuar CinemaCity na jutro!');
return back();
}
public function today_multikino(Request $request)
{
$multikino = new CinemaMultikino();
$multikino->setCinemaId(4);
$multikino->setDay(date('Y-m-d'));
$repertuarText = $multikino->convertToPrint();
$this->main->sendPrint('', $repertuarText, $this->icon);
$request->session()->flash('print_status', 'Wydrukowano repertuar Multikina na dzisiaj!');
return back();
}
public function tomorrow_multikino(Request $request)
{
$multikino = new CinemaMultikino();
$multikino->setDay(date_create()->modify('+1 day')->format('Y-m-d'));
$multikino->setCinemaId(4);
$repertuarText = $multikino->convertToPrint();
$this->main->sendPrint('', $repertuarText, $this->icon);
$request->session()->flash('print_status', 'Wydrukowano repertuar Multikina na jutro!');
return back();
}
public function tomorrow_gdynskiecentrumfilmowe(Request $request)
{
$gdynskieCentrumFilmowe = new CinemaGdynskieCentrumFilmowe();
$gdynskieCentrumFilmowe->setDay(date_create()->modify('+1 day')->format('d_m_Y'));
$repertuarText = $gdynskieCentrumFilmowe->convertToPrint();
$this->main->sendPrint('', $repertuarText, $this->icon);
$request->session()->flash('print_status', 'Wydrukowano repertuar Gdyńskiego Centrum Filmowego na jutro!');
return back();
}
public function today_gdynskiecentrumfilmowe(Request $request)
{
$gdynskieCentrumFilmowe = new CinemaGdynskieCentrumFilmowe();
$gdynskieCentrumFilmowe->setDay(date('d_m_y'));
$repertuarText = $gdynskieCentrumFilmowe->convertToPrint();
$this->main->sendPrint('', $repertuarText, $this->icon);
$request->session()->flash('print_status', 'Wydrukowano repertuar Gdyńskiego Centrum Filmowego na jutro!');
return back();
}
public function today_helios(Request $request)
{
$helios = new CinemaHelios();
$helios->setDay(0);
$helios->setCinemaId([2, 49]);
$helios->convertToPrint();
$repertuarText = $helios->convertToPrint();
$this->main->sendPrint('', $repertuarText, $this->icon);
$request->session()->flash('print_status', 'Wydrukowano repertuar Helios na dzisiaj!');
return back();
}
public function tomorrow_helios(Request $request)
{
$helios = new CinemaHelios();
$helios->setDay(1);
$helios->setCinemaId([2, 49]);
$helios->convertToPrint();
$repertuarText = $helios->convertToPrint();
$this->main->sendPrint('', $repertuarText, $this->icon);
$request->session()->flash('print_status', 'Wydrukowano repertuar Helios na jutro!');
return back();
}
public function today_repertoire(Request $request)
{
$this->today_multikino($request);
$this->today_cinemacity($request);
$this->today_helios($request);
$this->today_gdynskiecentrumfilmowe($request);
$request->session()->flash('print_status', 'Wydrukowano repertuar Heliosa, Multikina, CinemaCity i Gdyńskiego Centrum Filmowego na dzisiaj!');
return back();
}
public function tomorrow_repertoire(Request $request)
{
$this->tomorrow_multikino($request);
$this->tomorrow_cinemacity($request);
$this->tomorrow_helios($request);
$this->tomorrow_gdynskiecentrumfilmowe($request);
$request->session()->flash('print_status', 'Wydrukowano repertuar Heliosa, Multikina, CinemaCity i Gdyńskiego Centrum Filmowego na jutro!');
return back();
}
}

View File

@@ -0,0 +1,122 @@
<?php
/**
* Created by PhpStorm.
* User: k
* Date: 10.02.2017
* Time: 20:10
*/
namespace App\Http\Controllers;
set_time_limit(-1);
use App\Paper\Paper;
use Illuminate\Support\Facades\DB;
use Illuminate\Http\Request;
class Settings extends Controller
{
private $paper = null;
public function __construct()
{
$this->paper = new Paper();
}
/**
* get:/
* @param Request $request
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function mainView(Request $request)
{
$keyboard = DB::select('SELECT * FROM keyboard');
return view('settings', [
'keyboard' => $keyboard,
'actions' => $this->getActions()
]);
}
public function getMappedKeys()
{
$keys = DB::table('keyboard')->get();
$text = '';
$actions = $this->getActions('');
foreach ($keys as $key) {
$text .= '[' . $key->key . '] ' . $actions[$key->action] . "\n";
}
return $text;
}
public function printMappedKeys()
{
$this->paper->sendPrint('Zmapowane klawisze', $this->getMappedKeys());
}
public function save(Request $request)
{
foreach ($request->input('key') as $keyid => $keyValue) {
DB::table('keyboard')
->where('id', $keyid)
->update([
'action' => $keyValue,
]);
}
return redirect()->route('settingsList');
}
private function getActions($noActionText = 'Bez akcji')
{
$actions = [];
$actions[''] = $noActionText;
$actions['separator0'] = 'separator';
$actions['settings_list'] = 'Lista zmapowanych klawiszy';
$actions['separator1'] = 'separator';
$actions['interactivemenu'] = 'Interaktywne menu';
$actions['separator2'] = 'separator';
$actions['repertoire_all_today'] = 'Repertuar wszystkie kina dzisiaj';
$actions['repertoire_all_tomorrow'] = 'Repertuar wszystkie kina jutro';
$actions['repertoire_helios_today'] = 'Repertuar Helios dzisiaj';
$actions['repertoire_helios_tomorrow'] = 'Repertuar Helios jutro';
$actions['repertoire_multikino_today'] = 'Repertuar Multikino dzisiaj';
$actions['repertoire_multikino_tomorrow'] = 'Repertuar Multikino jutro';
$actions['repertoire_cinemacity_today'] = 'Repertuar Cinema-City dzisiaj';
$actions['repertoire_cinemacity_tomorrow'] = 'Repertuar Cinema-City jutro';
$actions['repertoire_gdynskiecentrumfilmowe_today'] = 'Repertuar Gdyńskie Centrum filmowe dzisiaj';
$actions['repertoire_gdynskiecentrumfilmowe_tomorrow'] = 'Repertuar Gdyńskie Centrum filmowe jutro';
$actions['separator3'] = 'separator';
$actions['airly_all'] = 'Airly wszystkie stacje';
$actions['airly_rzeczypospolitej'] = 'Airly (Rzeczypospolitej)';
$actions['airly_grunwaldzka'] = 'Airly (Grunwaldzka)';
$actions['airly_sowinskiego'] = 'Airly (Sowińskiego)';
// $actions['separator3'] = 'separator';
// $actions['spacex_next_flight'] = 'Najbliższy lot SpaceX';
// $actions['spacex_prev_flight'] = 'Poprzedni lot SpaceX';
// $actions['spacex_all_next_summary'] = 'Wszystkie zaplanowane loty SpaceX (skrót)';
$actions['separator5'] = 'separator';
$actions['note_last'] = 'Ostatnia zapisana notatka';
$actions['separator6'] = 'separator';
$notes = DB::select('SELECT * FROM note WHERE type = "note" ORDER BY updated_at DESC');
foreach ($notes as $note) {
$actions['note_' . $note->id] = 'Notatka: ' . $note->topic;
}
return $actions;
}
}

60
app/Http/Kernel.php Executable file
View File

@@ -0,0 +1,60 @@
<?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,
];
/**
* 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,
'can' => \Illuminate\Auth\Middleware\Authorize::class,
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
];
}

View File

@@ -0,0 +1,17 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Cookie\Middleware\EncryptCookies as BaseEncrypter;
class EncryptCookies extends BaseEncrypter
{
/**
* The names of the cookies that should not be encrypted.
*
* @var array
*/
protected $except = [
//
];
}

View 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);
}
}

View File

@@ -0,0 +1,18 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\TrimStrings as BaseTrimmer;
class TrimStrings extends BaseTrimmer
{
/**
* The names of the attributes that should not be trimmed.
*
* @var array
*/
protected $except = [
'password',
'password_confirmation',
];
}

View File

@@ -0,0 +1,17 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as BaseVerifier;
class VerifyCsrfToken extends BaseVerifier
{
/**
* The URIs that should be excluded from CSRF verification.
*
* @var array
*/
protected $except = [
'sms'
];
}

88
app/Paper/Airly.php Normal file
View File

@@ -0,0 +1,88 @@
<?php
namespace App\Paper;
class Airly
{
private $apiKey;
public $icon = 'cloud';
private $stations = [];
private $airlyApi = 'https://airapi.airly.eu/v1';
public function __construct()
{
$this->apiKey = config('paper.airly.api_key');
}
public function getStations()
{
return $this->stations;
}
public function setStations(array $stations){
$this->stations = $stations;
}
function getStationInfo($stationId)
{
return json_decode(file_get_contents(sprintf('%s/sensors/%d?apikey=%s', $this->airlyApi, $stationId, $this->apiKey)), 1);
}
function getStationMeasurements($stationId)
{
return json_decode(file_get_contents(sprintf('%s/sensor/measurements?sensorId=%d&apikey=%s', $this->airlyApi, $stationId, $this->apiKey)), 1);
}
public function getPollutionLevelToText($pollutionLevel)
{
return ["Wspaniałe powietrze! Idealny dzień na aktywność na świeżym powietrzu",
"Dobre powietrze. Możesz bez obaw wyjść na zewnątrz i cieszyć się dniem",
"Bywało lepiej… To nie jest najlepszy dzień na aktywność poza domem",
"Zła jakość powietrza! Lepiej zostań dzisiaj w domu",
"Zła jakość powietrza! Lepiej zostań dzisiaj w domu",
"Bardzo zła jakość powietrza! Zostań dziś w domu"][$pollutionLevel - 1];
}
public function getInformationText($stationId)
{
$stationMeasurements = $this->getStationMeasurements($stationId);
if ($stationMeasurements['currentMeasurements'] === []) {
$dataText = 'Brak aktualnych danych ze stacji';
} else {
$dataText = "Aktualne warunki:" . PHP_EOL;
if (isset($stationMeasurements['currentMeasurements']['temperature'])) {
$dataText .= "Temperatura: " . round((int)$stationMeasurements['currentMeasurements']['temperature'], 0) . "°C" . PHP_EOL;
}
if (isset($stationMeasurements['currentMeasurements']['pressure'])) {
$dataText .= "Ciśnienie: " . round(((float)$stationMeasurements['currentMeasurements']['pressure'] / 100), 2) . "hPa" . PHP_EOL;
}
if (isset($stationMeasurements['currentMeasurements']['humidity'])) {
$dataText .= "Wilgotność: " . round((int)$stationMeasurements['currentMeasurements']['humidity'], 2) . "%" . PHP_EOL . PHP_EOL;
}
if (isset($stationMeasurements['currentMeasurements']['pm1'])) {
$dataText .= "PMI 1: " . (int)$stationMeasurements['currentMeasurements']['pm1'] . "ppm" . PHP_EOL;
}
if (isset($stationMeasurements['currentMeasurements']['pm25'])) {
$dataText .= "PMI 2.5: " . (int)$stationMeasurements['currentMeasurements']['pm25'] . "ppm / " . round((int)$stationMeasurements['currentMeasurements']['pm25'] / 0.25, 0) . '%' . PHP_EOL;
}
if (isset($stationMeasurements['currentMeasurements']['pm10'])) {
$dataText .= "PMI 10: " . (int)$stationMeasurements['currentMeasurements']['pm10'] . "ppm / " . round((int)$stationMeasurements['currentMeasurements']['pm10'] / 0.50, 0) . '%' . PHP_EOL;
}
if (isset($stationMeasurements['currentMeasurements']['airQualityIndex'])) {
$dataText .= "Ogólna jakość powietrza: " . (int)$stationMeasurements['currentMeasurements']['airQualityIndex'] . '/100' . PHP_EOL;
}
if (isset($stationMeasurements['currentMeasurements']['pollutionLevel'])) {
$dataText .= "Stopień zanieczyszczeń: " . (int)$stationMeasurements['currentMeasurements']['pollutionLevel'] . '/6' . PHP_EOL;
$dataText .= $this->getPollutionLevelToText((int)$stationMeasurements['currentMeasurements']['pollutionLevel']);
}
}
return $dataText;
}
}

View File

@@ -0,0 +1,79 @@
<?php
namespace App\Paper;
use App\Paper\Interfaces\Cinema;
use DiDom\Document;
class CinemaCinemaCity implements Cinema
{
private $cinemaId;
private $day;
public function setCinemaId($cinemaId)
{
$this->cinemaId = $cinemaId;
}
public function setDay($day)
{
$this->day = $day;
}
function fetchRepertorire()
{
if (is_null($this->cinemaId) || is_null($this->day))
throw new \Exception('Day or cinemaid not set.');
$url = 'https://www.cinema-city.pl/pgm-list-byfeat?si=' . $this->cinemaId . '&sort=cin&bd=' . $this->day;
return file_get_contents($url);
}
function parseRepertoire()
{
$document = $this->fetchRepertorire();
$document = json_decode($document);
$movies = [];
$date = date('d/m/Y', strtotime($this->day));
foreach ($document as $movieData) {
$movie = [];
$movie['title'] = $movieData->n;
$movie['hours'] = [];
foreach ($movieData->BD as $projections) {
if ($projections->date == $date) {
foreach ($projections->P as $projection) {
$movie['hours'][] = $projection->time;
}
}
}
if (count($movie['hours']) > 0) {
$movies[] = $movie;
}
}
return $movies;
}
function convertToPrint()
{
$cinemas = $this->parseRepertoire();
$text = "Repertuar Cinema-City\n";
$text .= $this->day . "\n\n";
foreach ($cinemas as $movie) {
$text .= $movie['title'] . "\n";
$text .= implode(',', $movie['hours'] ). "\n\n";
}
return $text;
}
}

View File

@@ -0,0 +1,82 @@
<?php
namespace App\Paper;
use App\Paper\Interfaces\Cinema;
use DiDom\Document;
class CinemaGdynskieCentrumFilmowe implements Cinema
{
private $cinemaId;
private $day;
public function setCinemaId($cinemaId)
{
$this->cinemaId = $cinemaId;
}
public function setDay($day)
{
$this->day = $day;
}
function fetchRepertorire()
{
if (is_null($this->day))
throw new \Exception('Day not set.');
// if (!is_array($this->cinemaId)) {
// $this->cinemaId = (array)$this->cinemaId;
// }
$url = 'http://www.gdynskiecentrumfilmowe.pl/kino_studyjne/repertuar/,' . strtotime($this->day) . ',_' . $this->day . '.html';
return file_get_contents($url);
}
function parseRepertoire()
{
$rawPage = $this->fetchRepertorire();
$document = new Document();
$document->loadHtml($rawPage);
$moviesData = [];
$movies = $document->find('.articles .article-item');
foreach ($movies as $movie) {
$movieData = [];
$movieData['title'] = $movie->first('.item-title-int::text');
$movieData['hours'] = [];
foreach ($movie->find('.projection span') as $projection) {
$movieData['hours'][] = $projection->innerHtml();
}
// $text .= implode(', ', array_unique($hours)) . "\n\n";
$moviesData[] = $movieData;
}
return $moviesData;
}
function convertToPrint()
{
$movies = $this->parseRepertoire();
$text = '';
$text .= "Repertuar Gdyńskie Centrum Filmowe\n";
$text .= str_replace('_', '-', $this->day) . "\n\n";
foreach ($movies as $movie) {
$text .= $movie['title']. "\n";
$text .= implode(', ', array_unique($movie['hours'])). "\n\n";
}
return $text;
}
}

View File

@@ -0,0 +1,86 @@
<?php
namespace App\Paper;
use App\Paper\Interfaces\Cinema;
use DiDom\Document;
class CinemaHelios implements Cinema
{
private $cinemaId;
private $day;
private $cinemas = [2 => 'Helios Alfa', 49 => 'Helios Metropolia'];
public function setCinemaId($cinemaId)
{
$this->cinemaId = $cinemaId;
}
public function setDay($day)
{
$this->day = $day;
}
function fetchRepertorire()
{
if (is_null($this->cinemaId) || is_null($this->day))
throw new \Exception('Day or cinemaid not set.');
if (!is_array($this->cinemaId)) {
$this->cinemaId = (array)$this->cinemaId;
}
$documents = [];
foreach ($this->cinemaId as $cinema) {
$url = 'http://www.helios.pl/2,Gdansk/Repertuar/axRepertoire/?dzien=' . $this->day . '&kino=' . $cinema;
$data = json_decode(file_get_contents($url));
$document = new Document();
$data->html = str_replace(["\n", "\t"], '', $data->html);
$document->loadHtml($data->html);
$documents[] = $document;
}
return $documents;
}
function parseRepertoire()
{
$documents = $this->fetchRepertorire();
$cinemas = [];
foreach ($documents as $document) {
$movies = [];
foreach ($document->find('.seance') as $seans) {
$movie = [];
$movie['title'] = trim($seans->find('.movie-title')[0]->text());
$hours = [];
foreach ($seans->find('.time li') as $hour) {
$hours[] = $hour->text();
}
$movie['hours'] = array_unique($hours);
$movies[] = $movie;
}
$cinemas[] = $movies;
}
return $cinemas;
}
function convertToPrint()
{
$cinemas = $this->parseRepertoire();
$text = '';
foreach ($cinemas as $cinemaId => $filmy) {
$text .= "Repertuar " . $this->cinemas[$this->cinemaId[$cinemaId]] . "\n";
$text .= date_create()->modify("+$this->day day")->format('d-m-Y') . "\n\n";
foreach ($filmy as $film) {
$text .= $film['title'] . "\n";
$text .= implode(', ', array_unique($film['hours'])) . "\n\n";
}
$text .= "\n";
}
return $text;
}
}

View File

@@ -0,0 +1,91 @@
<?php
namespace App\Paper;
use App\Paper\Interfaces\Cinema;
class CinemaMultikino implements Cinema
{
private $cinemaId;
private $day;
public function setCinemaId($cinemaId)
{
$this->cinemaId = $cinemaId;
}
public function setDay($day)
{
$this->day = $day;
}
function fetchRepertorire()
{
if (is_null($this->cinemaId) || is_null($this->day))
throw new \Exception('Day or cinemaid not set.');
$moviePath = 'https://multikino.pl/data/filmswithshowings/' . $this->cinemaId;
$movieContent = file_get_contents($moviePath);
$movieJson = json_decode($movieContent, 0);
return $movieJson;
}
function parseRepertoire()
{
$movieJson = $this->fetchRepertorire();
$filmy = [];
foreach ($movieJson->films as $movie) {
$film = [];
$film['id'] = $movie->id;
$film['title'] = $movie->title;
$film['times'] = [];
$film['date'] = $this->day;
$film['runningtime'] = $movie->info_runningtime;
$film['genres'] = [];
$film['synopsis_short'] = str_replace(["\r\n", " "], [" "], $movie->synopsis_short);
if ($movie->original_s_count > 0 && $movie->show_showings) {
foreach ($movie->showings as $shoving) {
if ($shoving->date_time == $this->day) {
foreach ($shoving->times as $time) {
$film['times'][] = $time->time . " " . $time->screen_type;
}
}
}
}
foreach ($movie->genres->names as $genre) {
$film['genres'][] = $genre->name;
}
if (count($film['times'])) {
$filmy[] = $film;
}
}
return $filmy;
}
function convertToPrint()
{
$filmy = $this->parseRepertoire();
$text = '';
$text .= "Repertuar Multikino Gdańsk\n";
$text .= $this->day . "\n\n";
foreach ($filmy as $movie) {
$text .= $movie['title'] . "\n";
$text .= '(' . $movie['runningtime'] . ")\n";
$text .= implode(', ', $movie['genres']) . "\n\n";
$text .= $movie['synopsis_short'] . "\n\n";
$text .= implode(', ', $movie['times']) . "\n";
$text .= "--------------------------------\n\n";
}
return $text;
}
}

115
app/Paper/HtmlToPos.php Normal file
View File

@@ -0,0 +1,115 @@
<?php
namespace App\Paper;
class HtmlToPos
{
private function handleNewLine($text)
{
return str_replace(['<br>', '<br/>', '<br />'], "\n", $text);
}
/**
* usuwa linijki które na początku mają ! albo #
* @param $posText
* @return string
*/
private function hideLines($posText): string
{
return preg_replace('/^\s*[!#].*?$[\r\n]?/m', '', $posText);
}
private function pickRandomElement($posText)
{
/**
* poniższy kod wybieraz tekstu fragmenty w podwójnych nawiasach kwadratowych, rozdziela je po przecinkach
* następnie losuje element i podmienia go w miejsce oryginalnego fragmentu
*/
$re = "#\[\[(.*?)\]\]#s";
preg_match_all($re, $posText, $found, PREG_SET_ORDER, 0);
foreach ($found as $elements) {
$data = explode(',', $elements[1]);
$data = array_filter($data, function ($el) {
return strlen(trim($el));
});
$data = array_values($data);
$pos = strpos($posText, $elements[0]);
$posText = substr_replace($posText, $data[mt_rand(0, count($data) - 1)], $pos, strlen($elements[0]));
}
return $posText;
}
private function randomNumber($posText)
{
/**
* przeszukiwanie tekstu pod katem zawartości [ liczba, liczba2 ] i zamienianiu tego na randomową liczbę z przedziału
* liczba - liczba2
* obojętnie czy ujemną czy nie
*/
$re = '/\[\s*(-?\d+)\s*\,\s*(-?\d+)\s*\]/';
preg_match_all($re, $posText, $matches, PREG_SET_ORDER, 0);
foreach ($matches as $match) {
$pos = strpos($posText, $match[0]);
$posText = substr_replace($posText, mt_rand($match[1], $match[2]), $pos, strlen($match[0]));
}
return $posText;
}
public function vocabularyWord($posText)
{
if (strstr($posText, '[vocabulary_word]')
|| strpos($posText, '[vocabulary_short]')
|| strpos($posText, '[vocabulary_long]')) {
$voc = new Vocabulary();
$randomWord = $voc->getRandomWord();
$word = $voc->getWord($randomWord);
$posText = str_replace('[vocabulary_word]', $word->word, $posText);
$posText = str_replace('[vocabulary_short]', $word->short, $posText);
$posText = str_replace('[vocabulary_long]', $word->long, $posText);
}
return $posText;
}
public function traficar($posText)
{
if (strstr($posText, '[traficar]')) {
$traficar = new Traficar();
$nearest = $traficar->nearestCarText();
$posText = str_replace('[traficar]', $nearest, $posText);
}
return $posText;
}
/**
* łamie tekst w miejscu spacji do długości 32 znaki na linię
* @param $posText
* @return string
*/
public function textBreak($posText)
{
$posText = wordwrap($posText, 32);
return $posText;
}
public function convert($html = '')
{
$posText = $this->handleNewLine($html);
$posText = $this->hideLines($posText);
$posText = $this->pickRandomElement($posText);
$posText = $this->randomNumber($posText);
$posText = $this->vocabularyWord($posText);
$posText = $this->traficar($posText);
$posText = $this->textBreak($posText);
return $posText;
}
}

View File

@@ -0,0 +1,42 @@
<?php
namespace App\Paper;
class InteractiveMenu
{
private $apiKey;
private $paper;
private $redis;
private $structure = [
0 =>
[
'title' => 'tytuł pierwszego menu',
1 => ['name' => 'to jest podtytuł pierwszego menu', 'action' => '', 'type' => 'output'],
2 => ['name' => 'to jest podtytuł drugiego menu', 'action' => '', 'type' => 'input'],
3 => ['name' => 'to jest podtytuł trzeciego menu', 'action' => '', 'type' => 'outputandinput'],
4 => ['name' => 'to jest podtytuł czwartego menu', 'action' => '', 'type' => 'inputandoutput'],
]
];
public function __construct()
{
$this->paper = new Paper();
$this->redis = new \Redis();
$this->redis->connect('127.0.0.1', 6379);
$this->redis->setex('interactivemenu', 10, 1);
}
public function pressed($key)
{
$this->paper->sendPrint($key);
}
}

View File

@@ -0,0 +1,24 @@
<?php
namespace App\Paper\Interfaces;
/**
* Created by PhpStorm.
* User: k
* Date: 28.05.2017
* Time: 20:14
*/
interface Cinema
{
function setCinemaId($cinemaId);
function setDay($day);
function fetchRepertorire();
function parseRepertoire();
function convertToPrint();
}

136
app/Paper/Paper.php Normal file
View File

@@ -0,0 +1,136 @@
<?php
namespace App\Paper;
use Illuminate\Support\Facades\DB;
use Mike42\Escpos\PrintConnectors\FilePrintConnector;
use Mike42\Escpos\Printer;
use App\Paper\HtmlToPos;
use Mike42\Escpos\EscposImage;
use Mockery\Exception;
class Paper
{
private $imageDirectory = 'large/';
private $printer;
private $connector;
public function __construct()
{
try {
$this->connector = new FilePrintConnector("/dev/usb/lp0");
$this->printer = new Printer($this->connector);
} catch (Exception $e) {
die($e->getMessage());
}
}
public function getConnector()
{
return $this->connector;
}
public function getPrinter()
{
return $this->printer;
}
public function sendHeaderPrint($title)
{
if (strlen($title)) {
$this->printer->setDoubleStrike(true);
$this->printer->setJustification(Printer::JUSTIFY_CENTER);
$this->printer->setEmphasis(true);
$this->printer->text($title . "\n\n");
$this->printer->setEmphasis(false);
$this->printer->setJustification(Printer::JUSTIFY_LEFT);
$this->printer->setDoubleStrike(false);
}
}
public function sendImagePrint($image, $imageLocal = true, $icon = true)
{
if ($image) {
if ($imageLocal) {
if ($icon) {
$img = EscposImage::load($this->imageDirectory . basename($image) . '.png');
} else {
$img = EscposImage::load($image);
}
} else { //image not local so then remote image
$extension = strtolower(pathinfo($image, PATHINFO_EXTENSION));
$tmpFile = storage_path() . '/image_packt.' . $extension;
file_put_contents($tmpFile, file_get_contents($image));
$img = EscposImage::load($tmpFile);
}
$this->printer->setJustification(Printer::JUSTIFY_CENTER);
$this->printer->bitImageColumnFormat($img);
$this->printer->feed(2);
$this->printer->setJustification(Printer::JUSTIFY_LEFT);
}
}
public function saveToHistory($title, $text, $textSource, $image)
{
DB::table('history')
->insertGetId([
'topic' => $title,
'topic_slug' => str_slug($title, '_'),
'text' => $text,
'text_source' => $textSource,
'icon' => $image,
'created_at' => time(),
'updated_at' => time()
]);
}
public function sendPrint($title, $text = '', $image = false, $imageLocal = true)
{
$this->sendImagePrint($image, $imageLocal);
$this->sendHeaderPrint($title);
$htmlToPos = new HtmlToPos();
$convertedData = $htmlToPos->convert($text);
//zapisuje do pamięci dane o drukowanej notatce, jesli obrazek nie jest ikoną to nie zapisuje go
$this->saveToHistory($title, $convertedData, $text, $imageLocal ? $image : '');
if (is_array($convertedData)) {
$this->printer->text($convertedData['text']);
} else {
$this->printer->text($htmlToPos->convert($text));
}
$this->printer->feed(3);
}
/**
*
* pobieranie ikon z bazy w kolejności ilości użyć, ikon z dysku a następnie
* usunięcie pozdbioru ikon z bazy ze wszystkich ikon a następnie dodanie
* ich na początek listy ikon
*
* @return array
*/
public function getIcons()
{
$icons = ["address-card-o", "anchor", "archive-3", "at", "balance-scale", "ban", "bar-chart-o", "barcode", "battery-empty", "battery-full", "battery-half", "battery-quarter", "battery-three-quarters", "bed", "beer", "bell-o", "bell-slash-o", "bicycle", "birthday-cake", "bolt", "bomb", "book", "bug", "building-o", "bullhorn", "bus", "camera", "car", "chain", "chat-2", "check", "cloud", "code", "coffee", "cog", "cutlery", "dashboard", "database", "diamond", "dollar", "dribbble", "envelope-o", "envira", "exclamation-triangle", "female", "file-text-o", "film", "fingerprint", "fire-extinguisher", "fire", "flag-o", "flask", "floppy-o", "folder-o", "folder-open-o", "frown-o", "gamepad", "gift", "git", "glass", "graduation-cap", "grav", "group", "hand-o-left", "heart-o", "home", "lemon-o", "lightbulb-o", "list-alt", "location-arrow", "lock", "male", "map-1", "map-marker", "microchip", "money", "moon-o", "music", "paper-plane", "paperclip", "paw", "pencil", "phone", "pie-chart", "piggy-bank", "plane", "question-circle-o", "rocket", "search", "ship", "shopping-cart", "smile-o", "snowflake-o", "steam", "subway", "success", "support", "thermometer-2", "thumbs-o-down", "thumbs-o-up", "ticket", "times", "trash-o", "tree", "trophy", "truck", "umbrella", "usd", "warning", "wifi", "wpexplorer", "wrench", "youtube-play"];
$iconsDatabase = [];
$iconsDb = DB::select('SELECT icon FROM note WHERE icon is not null group by icon ORDER BY count(icon) DESC ');
foreach ($iconsDb as $icon) {
$iconsDatabase[] = pathinfo(basename($icon->icon), PATHINFO_FILENAME);
}
return (array_merge($iconsDatabase, array_diff($icons, $iconsDatabase)));
}
public function __destruct()
{
$this->printer->close();
}
}

108
app/Paper/Traficar.php Normal file
View File

@@ -0,0 +1,108 @@
<?php
/**
* Created by PhpStorm.
* User: k
* Date: 30.06.2018
* Time: 18:29
*/
namespace App\Paper;
class Traficar
{
private $homeCoords = ['lat' => 54.417475, 'lng' => 18.481913];
private $traficarJson;
//dystans w kilometrach w którym auta brane są pod uwagę
const CLOSEST_DISTANCE = 2.5;
/**
* @param $lat1
* @param $lon1
* @param $lat2
* @param $lon2
* @return float zwracana jest odległość w kilometrach
*/
private function distance($lat1, $lon1, $lat2, $lon2)
{
$theta = $lon1 - $lon2;
$dist = sin(deg2rad($lat1)) * sin(deg2rad($lat2)) + cos(deg2rad($lat1)) * cos(deg2rad($lat2)) * cos(deg2rad($theta));
$dist = acos($dist);
$dist = rad2deg($dist);
$miles = $dist * 60 * 1.1515;
return ($miles * 1.609344);
}
/**
* pobiera informacje o najbliższym trafficarze względem punktu podanego jako domowy i zwraca Sformatowane
* informacje na jego temat lub jesli nie ma auta to podaje informację że nie ma dostępnego.
*
* @return string
*/
public function nearestCarText()
{
$info = $this->nearestCarInfo();
$formatedInfo = 'Brak aut w promieniu ' . self::CLOSEST_DISTANCE . 'km od domu.';
if ($info['car'] != []) {
$formatedInfo = "Najbliższy traficar:\n" .
'Model: ' . $info['car']['model'] . "\n" .
'Numer boczny: ' . $info['car']['orderNumber'] . "\n" .
'Rejestracja: ' . $info['car']['regNumber'] . "\n" .
'Lokalizacja: ' . $info['car']['location'] . "\n" .
'Odległość: ' . $info['distance'] . "km\n\n" .
'Traficarów w promieniu ' . self::CLOSEST_DISTANCE . 'km: ' . $this->getTotalCarsInArea() . "\n";
}
return $formatedInfo;
}
/**
* pobiera informacje na temat aut traficatowych i zapisuje do pamięci
* @return mixed
*/
private function getTraficarJson()
{
if (is_null($this->traficarJson)) {
$this->traficarJson = json_decode(file_get_contents('https://api.traficar.pl/eaw-rest-api/car?shapeId=5'), 1);
}
return $this->traficarJson;
}
/**
* zwraca ilość aut w podanym promieniu
* @return int
*/
private function getTotalCarsInArea()
{
$trafcarData = $this->getTraficarJson();
$numberOfCarsInArea = 0;
foreach ($trafcarData['cars'] as $car) {
$distance = $this->distance($this->homeCoords['lat'], $this->homeCoords['lng'], $car['latitude'], $car['longitude']);
if ($distance < self::CLOSEST_DISTANCE) {
$numberOfCarsInArea++;
}
}
return $numberOfCarsInArea;
}
public function nearestCarInfo()
{
$trafcarData = $this->getTraficarJson();
$closestCar = [];
$closestDistance = 1000;
foreach ($trafcarData['cars'] as $car) {
$distance = $this->distance($this->homeCoords['lat'], $this->homeCoords['lng'], $car['latitude'], $car['longitude']);
if ($distance < self::CLOSEST_DISTANCE && $distance < $closestDistance) {
$closestDistance = $distance;
$closestCar = $car;
}
}
return ['car' => $closestCar, 'distance' => round($closestDistance, 2),];
}
}

88
app/Paper/Vocabulary.php Normal file
View File

@@ -0,0 +1,88 @@
<?php
namespace App\Paper;
use DiDom\Document;
use DiDom\Query;
class Vocabulary
{
const URL = 'https://www.vocabulary.com/';
const EXAMPLES_URL = 'https://corpus.vocabulary.com/api/1.0/';
public function getWordData($word)
{
return new Document($this->getWordUrl($word), true);
}
private function getWordUrl($word)
{
$word = trim($word);
return self::URL . 'dictionary/definition.ajax?search=' . $word . '&lang=en';
}
private function getWordExamplesUrl($word, $maxResult = 10, $offset = 0)
{
$word = trim($word);
return sprintf('%sexamples.json?query=%s&maxResults=%d&startOffset=%d', self::EXAMPLES_URL, $word, $maxResult, $offset);
}
public function getWord($word)
{
$document = $this->getWordData($word);
$wordData = new \stdClass();
$wordPageSelector = $document->first('.wordPage');
$wordData->lang = $wordPageSelector->attr('data-lang');
$wordData->word = $wordPageSelector->attr('data-word');
$wordData->next = $wordPageSelector->attr('data-next');
$wordData->prev = $wordPageSelector->attr('data-prev');
$wordData->short = trim($document->first('p.short')->text());
$wordData->long = trim($document->first('p.long')->text());
$wordData->instances = [];
foreach ($document->find('.ordinal ') as $ordinal) {
$definition = [];
$definition['type'] = $ordinal->first('h3')->first('a')->attr('title');
$definition['definition'] = trim($ordinal->first('//h3[@class="definition"][1]/text()[2]', Query::TYPE_XPATH));
$definition['example'] = ($example = $ordinal->first('//div[@class="example"]', Query::TYPE_XPATH)) ? $example->text() : '';
foreach ($ordinal->find('.instances') as $instance) {
$in = [];
$in['type'] = str_replace(' ', '_', trim(strtolower($instance->first('dt::text()')), ': '));
$in['words'] = $instance->find('dd a::text()');
$in['definition'] = $instance->first('div.definition::text()');
$definition[$in['type']] = $in;
}
$wordData->instances[] = $definition;
}
$wordData->examples = $this->getExamples($word, 3);
return $wordData;
}
private function getRandomWordUrl()
{
return self::URL . 'randomword.json';
}
public function getRandomWord()
{
$data = json_decode(file_get_contents($this->getRandomWordUrl()));
if ($data->status != 0) {
throw new Exception('error');
}
return $data->result->word;
}
public function getExamples($word, $maxResult = 10, $offset = 0)
{
return json_decode(file_get_contents($this->getWordExamplesUrl($word, $maxResult, $offset)), 1);
}
}

View File

@@ -0,0 +1,28 @@
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
//
}
/**
* Register any application services.
*
* @return void
*/
public function register()
{
//
}
}

View 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();
//
}
}

View 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');
}
}

View 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\SomeEvent' => [
'App\Listeners\EventListener',
],
];
/**
* Register any events for your application.
*
* @return void
*/
public function boot()
{
parent::boot();
//
}
}

View 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'));
}
}

29
app/User.php Executable file
View File

@@ -0,0 +1,29 @@
<?php
namespace App;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
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',
];
}

51
artisan Executable file
View File

@@ -0,0 +1,51 @@
#!/usr/bin/env php
<?php
/*
|--------------------------------------------------------------------------
| Register The Auto Loader
|--------------------------------------------------------------------------
|
| Composer provides a convenient, automatically generated class loader
| for our application. We just need to utilize it! We'll require it
| into the script here so that we do not have to worry about the
| loading of any our classes "manually". Feels great to relax.
|
*/
require __DIR__.'/bootstrap/autoload.php';
$app = require_once __DIR__.'/bootstrap/app.php';
/*
|--------------------------------------------------------------------------
| Run The Artisan Application
|--------------------------------------------------------------------------
|
| When we run the console application, the current CLI command will be
| executed in this console and the response sent back to a terminal
| or another output device for the developers. Here goes nothing!
|
*/
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
$status = $kernel->handle(
$input = new Symfony\Component\Console\Input\ArgvInput,
new Symfony\Component\Console\Output\ConsoleOutput
);
/*
|--------------------------------------------------------------------------
| Shutdown The Application
|--------------------------------------------------------------------------
|
| Once Artisan has finished running. We will fire off the shutdown events
| so that any final work may be done by the application before we shut
| down the process. This is the last thing to happen to the request.
|
*/
$kernel->terminate($input, $status);
exit($status);

55
bootstrap/app.php Executable file
View File

@@ -0,0 +1,55 @@
<?php
/*
|--------------------------------------------------------------------------
| Create The Application
|--------------------------------------------------------------------------
|
| The first thing we will do is create a new Laravel application instance
| which serves as the "glue" for all the components of Laravel, and is
| the IoC container for the system binding all of the various parts.
|
*/
$app = new Illuminate\Foundation\Application(
realpath(__DIR__.'/../')
);
/*
|--------------------------------------------------------------------------
| Bind Important Interfaces
|--------------------------------------------------------------------------
|
| Next, we need to bind some important interfaces into the container so
| we will be able to resolve them when needed. The kernels serve the
| incoming requests to this application from both the web and CLI.
|
*/
$app->singleton(
Illuminate\Contracts\Http\Kernel::class,
App\Http\Kernel::class
);
$app->singleton(
Illuminate\Contracts\Console\Kernel::class,
App\Console\Kernel::class
);
$app->singleton(
Illuminate\Contracts\Debug\ExceptionHandler::class,
App\Exceptions\Handler::class
);
/*
|--------------------------------------------------------------------------
| Return The Application
|--------------------------------------------------------------------------
|
| This script returns the application instance. The instance is given to
| the calling script so we can separate the building of the instances
| from the actual running of the application and sending responses.
|
*/
return $app;

17
bootstrap/autoload.php Executable file
View File

@@ -0,0 +1,17 @@
<?php
define('LARAVEL_START', microtime(true));
/*
|--------------------------------------------------------------------------
| Register The Composer Auto Loader
|--------------------------------------------------------------------------
|
| Composer provides a convenient, automatically generated class loader
| for our application. We just need to utilize it! We'll require it
| into the script here so that we do not have to worry about the
| loading of any our classes "manually". Feels great to relax.
|
*/
require __DIR__.'/../vendor/autoload.php';

2
bootstrap/cache/.gitignore vendored Executable file
View File

@@ -0,0 +1,2 @@
*
!.gitignore

53
composer.json Executable file
View File

@@ -0,0 +1,53 @@
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=7.0.0",
"imangazaliev/didom": "^1.9",
"intervention/image": "^2.3",
"laravel/framework": "5.4.*",
"laravel/tinker": "~1.0",
"mike42/escpos-php": "^1.5"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~5.7"
},
"autoload": {
"classmap": [
"database"
],
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"scripts": {
"post-root-package-install": [
"php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"php artisan key:generate"
],
"post-install-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postInstall",
"php artisan optimize"
],
"post-update-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postUpdate",
"php artisan optimize"
]
},
"config": {
"preferred-install": "dist",
"sort-packages": true
}
}

3698
composer.lock generated Executable file

File diff suppressed because it is too large Load Diff

231
config/app.php Executable file
View File

@@ -0,0 +1,231 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Application Name
|--------------------------------------------------------------------------
|
| This value is the name of your application. This value is used when the
| framework needs to place the application's name in a notification or
| any other location as required by the application or its packages.
*/
'name' => 'Paper.Pi',
/*
|--------------------------------------------------------------------------
| Application Environment
|--------------------------------------------------------------------------
|
| This value determines the "environment" your application is currently
| running in. This may determine how you prefer to configure various
| services your application utilizes. Set this in your ".env" file.
|
*/
'env' => env('APP_ENV', 'production'),
/*
|--------------------------------------------------------------------------
| Application Debug Mode
|--------------------------------------------------------------------------
|
| When your application is in debug mode, detailed error messages with
| stack traces will be shown on every error that occurs within your
| application. If disabled, a simple generic error page is shown.
|
*/
'debug' => env('APP_DEBUG', true),
/*
|--------------------------------------------------------------------------
| Application URL
|--------------------------------------------------------------------------
|
| This URL is used by the console to properly generate URLs when using
| the Artisan command line tool. You should set this to the root of
| your application so that it is used when running Artisan tasks.
|
*/
'url' => env('APP_URL', 'https://paper.pi.techtube.pl'),
/*
|--------------------------------------------------------------------------
| Application Timezone
|--------------------------------------------------------------------------
|
| Here you may specify the default timezone for your application, which
| will be used by the PHP date and date-time functions. We have gone
| ahead and set this to a sensible default for you out of the box.
|
*/
'timezone' => 'Europe/Warsaw',
/*
|--------------------------------------------------------------------------
| Application Locale Configuration
|--------------------------------------------------------------------------
|
| The application locale determines the default locale that will be used
| by the translation service provider. You are free to set this value
| to any of the locales which will be supported by the application.
|
*/
'locale' => 'en',
/*
|--------------------------------------------------------------------------
| Application Fallback Locale
|--------------------------------------------------------------------------
|
| The fallback locale determines the locale to use when the current one
| is not available. You may change the value to correspond to any of
| the language folders that are provided through your application.
|
*/
'fallback_locale' => 'en',
/*
|--------------------------------------------------------------------------
| Encryption Key
|--------------------------------------------------------------------------
|
| This key is used by the Illuminate encrypter service and should be set
| to a random, 32 character string, otherwise these encrypted strings
| will not be safe. Please do this before deploying an application!
|
*/
'key' => env('APP_KEY'),
'cipher' => 'AES-256-CBC',
/*
|--------------------------------------------------------------------------
| Logging Configuration
|--------------------------------------------------------------------------
|
| Here you may configure the log settings for your application. Out of
| the box, Laravel uses the Monolog PHP logging library. This gives
| you a variety of powerful log handlers / formatters to utilize.
|
| Available Settings: "single", "daily", "syslog", "errorlog"
|
*/
'log' => env('APP_LOG', 'single'),
'log_level' => env('APP_LOG_LEVEL', 'debug'),
/*
|--------------------------------------------------------------------------
| Autoloaded Service Providers
|--------------------------------------------------------------------------
|
| The service providers listed here will be automatically loaded on the
| request to your application. Feel free to add your own services to
| this array to grant expanded functionality to your applications.
|
*/
'providers' => [
/*
* Laravel Framework Service Providers...
*/
Illuminate\Auth\AuthServiceProvider::class,
Illuminate\Broadcasting\BroadcastServiceProvider::class,
Illuminate\Bus\BusServiceProvider::class,
Illuminate\Cache\CacheServiceProvider::class,
Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class,
Illuminate\Cookie\CookieServiceProvider::class,
Illuminate\Database\DatabaseServiceProvider::class,
Illuminate\Encryption\EncryptionServiceProvider::class,
Illuminate\Filesystem\FilesystemServiceProvider::class,
Illuminate\Foundation\Providers\FoundationServiceProvider::class,
Illuminate\Hashing\HashServiceProvider::class,
Illuminate\Mail\MailServiceProvider::class,
Illuminate\Notifications\NotificationServiceProvider::class,
Illuminate\Pagination\PaginationServiceProvider::class,
Illuminate\Pipeline\PipelineServiceProvider::class,
Illuminate\Queue\QueueServiceProvider::class,
Illuminate\Redis\RedisServiceProvider::class,
Illuminate\Auth\Passwords\PasswordResetServiceProvider::class,
Illuminate\Session\SessionServiceProvider::class,
Illuminate\Translation\TranslationServiceProvider::class,
Illuminate\Validation\ValidationServiceProvider::class,
Illuminate\View\ViewServiceProvider::class,
/*
* Package Service Providers...
*/
Laravel\Tinker\TinkerServiceProvider::class,
/*
* Application Service Providers...
*/
App\Providers\AppServiceProvider::class,
App\Providers\AuthServiceProvider::class,
// App\Providers\BroadcastServiceProvider::class,
App\Providers\EventServiceProvider::class,
App\Providers\RouteServiceProvider::class,
],
/*
|--------------------------------------------------------------------------
| Class Aliases
|--------------------------------------------------------------------------
|
| This array of class aliases will be registered when this application
| is started. However, feel free to register as many as you wish as
| the aliases are "lazy" loaded so they don't hinder performance.
|
*/
'aliases' => [
'App' => Illuminate\Support\Facades\App::class,
'Artisan' => Illuminate\Support\Facades\Artisan::class,
'Auth' => Illuminate\Support\Facades\Auth::class,
'Blade' => Illuminate\Support\Facades\Blade::class,
'Broadcast' => Illuminate\Support\Facades\Broadcast::class,
'Bus' => Illuminate\Support\Facades\Bus::class,
'Cache' => Illuminate\Support\Facades\Cache::class,
'Config' => Illuminate\Support\Facades\Config::class,
'Cookie' => Illuminate\Support\Facades\Cookie::class,
'Crypt' => Illuminate\Support\Facades\Crypt::class,
'DB' => Illuminate\Support\Facades\DB::class,
'Eloquent' => Illuminate\Database\Eloquent\Model::class,
'Event' => Illuminate\Support\Facades\Event::class,
'File' => Illuminate\Support\Facades\File::class,
'Gate' => Illuminate\Support\Facades\Gate::class,
'Hash' => Illuminate\Support\Facades\Hash::class,
'Lang' => Illuminate\Support\Facades\Lang::class,
'Log' => Illuminate\Support\Facades\Log::class,
'Mail' => Illuminate\Support\Facades\Mail::class,
'Notification' => Illuminate\Support\Facades\Notification::class,
'Password' => Illuminate\Support\Facades\Password::class,
'Queue' => Illuminate\Support\Facades\Queue::class,
'Redirect' => Illuminate\Support\Facades\Redirect::class,
'Redis' => Illuminate\Support\Facades\Redis::class,
'Request' => Illuminate\Support\Facades\Request::class,
'Response' => Illuminate\Support\Facades\Response::class,
'Route' => Illuminate\Support\Facades\Route::class,
'Schema' => Illuminate\Support\Facades\Schema::class,
'Session' => Illuminate\Support\Facades\Session::class,
'Storage' => Illuminate\Support\Facades\Storage::class,
'URL' => Illuminate\Support\Facades\URL::class,
'Validator' => Illuminate\Support\Facades\Validator::class,
'View' => Illuminate\Support\Facades\View::class,
],
];

102
config/auth.php Executable file
View File

@@ -0,0 +1,102 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Authentication Defaults
|--------------------------------------------------------------------------
|
| This option controls the default authentication "guard" and password
| reset options for your application. You may change these defaults
| as required, but they're a perfect start for most applications.
|
*/
'defaults' => [
'guard' => 'web',
'passwords' => 'users',
],
/*
|--------------------------------------------------------------------------
| Authentication Guards
|--------------------------------------------------------------------------
|
| Next, you may define every authentication guard for your application.
| Of course, a great default configuration has been defined for you
| here which uses session storage and the Eloquent user provider.
|
| All authentication drivers have a user provider. This defines how the
| users are actually retrieved out of your database or other storage
| mechanisms used by this application to persist your user's data.
|
| Supported: "session", "token"
|
*/
'guards' => [
'web' => [
'driver' => 'session',
'provider' => 'users',
],
'api' => [
'driver' => 'token',
'provider' => 'users',
],
],
/*
|--------------------------------------------------------------------------
| User Providers
|--------------------------------------------------------------------------
|
| All authentication drivers have a user provider. This defines how the
| users are actually retrieved out of your database or other storage
| mechanisms used by this application to persist your user's data.
|
| If you have multiple user tables or models you may configure multiple
| sources which represent each model / table. These sources may then
| be assigned to any extra authentication guards you have defined.
|
| Supported: "database", "eloquent"
|
*/
'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => App\User::class,
],
// 'users' => [
// 'driver' => 'database',
// 'table' => 'users',
// ],
],
/*
|--------------------------------------------------------------------------
| Resetting Passwords
|--------------------------------------------------------------------------
|
| You may specify multiple password reset configurations if you have more
| than one user table or model in the application and you want to have
| separate password reset settings based on the specific user types.
|
| The expire time is the number of minutes that the reset token should be
| considered valid. This security feature keeps tokens short-lived so
| they have less time to be guessed. You may change this as needed.
|
*/
'passwords' => [
'users' => [
'provider' => 'users',
'table' => 'password_resets',
'expire' => 60,
],
],
];

58
config/broadcasting.php Executable file
View File

@@ -0,0 +1,58 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Broadcaster
|--------------------------------------------------------------------------
|
| This option controls the default broadcaster that will be used by the
| framework when an event needs to be broadcast. You may set this to
| any of the connections defined in the "connections" array below.
|
| Supported: "pusher", "redis", "log", "null"
|
*/
'default' => env('BROADCAST_DRIVER', 'null'),
/*
|--------------------------------------------------------------------------
| Broadcast Connections
|--------------------------------------------------------------------------
|
| Here you may define all of the broadcast connections that will be used
| to broadcast events to other systems or over websockets. Samples of
| each available type of connection are provided inside this array.
|
*/
'connections' => [
'pusher' => [
'driver' => 'pusher',
'key' => env('PUSHER_APP_KEY'),
'secret' => env('PUSHER_APP_SECRET'),
'app_id' => env('PUSHER_APP_ID'),
'options' => [
//
],
],
'redis' => [
'driver' => 'redis',
'connection' => 'default',
],
'log' => [
'driver' => 'log',
],
'null' => [
'driver' => 'null',
],
],
];

91
config/cache.php Executable file
View File

@@ -0,0 +1,91 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Cache Store
|--------------------------------------------------------------------------
|
| This option controls the default cache connection that gets used while
| using this caching library. This connection is used when another is
| not explicitly specified when executing a given caching function.
|
| Supported: "apc", "array", "database", "file", "memcached", "redis"
|
*/
'default' => env('CACHE_DRIVER', 'file'),
/*
|--------------------------------------------------------------------------
| Cache Stores
|--------------------------------------------------------------------------
|
| Here you may define all of the cache "stores" for your application as
| well as their drivers. You may even define multiple stores for the
| same cache driver to group types of items stored in your caches.
|
*/
'stores' => [
'apc' => [
'driver' => 'apc',
],
'array' => [
'driver' => 'array',
],
'database' => [
'driver' => 'database',
'table' => 'cache',
'connection' => null,
],
'file' => [
'driver' => 'file',
'path' => storage_path('framework/cache/data'),
],
'memcached' => [
'driver' => 'memcached',
'persistent_id' => env('MEMCACHED_PERSISTENT_ID'),
'sasl' => [
env('MEMCACHED_USERNAME'),
env('MEMCACHED_PASSWORD'),
],
'options' => [
// Memcached::OPT_CONNECT_TIMEOUT => 2000,
],
'servers' => [
[
'host' => env('MEMCACHED_HOST', '127.0.0.1'),
'port' => env('MEMCACHED_PORT', 11211),
'weight' => 100,
],
],
],
'redis' => [
'driver' => 'redis',
'connection' => 'default',
],
],
/*
|--------------------------------------------------------------------------
| Cache Key Prefix
|--------------------------------------------------------------------------
|
| When utilizing a RAM based store such as APC or Memcached, there might
| be other applications utilizing the same cache. So, we'll specify a
| value to get prefixed to all our keys so we can avoid collisions.
|
*/
'prefix' => 'laravel',
];

108
config/database.php Executable file
View File

@@ -0,0 +1,108 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Database Connection Name
|--------------------------------------------------------------------------
|
| Here you may specify which of the database connections below you wish
| to use as your default connection for all database work. Of course
| you may use many connections at once using the Database library.
|
*/
'default' => env('DB_CONNECTION', 'mysql'),
/*
|--------------------------------------------------------------------------
| Database Connections
|--------------------------------------------------------------------------
|
| Here are each of the database connections setup for your application.
| Of course, examples of configuring each database platform that is
| supported by Laravel is shown below to make development simple.
|
|
| All database work in Laravel is done through the PHP PDO facilities
| so make sure you have the driver for your particular database of
| choice installed on your machine before you begin development.
|
*/
'connections' => [
'sqlite' => [
'driver' => 'sqlite',
'database' => database_path(env('DB_DATABASE','database.sqlite')),
'prefix' => '',
],
'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
'strict' => true,
'engine' => null,
],
'pgsql' => [
'driver' => 'pgsql',
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '5432'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'prefix' => '',
'schema' => 'public',
'sslmode' => 'prefer',
],
],
/*
|--------------------------------------------------------------------------
| Migration Repository Table
|--------------------------------------------------------------------------
|
| This table keeps track of all the migrations that have already run for
| your application. Using this information, we can determine which of
| the migrations on disk haven't actually been run in the database.
|
*/
'migrations' => 'migrations',
/*
|--------------------------------------------------------------------------
| Redis Databases
|--------------------------------------------------------------------------
|
| Redis is an open source, fast, and advanced key-value store that also
| provides a richer set of commands than a typical key-value systems
| such as APC or Memcached. Laravel makes it easy to dig right in.
|
*/
'redis' => [
'client' => 'predis',
'default' => [
'host' => env('REDIS_HOST', '127.0.0.1'),
'password' => env('REDIS_PASSWORD', null),
'port' => env('REDIS_PORT', 6379),
'database' => 0,
],
],
];

68
config/filesystems.php Executable file
View File

@@ -0,0 +1,68 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Filesystem Disk
|--------------------------------------------------------------------------
|
| Here you may specify the default filesystem disk that should be used
| by the framework. The "local" disk, as well as a variety of cloud
| based disks are available to your application. Just store away!
|
*/
'default' => 'local',
/*
|--------------------------------------------------------------------------
| Default Cloud Filesystem Disk
|--------------------------------------------------------------------------
|
| Many applications store files both locally and in the cloud. For this
| reason, you may specify a default "cloud" driver here. This driver
| will be bound as the Cloud disk implementation in the container.
|
*/
'cloud' => 's3',
/*
|--------------------------------------------------------------------------
| Filesystem Disks
|--------------------------------------------------------------------------
|
| Here you may configure as many filesystem "disks" as you wish, and you
| may even configure multiple disks of the same driver. Defaults have
| been setup for each driver as an example of the required options.
|
| Supported Drivers: "local", "ftp", "s3", "rackspace"
|
*/
'disks' => [
'local' => [
'driver' => 'local',
'root' => storage_path('app'),
],
'public' => [
'driver' => 'local',
'root' => storage_path('app/public'),
'url' => env('APP_URL').'/storage',
'visibility' => 'public',
],
's3' => [
'driver' => 's3',
'key' => env('AWS_KEY'),
'secret' => env('AWS_SECRET'),
'region' => env('AWS_REGION'),
'bucket' => env('AWS_BUCKET'),
],
],
];

123
config/mail.php Executable file
View File

@@ -0,0 +1,123 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Mail Driver
|--------------------------------------------------------------------------
|
| Laravel supports both SMTP and PHP's "mail" function as drivers for the
| sending of e-mail. You may specify which one you're using throughout
| your application here. By default, Laravel is setup for SMTP mail.
|
| Supported: "smtp", "sendmail", "mailgun", "mandrill", "ses",
| "sparkpost", "log", "array"
|
*/
'driver' => env('MAIL_DRIVER', 'smtp'),
/*
|--------------------------------------------------------------------------
| SMTP Host Address
|--------------------------------------------------------------------------
|
| Here you may provide the host address of the SMTP server used by your
| applications. A default option is provided that is compatible with
| the Mailgun mail service which will provide reliable deliveries.
|
*/
'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
/*
|--------------------------------------------------------------------------
| SMTP Host Port
|--------------------------------------------------------------------------
|
| This is the SMTP port used by your application to deliver e-mails to
| users of the application. Like the host we have set this value to
| stay compatible with the Mailgun e-mail application by default.
|
*/
'port' => env('MAIL_PORT', 587),
/*
|--------------------------------------------------------------------------
| Global "From" Address
|--------------------------------------------------------------------------
|
| You may wish for all e-mails sent by your application to be sent from
| the same address. Here, you may specify a name and address that is
| used globally for all e-mails that are sent by your application.
|
*/
'from' => [
'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
'name' => env('MAIL_FROM_NAME', 'Example'),
],
/*
|--------------------------------------------------------------------------
| E-Mail Encryption Protocol
|--------------------------------------------------------------------------
|
| Here you may specify the encryption protocol that should be used when
| the application send e-mail messages. A sensible default using the
| transport layer security protocol should provide great security.
|
*/
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
/*
|--------------------------------------------------------------------------
| SMTP Server Username
|--------------------------------------------------------------------------
|
| If your SMTP server requires a username for authentication, you should
| set it here. This will get used to authenticate with your server on
| connection. You may also set the "password" value below this one.
|
*/
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
/*
|--------------------------------------------------------------------------
| Sendmail System Path
|--------------------------------------------------------------------------
|
| When using the "sendmail" driver to send e-mails, we will need to know
| the path to where Sendmail lives on this server. A default path has
| been provided here, which will work well on most of your systems.
|
*/
'sendmail' => '/usr/sbin/sendmail -bs',
/*
|--------------------------------------------------------------------------
| Markdown Mail Settings
|--------------------------------------------------------------------------
|
| If you are using Markdown based email rendering, you may configure your
| theme and component paths here, allowing you to customize the design
| of the emails. Or, you may simply stick with the Laravel defaults!
|
*/
'markdown' => [
'theme' => 'default',
'paths' => [
resource_path('views/vendor/mail'),
],
],
];

18
config/paper.php Normal file
View File

@@ -0,0 +1,18 @@
<?php
/**
* Created by PhpStorm.
* User: k
* Date: 15.04.2018
* Time: 19:53
*/
return ['airly' =>
[
'api_key' => '8b6d77b2950e4e018b0684912bf7b9ed',
'stations' => ['2210', '2256', '2180'],
'rzeczypospolitej' => 2210,
'grunwaldzka' => 2256,
'sowinskiego' => 2180,
]
];

85
config/queue.php Executable file
View File

@@ -0,0 +1,85 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Queue Driver
|--------------------------------------------------------------------------
|
| Laravel's queue API supports an assortment of back-ends via a single
| API, giving you convenient access to each back-end using the same
| syntax for each one. Here you may set the default queue driver.
|
| Supported: "sync", "database", "beanstalkd", "sqs", "redis", "null"
|
*/
'default' => env('QUEUE_DRIVER', 'sync'),
/*
|--------------------------------------------------------------------------
| Queue Connections
|--------------------------------------------------------------------------
|
| Here you may configure the connection information for each server that
| is used by your application. A default configuration has been added
| for each back-end shipped with Laravel. You are free to add more.
|
*/
'connections' => [
'sync' => [
'driver' => 'sync',
],
'database' => [
'driver' => 'database',
'table' => 'jobs',
'queue' => 'default',
'retry_after' => 90,
],
'beanstalkd' => [
'driver' => 'beanstalkd',
'host' => 'localhost',
'queue' => 'default',
'retry_after' => 90,
],
'sqs' => [
'driver' => 'sqs',
'key' => 'your-public-key',
'secret' => 'your-secret-key',
'prefix' => 'https://sqs.us-east-1.amazonaws.com/your-account-id',
'queue' => 'your-queue-name',
'region' => 'us-east-1',
],
'redis' => [
'driver' => 'redis',
'connection' => 'default',
'queue' => 'default',
'retry_after' => 90,
],
],
/*
|--------------------------------------------------------------------------
| Failed Queue Jobs
|--------------------------------------------------------------------------
|
| These options configure the behavior of failed queue job logging so you
| can control which database and table are used to store the jobs that
| have failed. You may change them to any database / table you wish.
|
*/
'failed' => [
'database' => env('DB_CONNECTION', 'mysql'),
'table' => 'failed_jobs',
],
];

38
config/services.php Executable file
View File

@@ -0,0 +1,38 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Third Party Services
|--------------------------------------------------------------------------
|
| This file is for storing the credentials for third party services such
| as Stripe, Mailgun, SparkPost and others. This file provides a sane
| default location for this type of information, allowing packages
| to have a conventional place to find your various credentials.
|
*/
'mailgun' => [
'domain' => env('MAILGUN_DOMAIN'),
'secret' => env('MAILGUN_SECRET'),
],
'ses' => [
'key' => env('SES_KEY'),
'secret' => env('SES_SECRET'),
'region' => 'us-east-1',
],
'sparkpost' => [
'secret' => env('SPARKPOST_SECRET'),
],
'stripe' => [
'model' => App\User::class,
'key' => env('STRIPE_KEY'),
'secret' => env('STRIPE_SECRET'),
],
];

179
config/session.php Executable file
View File

@@ -0,0 +1,179 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Session Driver
|--------------------------------------------------------------------------
|
| This option controls the default session "driver" that will be used on
| requests. By default, we will use the lightweight native driver but
| you may specify any of the other wonderful drivers provided here.
|
| Supported: "file", "cookie", "database", "apc",
| "memcached", "redis", "array"
|
*/
'driver' => env('SESSION_DRIVER', 'file'),
/*
|--------------------------------------------------------------------------
| Session Lifetime
|--------------------------------------------------------------------------
|
| Here you may specify the number of minutes that you wish the session
| to be allowed to remain idle before it expires. If you want them
| to immediately expire on the browser closing, set that option.
|
*/
'lifetime' => 120,
'expire_on_close' => false,
/*
|--------------------------------------------------------------------------
| Session Encryption
|--------------------------------------------------------------------------
|
| This option allows you to easily specify that all of your session data
| should be encrypted before it is stored. All encryption will be run
| automatically by Laravel and you can use the Session like normal.
|
*/
'encrypt' => false,
/*
|--------------------------------------------------------------------------
| Session File Location
|--------------------------------------------------------------------------
|
| When using the native session driver, we need a location where session
| files may be stored. A default has been set for you but a different
| location may be specified. This is only needed for file sessions.
|
*/
'files' => storage_path('framework/sessions'),
/*
|--------------------------------------------------------------------------
| Session Database Connection
|--------------------------------------------------------------------------
|
| When using the "database" or "redis" session drivers, you may specify a
| connection that should be used to manage these sessions. This should
| correspond to a connection in your database configuration options.
|
*/
'connection' => null,
/*
|--------------------------------------------------------------------------
| Session Database Table
|--------------------------------------------------------------------------
|
| When using the "database" session driver, you may specify the table we
| should use to manage the sessions. Of course, a sensible default is
| provided for you; however, you are free to change this as needed.
|
*/
'table' => 'sessions',
/*
|--------------------------------------------------------------------------
| Session Cache Store
|--------------------------------------------------------------------------
|
| When using the "apc" or "memcached" session drivers, you may specify a
| cache store that should be used for these sessions. This value must
| correspond with one of the application's configured cache stores.
|
*/
'store' => null,
/*
|--------------------------------------------------------------------------
| Session Sweeping Lottery
|--------------------------------------------------------------------------
|
| Some session drivers must manually sweep their storage location to get
| rid of old sessions from storage. Here are the chances that it will
| happen on a given request. By default, the odds are 2 out of 100.
|
*/
'lottery' => [2, 100],
/*
|--------------------------------------------------------------------------
| Session Cookie Name
|--------------------------------------------------------------------------
|
| Here you may change the name of the cookie used to identify a session
| instance by ID. The name specified here will get used every time a
| new session cookie is created by the framework for every driver.
|
*/
'cookie' => 'laravel_session',
/*
|--------------------------------------------------------------------------
| Session Cookie Path
|--------------------------------------------------------------------------
|
| The session cookie path determines the path for which the cookie will
| be regarded as available. Typically, this will be the root path of
| your application but you are free to change this when necessary.
|
*/
'path' => '/',
/*
|--------------------------------------------------------------------------
| Session Cookie Domain
|--------------------------------------------------------------------------
|
| Here you may change the domain of the cookie used to identify a session
| in your application. This will determine which domains the cookie is
| available to in your application. A sensible default has been set.
|
*/
'domain' => env('SESSION_DOMAIN', null),
/*
|--------------------------------------------------------------------------
| HTTPS Only Cookies
|--------------------------------------------------------------------------
|
| By setting this option to true, session cookies will only be sent back
| to the server if the browser has a HTTPS connection. This will keep
| the cookie from being sent to you if it can not be done securely.
|
*/
'secure' => env('SESSION_SECURE_COOKIE', false),
/*
|--------------------------------------------------------------------------
| HTTP Access Only
|--------------------------------------------------------------------------
|
| Setting this value to true will prevent JavaScript from accessing the
| value of the cookie and the cookie will only be accessible through
| the HTTP protocol. You are free to modify this option if needed.
|
*/
'http_only' => true,
];

33
config/view.php Executable file
View File

@@ -0,0 +1,33 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| View Storage Paths
|--------------------------------------------------------------------------
|
| Most templating systems load templates from disk. Here you may specify
| an array of paths that should be checked for your views. Of course
| the usual Laravel view path has already been registered for you.
|
*/
'paths' => [
realpath(base_path('resources/views')),
],
/*
|--------------------------------------------------------------------------
| Compiled View Path
|--------------------------------------------------------------------------
|
| This option determines where all the compiled Blade templates will be
| stored for your application. Typically, this is within the storage
| directory. However, as usual, you are free to change this value.
|
*/
'compiled' => realpath(storage_path('framework/views')),
];

1
database/.gitignore vendored Executable file
View File

@@ -0,0 +1 @@
*.sqlite

View File

@@ -0,0 +1,24 @@
<?php
/*
|--------------------------------------------------------------------------
| Model Factories
|--------------------------------------------------------------------------
|
| Here you may define all of your model factories. Model factories give
| you a convenient way to create models for testing and seeding your
| database. Just tell the factory how a default model should look.
|
*/
/** @var \Illuminate\Database\Eloquent\Factory $factory */
$factory->define(App\User::class, function (Faker\Generator $faker) {
static $password;
return [
'name' => $faker->name,
'email' => $faker->unique()->safeEmail,
'password' => $password ?: $password = bcrypt('secret'),
'remember_token' => str_random(10),
];
});

View File

@@ -0,0 +1,35 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('users', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->string('email')->unique();
$table->string('password');
$table->rememberToken();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('users');
}
}

View File

@@ -0,0 +1,32 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreatePasswordResetsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('password_resets', function (Blueprint $table) {
$table->string('email')->index();
$table->string('token')->index();
$table->timestamp('created_at')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('password_resets');
}
}

BIN
database/printer_example.db Normal file

Binary file not shown.

View File

@@ -0,0 +1,16 @@
<?php
use Illuminate\Database\Seeder;
class DatabaseSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
// $this->call(UsersTableSeeder::class);
}
}

17
package.json Executable file
View File

@@ -0,0 +1,17 @@
{
"private": true,
"scripts": {
"dev": "node node_modules/cross-env/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "node node_modules/cross-env/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"hot": "node node_modules/cross-env/bin/cross-env.js NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
"production": "node node_modules/cross-env/bin/cross-env.js NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
},
"devDependencies": {
"axios": "^0.15.3",
"bootstrap-sass": "^3.3.7",
"jquery": "^3.1.1",
"laravel-mix": "^0.7.2",
"lodash": "^4.17.4",
"vue": "^2.1.10"
}
}

31
phpunit.xml Executable file
View File

@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="bootstrap/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false">
<testsuites>
<testsuite name="Feature Tests">
<directory suffix="Test.php">./tests/Feature</directory>
</testsuite>
<testsuite name="Unit Tests">
<directory suffix="Test.php">./tests/Unit</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./app</directory>
</whitelist>
</filter>
<php>
<env name="APP_ENV" value="testing"/>
<env name="CACHE_DRIVER" value="array"/>
<env name="SESSION_DRIVER" value="array"/>
<env name="QUEUE_DRIVER" value="sync"/>
</php>
</phpunit>

20
public/.htaccess Executable file
View File

@@ -0,0 +1,20 @@
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>

534
public/css/app.css vendored Executable file
View File

@@ -0,0 +1,534 @@
textarea {
font-family: monospace
}
textarea.content {
font-family: monospace;
word-wrap: break-word;
word-break: break-all;
}
#editor {
border: 1px solid rgba(34, 36, 38, .15);
padding: 15px;
font-family: monospace;
word-wrap: break-word;
width: 257px;
word-break: break-all;
white-space: pre-wrap;
box-sizing: content-box;
}
.note-title {
line-height: 32px;
}
h1.header span.icon.display-inline-block {
display: inline-block;
}
form {
margin-bottom: 0;
}
.ui.file.input input[type="file"] {
display: none;
}
.flex {
display: flex;
align-items: center;
}
.flex.space-between {
justify-content: space-between;
}
.flex.header {
margin-bottom: 1rem;
}
.flex .header {
margin-bottom: 0;
}
.icon {
cursor: pointer;
height: 25px;
width: 25px;
display: inline-block;
background: url(/small/iconsmall.png);
margin: 2px;
}
.icons .icon:hover {
background-color: #1e90ff4d;
}
.icon.empty {
height: 25px;
width: 25px;
background-image: none;
}
.icon.selected {
border: 2px solid dodgerblue;
border-radius: 3px;
background-color: #1e90ff4d;
width: 29px;
height: 29px;
margin: 0;
}
.icon.address-card-o {
background-position-x: -0px;
}
.icon.anchor {
background-position-x: -25px;
}
.icon.archive-3 {
background-position-x: -50px;
}
.icon.at {
background-position-x: -75px;
}
.icon.balance-scale {
background-position-x: -100px;
}
.icon.ban {
background-position-x: -125px;
}
.icon.bar-chart-o {
background-position-x: -150px;
}
.icon.barcode {
background-position-x: -175px;
}
.icon.battery-empty {
background-position-x: -200px;
}
.icon.battery-full {
background-position-x: -225px;
}
.icon.battery-half {
background-position-x: -250px;
}
.icon.battery-quarter {
background-position-x: -275px;
}
.icon.battery-three-quarters {
background-position-x: -300px;
}
.icon.bed {
background-position-x: -325px;
}
.icon.beer {
background-position-x: -350px;
}
.icon.bell-o {
background-position-x: -375px;
}
.icon.bell-slash-o {
background-position-x: -400px;
}
.icon.bicycle {
background-position-x: -425px;
}
.icon.birthday-cake {
background-position-x: -450px;
}
.icon.bolt {
background-position-x: -475px;
}
.icon.bomb {
background-position-x: -500px;
}
.icon.book {
background-position-x: -525px;
}
.icon.bug {
background-position-x: -550px;
}
.icon.building-o {
background-position-x: -575px;
}
.icon.bullhorn {
background-position-x: -600px;
}
.icon.bus {
background-position-x: -625px;
}
.icon.camera {
background-position-x: -650px;
}
.icon.car {
background-position-x: -675px;
}
.icon.chain {
background-position-x: -700px;
}
.icon.chat-2 {
background-position-x: -725px;
}
.icon.check {
background-position-x: -750px;
}
.icon.cloud {
background-position-x: -775px;
}
.icon.code {
background-position-x: -800px;
}
.icon.coffee {
background-position-x: -825px;
}
.icon.cog {
background-position-x: -850px;
}
.icon.cutlery {
background-position-x: -875px;
}
.icon.dashboard {
background-position-x: -900px;
}
.icon.database {
background-position-x: -925px;
}
.icon.diamond {
background-position-x: -950px;
}
.icon.dollar {
background-position-x: -975px;
}
.icon.dribbble {
background-position-x: -1000px;
}
.icon.envelope-o {
background-position-x: -1025px;
}
.icon.envira {
background-position-x: -1050px;
}
.icon.exclamation-triangle {
background-position-x: -1075px;
}
.icon.female {
background-position-x: -1100px;
}
.icon.file-text-o {
background-position-x: -1125px;
}
.icon.film {
background-position-x: -1150px;
}
.icon.fingerprint {
background-position-x: -1175px;
}
.icon.fire-extinguisher {
background-position-x: -1200px;
}
.icon.fire {
background-position-x: -1225px;
}
.icon.flag-o {
background-position-x: -1250px;
}
.icon.flask {
background-position-x: -1275px;
}
.icon.floppy-o {
background-position-x: -1300px;
}
.icon.folder-o {
background-position-x: -1325px;
}
.icon.folder-open-o {
background-position-x: -1350px;
}
.icon.frown-o {
background-position-x: -1375px;
}
.icon.gamepad {
background-position-x: -1400px;
}
.icon.gift {
background-position-x: -1425px;
}
.icon.git {
background-position-x: -1450px;
}
.icon.glass {
background-position-x: -1475px;
}
.icon.graduation-cap {
background-position-x: -1500px;
}
.icon.grav {
background-position-x: -1525px;
}
.icon.group {
background-position-x: -1550px;
}
.icon.hand-o-left {
background-position-x: -1575px;
}
.icon.heart-o {
background-position-x: -1600px;
}
.icon.home {
background-position-x: -1625px;
}
.icon.lemon-o {
background-position-x: -1650px;
}
.icon.lightbulb-o {
background-position-x: -1675px;
}
.icon.list-alt {
background-position-x: -1700px;
}
.icon.location-arrow {
background-position-x: -1725px;
}
.icon.lock {
background-position-x: -1750px;
}
.icon.male {
background-position-x: -1775px;
}
.icon.map-1 {
background-position-x: -1800px;
}
.icon.map-marker {
background-position-x: -1825px;
}
.icon.microchip {
background-position-x: -1850px;
}
.icon.money {
background-position-x: -1875px;
}
.icon.moon-o {
background-position-x: -1900px;
}
.icon.music {
background-position-x: -1925px;
}
.icon.paper-plane {
background-position-x: -1950px;
}
.icon.paperclip {
background-position-x: -1975px;
}
.icon.paw {
background-position-x: -2000px;
}
.icon.pencil {
background-position-x: -2025px;
}
.icon.phone {
background-position-x: -2050px;
}
.icon.pie-chart {
background-position-x: -2075px;
}
.icon.piggy-bank {
background-position-x: -2100px;
}
.icon.plane {
background-position-x: -2125px;
}
.icon.question-circle-o {
background-position-x: -2150px;
}
.icon.rocket {
background-position-x: -2175px;
}
.icon.search {
background-position-x: -2200px;
}
.icon.ship {
background-position-x: -2225px;
}
.icon.shopping-cart {
background-position-x: -2250px;
}
.icon.smile-o {
background-position-x: -2275px;
}
.icon.snowflake-o {
background-position-x: -2300px;
}
.icon.steam {
background-position-x: -2325px;
}
.icon.subway {
background-position-x: -2350px;
}
.icon.success {
background-position-x: -2375px;
}
.icon.support {
background-position-x: -2400px;
}
.icon.thermometer-2 {
background-position-x: -2425px;
}
.icon.thumbs-o-down {
background-position-x: -2450px;
}
.icon.thumbs-o-up {
background-position-x: -2475px;
}
.icon.ticket {
background-position-x: -2500px;
}
.icon.times {
background-position-x: -2525px;
}
.icon.trash-o {
background-position-x: -2550px;
}
.icon.tree {
background-position-x: -2575px;
}
.icon.trophy {
background-position-x: -2600px;
}
.icon.truck {
background-position-x: -2625px;
}
.icon.umbrella {
background-position-x: -2650px;
}
.icon.usd {
background-position-x: -2675px;
}
.icon.warning {
background-position-x: -2700px;
}
.icon.wifi {
background-position-x: -2725px;
}
.icon.wpexplorer {
background-position-x: -2750px;
}
.icon.wrench {
background-position-x: -2775px;
}
.icon.youtube-play {
background-position-x: -2800px;
}

364
public/css/semantic.min.css vendored Executable file

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 434 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
public/favicon.ico Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

BIN
public/icons/icon-128.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

BIN
public/icons/icon-16.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 544 B

BIN
public/icons/icon-256.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

BIN
public/icons/icon-32.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
public/icons/icon-512.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

BIN
public/icons/icon-64.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

58
public/index.php Executable file
View File

@@ -0,0 +1,58 @@
<?php
/**
* Laravel - A PHP Framework For Web Artisans
*
* @package Laravel
* @author Taylor Otwell <taylor@laravel.com>
*/
/*
|--------------------------------------------------------------------------
| Register The Auto Loader
|--------------------------------------------------------------------------
|
| Composer provides a convenient, automatically generated class loader for
| our application. We just need to utilize it! We'll simply require it
| into the script here so that we don't have to worry about manual
| loading any of our classes later on. It feels nice to relax.
|
*/
require __DIR__.'/../bootstrap/autoload.php';
/*
|--------------------------------------------------------------------------
| Turn On The Lights
|--------------------------------------------------------------------------
|
| We need to illuminate PHP development, so let us turn on the lights.
| This bootstraps the framework and gets it ready for use, then it
| will load up this application so that we can run it and send
| the responses back to the browser and delight our users.
|
*/
$app = require_once __DIR__.'/../bootstrap/app.php';
/*
|--------------------------------------------------------------------------
| Run The Application
|--------------------------------------------------------------------------
|
| Once we have the application, we can handle the incoming request
| through the kernel, and send the associated response back to
| the client's browser allowing them to enjoy the creative
| and wonderful application we have prepared for them.
|
*/
$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);
$response = $kernel->handle(
$request = Illuminate\Http\Request::capture()
);
$response->send();
$kernel->terminate($request, $response);

73
public/js/printer.js Executable file
View File

@@ -0,0 +1,73 @@
var content, title, preview, selfPrinter;
var Printer = function () {
this.init = function () {
this.reset = document.querySelector('.js-reset');
this.delete = document.querySelector('.js-delete');
content = this.content = document.querySelector('.js-content');
title = this.title = document.querySelector('input[name="title"]');
selfPrinter = this;
this.reset.addEventListener('click', this.clear);
content.addEventListener("mouseup", this.contentResize);
this.restoreContentHeight();
if (this.delete != null) {
this.delete.addEventListener('click', this.confirmDelete);
}
document.querySelectorAll('.icons .icon').forEach(function (e) {
e.addEventListener('click', function () {
selfPrinter.selectIcon(this.title);
});
})
};
/**
* resetuje wybór ikony
*/
this.selectIcon = function (iconTitle) {
document.querySelectorAll('.icon').forEach(function (e, i) {
e.classList.remove('selected');
});
document.querySelector('#icon').value = iconTitle;
var selector = '.icon[title="' + iconTitle + '"]';
document.querySelector(selector).classList.add('selected');
};
this.restoreContentHeight = function () {
if (!!localStorage.getItem('contentHeight')) {
document.querySelector('.js-content').style.height = localStorage.getItem('contentHeight')
}
};
this.contentResize = function () {
localStorage.setItem('contentHeight', this.style.height);
};
this.divToTextbox = function () {
content.value = preview.innerHTML;
};
this.clear = function () {
selfPrinter.title.value = '';
selfPrinter.content.innerHTML = '';
selfPrinter.selectIcon('empty');
};
this.confirmDelete = function (e) {
if (!confirm('Usunąć wpis?')) {
e.preventDefault();
return false;
}
};
};

19
public/js/semantic.min.js vendored Executable file

File diff suppressed because one or more lines are too long

34
public/manifest.json Normal file
View File

@@ -0,0 +1,34 @@
{
"name": "PaperPi",
"short_name": "PaperPi",
"start_url": ".",
"display": "standalone",
"background_color": "#277dd1",
"description": "Raspberry Pi printer webapp",
"orientation": "portrait",
"icons": [{
"src": "/icon-16.png",
"sizes": "16x16",
"type": "image/png"
}, {
"src": "/icon-32.png",
"sizes": "32x32",
"type": "image/png"
}, {
"src": "/icon-64.png",
"sizes": "64x64",
"type": "image/png"
}, {
"src": "/icon-128.png",
"sizes": "128x128",
"type": "image/png"
}, {
"src": "/icon-256.png",
"sizes": "256x256",
"type": "image/png"
}, {
"src": "/icon-512.png",
"sizes": "512x512",
"type": "image/png"
}]
}

2
public/robots.txt Executable file
View File

@@ -0,0 +1,2 @@
User-agent: *
Disallow:

23
public/web.config Executable file
View File

@@ -0,0 +1,23 @@
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Imported Rule 1" stopProcessing="true">
<match url="^(.*)/$" ignoreCase="false" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
</conditions>
<action type="Redirect" redirectType="Permanent" url="/{R:1}" />
</rule>
<rule name="Imported Rule 2" stopProcessing="true">
<match url="^" ignoreCase="false" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
</conditions>
<action type="Rewrite" url="index.php" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>

40
readme.md Normal file
View File

@@ -0,0 +1,40 @@
<p align="center"><img src="https://laravel.com/assets/img/components/logo-laravel.svg"></p>
<p align="center">
<a href="https://travis-ci.org/laravel/framework"><img src="https://travis-ci.org/laravel/framework.svg" alt="Build Status"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://poser.pugx.org/laravel/framework/d/total.svg" alt="Total Downloads"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://poser.pugx.org/laravel/framework/v/stable.svg" alt="Latest Stable Version"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://poser.pugx.org/laravel/framework/license.svg" alt="License"></a>
</p>
## About Laravel
Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable, creative experience to be truly fulfilling. Laravel attempts to take the pain out of development by easing common tasks used in the majority of web projects, such as:
- [Simple, fast routing engine](https://laravel.com/docs/routing).
- [Powerful dependency injection container](https://laravel.com/docs/container).
- Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage.
- Expressive, intuitive [database ORM](https://laravel.com/docs/eloquent).
- Database agnostic [schema migrations](https://laravel.com/docs/migrations).
- [Robust background job processing](https://laravel.com/docs/queues).
- [Real-time event broadcasting](https://laravel.com/docs/broadcasting).
Laravel is accessible, yet powerful, providing tools needed for large, robust applications. A superb combination of simplicity, elegance, and innovation give you tools you need to build any application with which you are tasked.
## Learning Laravel
Laravel has the most extensive and thorough documentation and video tutorial library of any modern web application framework. The [Laravel documentation](https://laravel.com/docs) is thorough, complete, and makes it a breeze to get started learning the framework.
If you're not in the mood to read, [Laracasts](https://laracasts.com) contains over 900 video tutorials on a range of topics including Laravel, modern PHP, unit testing, JavaScript, and more. Boost the skill level of yourself and your entire team by digging into our comprehensive video library.
## Contributing
Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](http://laravel.com/docs/contributions).
## Security Vulnerabilities
If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell at taylor@laravel.com. All security vulnerabilities will be promptly addressed.
## License
The Laravel framework is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT).

20
resources/assets/js/app.js Executable file
View File

@@ -0,0 +1,20 @@
/**
* First we will load all of this project's JavaScript dependencies which
* includes Vue and other libraries. It is a great starting point when
* building robust, powerful web applications using Vue and Laravel.
*/
require('./bootstrap');
/**
* Next, we will create a fresh Vue application instance and attach it to
* the page. Then, you may begin adding components to this application
* or customize the JavaScript scaffolding to fit your unique needs.
*/
Vue.component('example', require('./components/Example.vue'));
const app = new Vue({
el: '#app'
});

46
resources/assets/js/bootstrap.js vendored Executable file
View File

@@ -0,0 +1,46 @@
window._ = require('lodash');
/**
* We'll load jQuery and the Bootstrap jQuery plugin which provides support
* for JavaScript based Bootstrap features such as modals and tabs. This
* code may be modified to fit the specific needs of your application.
*/
window.$ = window.jQuery = require('jquery');
require('bootstrap-sass');
/**
* Vue is a modern JavaScript library for building interactive web interfaces
* using reactive data binding and reusable components. Vue's API is clean
* and simple, leaving you to focus on building your next great project.
*/
window.Vue = require('vue');
/**
* We'll load the axios HTTP library which allows us to easily issue requests
* to our Laravel back-end. This library automatically handles sending the
* CSRF token as a header based on the value of the "XSRF" token cookie.
*/
window.axios = require('axios');
window.axios.defaults.headers.common = {
'X-CSRF-TOKEN': window.Laravel.csrfToken,
'X-Requested-With': 'XMLHttpRequest'
};
/**
* Echo exposes an expressive API for subscribing to channels and listening
* for events that are broadcast by Laravel. Echo and event broadcasting
* allows your team to easily build robust real-time web applications.
*/
// import Echo from "laravel-echo"
// window.Echo = new Echo({
// broadcaster: 'pusher',
// key: 'your-pusher-key'
// });

View File

@@ -0,0 +1,23 @@
<template>
<div class="container">
<div class="row">
<div class="col-md-8 col-md-offset-2">
<div class="panel panel-default">
<div class="panel-heading">Example Component</div>
<div class="panel-body">
I'm an example component!
</div>
</div>
</div>
</div>
</div>
</template>
<script>
export default {
mounted() {
console.log('Component mounted.')
}
}
</script>

38
resources/assets/sass/_variables.scss vendored Executable file
View File

@@ -0,0 +1,38 @@
// Body
$body-bg: #f5f8fa;
// Borders
$laravel-border-color: darken($body-bg, 10%);
$list-group-border: $laravel-border-color;
$navbar-default-border: $laravel-border-color;
$panel-default-border: $laravel-border-color;
$panel-inner-border: $laravel-border-color;
// Brands
$brand-primary: #3097D1;
$brand-info: #8eb4cb;
$brand-success: #2ab27b;
$brand-warning: #cbb956;
$brand-danger: #bf5329;
// Typography
$icon-font-path: "~bootstrap-sass/assets/fonts/bootstrap/";
$font-family-sans-serif: "Raleway", sans-serif;
$font-size-base: 14px;
$line-height-base: 1.6;
$text-color: #636b6f;
// Navbar
$navbar-default-bg: #fff;
// Buttons
$btn-default-color: $text-color;
// Inputs
$input-border: lighten($text-color, 40%);
$input-border-focus: lighten($brand-primary, 25%);
$input-color-placeholder: lighten($text-color, 30%);
// Panels
$panel-default-heading-bg: #fff;

9
resources/assets/sass/app.scss vendored Executable file
View File

@@ -0,0 +1,9 @@
// Fonts
@import url(https://fonts.googleapis.com/css?family=Raleway:300,400,600);
// Variables
@import "variables";
// Bootstrap
@import "node_modules/bootstrap-sass/assets/stylesheets/bootstrap";

19
resources/lang/en/auth.php Executable file
View File

@@ -0,0 +1,19 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Authentication Language Lines
|--------------------------------------------------------------------------
|
| The following language lines are used during authentication for various
| messages that we need to display to the user. You are free to modify
| these language lines according to your application's requirements.
|
*/
'failed' => 'These credentials do not match our records.',
'throttle' => 'Too many login attempts. Please try again in :seconds seconds.',
];

View File

@@ -0,0 +1,19 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Pagination Language Lines
|--------------------------------------------------------------------------
|
| The following language lines are used by the paginator library to build
| the simple pagination links. You are free to change them to anything
| you want to customize your views to better match your application.
|
*/
'previous' => '&laquo; Previous',
'next' => 'Next &raquo;',
];

22
resources/lang/en/passwords.php Executable file
View File

@@ -0,0 +1,22 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Password Reset Language Lines
|--------------------------------------------------------------------------
|
| The following language lines are the default lines which match reasons
| that are given by the password broker for a password update attempt
| has failed, such as for an invalid token or invalid new password.
|
*/
'password' => 'Passwords must be at least six characters and match the confirmation.',
'reset' => 'Your password has been reset!',
'sent' => 'We have e-mailed your password reset link!',
'token' => 'This password reset token is invalid.',
'user' => "We can't find a user with that e-mail address.",
];

119
resources/lang/en/validation.php Executable file
View File

@@ -0,0 +1,119 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Validation Language Lines
|--------------------------------------------------------------------------
|
| The following language lines contain the default error messages used by
| the validator class. Some of these rules have multiple versions such
| as the size rules. Feel free to tweak each of these messages here.
|
*/
'accepted' => 'The :attribute must be accepted.',
'active_url' => 'The :attribute is not a valid URL.',
'after' => 'The :attribute must be a date after :date.',
'after_or_equal' => 'The :attribute must be a date after or equal to :date.',
'alpha' => 'The :attribute may only contain letters.',
'alpha_dash' => 'The :attribute may only contain letters, numbers, and dashes.',
'alpha_num' => 'The :attribute may only contain letters and numbers.',
'array' => 'The :attribute must be an array.',
'before' => 'The :attribute must be a date before :date.',
'before_or_equal' => 'The :attribute must be a date before or equal to :date.',
'between' => [
'numeric' => 'The :attribute must be between :min and :max.',
'file' => 'The :attribute must be between :min and :max kilobytes.',
'string' => 'The :attribute must be between :min and :max characters.',
'array' => 'The :attribute must have between :min and :max items.',
],
'boolean' => 'The :attribute field must be true or false.',
'confirmed' => 'The :attribute confirmation does not match.',
'date' => 'The :attribute is not a valid date.',
'date_format' => 'The :attribute does not match the format :format.',
'different' => 'The :attribute and :other must be different.',
'digits' => 'The :attribute must be :digits digits.',
'digits_between' => 'The :attribute must be between :min and :max digits.',
'dimensions' => 'The :attribute has invalid image dimensions.',
'distinct' => 'The :attribute field has a duplicate value.',
'email' => 'The :attribute must be a valid email address.',
'exists' => 'The selected :attribute is invalid.',
'file' => 'The :attribute must be a file.',
'filled' => 'The :attribute field is required.',
'image' => 'The :attribute must be an image.',
'in' => 'The selected :attribute is invalid.',
'in_array' => 'The :attribute field does not exist in :other.',
'integer' => 'The :attribute must be an integer.',
'ip' => 'The :attribute must be a valid IP address.',
'json' => 'The :attribute must be a valid JSON string.',
'max' => [
'numeric' => 'The :attribute may not be greater than :max.',
'file' => 'The :attribute may not be greater than :max kilobytes.',
'string' => 'The :attribute may not be greater than :max characters.',
'array' => 'The :attribute may not have more than :max items.',
],
'mimes' => 'The :attribute must be a file of type: :values.',
'mimetypes' => 'The :attribute must be a file of type: :values.',
'min' => [
'numeric' => 'The :attribute must be at least :min.',
'file' => 'The :attribute must be at least :min kilobytes.',
'string' => 'The :attribute must be at least :min characters.',
'array' => 'The :attribute must have at least :min items.',
],
'not_in' => 'The selected :attribute is invalid.',
'numeric' => 'The :attribute must be a number.',
'present' => 'The :attribute field must be present.',
'regex' => 'The :attribute format is invalid.',
'required' => 'The :attribute field is required.',
'required_if' => 'The :attribute field is required when :other is :value.',
'required_unless' => 'The :attribute field is required unless :other is in :values.',
'required_with' => 'The :attribute field is required when :values is present.',
'required_with_all' => 'The :attribute field is required when :values is present.',
'required_without' => 'The :attribute field is required when :values is not present.',
'required_without_all' => 'The :attribute field is required when none of :values are present.',
'same' => 'The :attribute and :other must match.',
'size' => [
'numeric' => 'The :attribute must be :size.',
'file' => 'The :attribute must be :size kilobytes.',
'string' => 'The :attribute must be :size characters.',
'array' => 'The :attribute must contain :size items.',
],
'string' => 'The :attribute must be a string.',
'timezone' => 'The :attribute must be a valid zone.',
'unique' => 'The :attribute has already been taken.',
'uploaded' => 'The :attribute failed to upload.',
'url' => 'The :attribute format is invalid.',
/*
|--------------------------------------------------------------------------
| Custom Validation Language Lines
|--------------------------------------------------------------------------
|
| Here you may specify custom validation messages for attributes using the
| convention "attribute.rule" to name the lines. This makes it quick to
| specify a specific custom language line for a given attribute rule.
|
*/
'custom' => [
'attribute-name' => [
'rule-name' => 'custom-message',
],
],
/*
|--------------------------------------------------------------------------
| Custom Validation Attributes
|--------------------------------------------------------------------------
|
| The following language lines are used to swap attribute place-holders
| with something more reader friendly such as E-Mail Address instead
| of "email". This simply helps us make messages a little cleaner.
|
*/
'attributes' => [],
];

Some files were not shown because too many files have changed in this diff Show More