diff --git a/.editorconfig b/.editorconfig
index 6f313c6..21b452d 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -2,8 +2,8 @@ root = true
[*]
charset = utf-8
-end_of_line = lf
insert_final_newline = true
+end_of_line = lf
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
diff --git a/.env.example b/.env.example
index d058c34..9eb6ce2 100644
--- a/.env.example
+++ b/.env.example
@@ -10,8 +10,8 @@ DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=homestead
-DB_USERNAME=homestead
DB_PASSWORD=secret
+DB_USERNAME=homestead
BROADCAST_DRIVER=log
CACHE_DRIVER=file
diff --git a/.gitattributes b/.gitattributes
index 967315d..d674b87 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1,5 +1,5 @@
* text=auto
-*.css linguist-vendored
*.scss linguist-vendored
+*.css linguist-vendored
*.js linguist-vendored
CHANGELOG.md export-ignore
diff --git a/.gitignore b/.gitignore
index fcb16a2..968dd41 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,8 +7,8 @@
.phpunit.result.cache
Homestead.json
Homestead.yaml
-npm-debug.log
yarn-error.log
+npm-debug.log
database.sqlite
*.log
.DS_Store
diff --git a/LICENSE b/LICENSE
index 39fdf03..25d217e 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,6 +1,6 @@
MIT License
-Copyright (c) 2019 Peter Porzuczek
+Copyright (c) 2022 Piotr Porzuczek
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
diff --git a/README.md b/README.md
index aab4af5..4e7f5c2 100644
--- a/README.md
+++ b/README.md
@@ -4,7 +4,12 @@
>
> The aim of the project is to publish the code together with the tasks in a way that is clear and accessible to the student. The ability to disable code publication makes it possible for the student to work on the assignments themselves and when the teacher decides to publish the code, they can do so immediately.
+# Join Our Community
+
+[![Stargazers repo roster for @PeterPorzuczek/TimeRiddle](https://reporoster.com/stars/PeterPorzuczek/TimeRiddle)](https://github.com/PeterPorzuczek/TimeRiddle/stargazers)
+
## Preview
+
### Example course
diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php
index a8c5158..9ffb673 100644
--- a/app/Console/Kernel.php
+++ b/app/Console/Kernel.php
@@ -12,9 +12,7 @@ class Kernel extends ConsoleKernel
*
* @var array
*/
- protected $commands = [
- //
- ];
+ protected $commands = [];
/**
* Define the application's command schedule.
diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php
index 043cad6..b985b6b 100644
--- a/app/Exceptions/Handler.php
+++ b/app/Exceptions/Handler.php
@@ -12,9 +12,7 @@ class Handler extends ExceptionHandler
*
* @var array
*/
- protected $dontReport = [
- //
- ];
+ protected $dontReport = [];
/**
* A list of the inputs that are never flashed for validation exceptions.
diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php
index 7d4c939..3f85c6b 100644
--- a/app/Http/Controllers/Auth/RegisterController.php
+++ b/app/Http/Controllers/Auth/RegisterController.php
@@ -2,7 +2,7 @@
namespace App\Http\Controllers\Auth;
-use App\User;
+use App\Models\User;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Validator;
@@ -59,7 +59,7 @@ protected function validator(array $data)
* Create a new user instance after a valid registration.
*
* @param array $data
- * @return \App\User
+ * @return \App\Models\User
*/
protected function create(array $data)
{
diff --git a/app/Http/Controllers/CourseController.php b/app/Http/Controllers/CourseController.php
index c4dc1e9..7db905d 100644
--- a/app/Http/Controllers/CourseController.php
+++ b/app/Http/Controllers/CourseController.php
@@ -5,8 +5,8 @@
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
-use App\User;
-use App\Course;
+use App\Models\User;
+use App\Models\Course;
class CourseController extends Controller
{
diff --git a/app/Http/Controllers/LearnController.php b/app/Http/Controllers/LearnController.php
index 86f54d0..7434416 100644
--- a/app/Http/Controllers/LearnController.php
+++ b/app/Http/Controllers/LearnController.php
@@ -5,9 +5,9 @@
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
-use App\Course;
-use App\Problem;
-use App\Solution;
+use App\Models\Course;
+use App\Models\Problem;
+use App\Models\Solution;
class LearnController extends Controller
{
diff --git a/app/Http/Controllers/ProblemController.php b/app/Http/Controllers/ProblemController.php
index 75bd535..7bbc19e 100644
--- a/app/Http/Controllers/ProblemController.php
+++ b/app/Http/Controllers/ProblemController.php
@@ -6,8 +6,8 @@
use Illuminate\Http\Request;
use GrahamCampbell\Markdown\Facades\Markdown;
-use App\User;
-use App\Problem;
+use App\Models\User;
+use App\Models\Problem;
class ProblemController extends Controller
{
diff --git a/app/Http/Controllers/QuestController.php b/app/Http/Controllers/QuestController.php
index 6893395..8fa239f 100644
--- a/app/Http/Controllers/QuestController.php
+++ b/app/Http/Controllers/QuestController.php
@@ -6,8 +6,8 @@
use Illuminate\Http\Request;
use GrahamCampbell\Markdown\Facades\Markdown;
-use App\User;
-use App\Quest;
+use App\Models\User;
+use App\Models\Quest;
class QuestController extends Controller
{
diff --git a/app/Http/Controllers/SolutionController.php b/app/Http/Controllers/SolutionController.php
index e040497..fa9364e 100644
--- a/app/Http/Controllers/SolutionController.php
+++ b/app/Http/Controllers/SolutionController.php
@@ -6,8 +6,8 @@
use Illuminate\Http\Request;
use GrahamCampbell\Markdown\Facades\Markdown;
-use App\User;
-use App\Solution;
+use App\Models\User;
+use App\Models\Solution;
class SolutionController extends Controller
{
diff --git a/app/Http/Controllers/TopicController.php b/app/Http/Controllers/TopicController.php
index f48c6a4..aff1052 100644
--- a/app/Http/Controllers/TopicController.php
+++ b/app/Http/Controllers/TopicController.php
@@ -6,8 +6,8 @@
use Illuminate\Database\Eloquent\Collection;
use GrahamCampbell\Markdown\Facades\Markdown;
-use App\User;
-use App\Topic;
+use App\Models\User;
+use App\Models\Topic;
class TopicController extends Controller
{
@@ -90,8 +90,8 @@ public function store(Request $request)
$topic = new Topic;
$topic->index = $request->input('index');
$topic->name = $request->input('name');
- $topic->description = $request->input('description');
$topic->description_html = Markdown::convertToHtml($request->input('description'));
+ $topic->description = $request->input('description');
$topic->course_id = $request->input('course_id');
$topic->links = $request->input('links');
$topic->public = $request->input('public') === 'public';
@@ -113,13 +113,9 @@ public function store(Request $request)
public function show($id)
{
$_topic = Topic::find($id);
-
$userId = auth()->user()->id;
-
$user = User::find($userId);
-
$topic = $user->courses->find($_topic->course_id)->topics->find($id);
-
$topic->description_html = str_replace("{{", "{spc{", $topic->description_html);
return view('manage.topic.show')->with('topic', $topic);
@@ -134,11 +130,8 @@ public function show($id)
public function edit($id)
{
$_topic = Topic::find($id);
-
$userId = auth()->user()->id;
-
$user = User::find($userId);
-
$topic = $user->courses->find($_topic->course_id)->topics->find($id);
return view('manage.topic.edit')->with('topic', $topic)->with('courses', $user->courses);
@@ -192,13 +185,9 @@ public function update(Request $request, $id)
public function destroy($id)
{
$_topic = Topic::find($id);
-
$userId = auth()->user()->id;
-
$user = User::find($userId);
-
$topic = $user->courses->find($_topic->course_id)->topics->find($id);
-
$topic->delete();
return redirect()->route('topics.filter', [$topic->course_id])->with('success', 'Topic Deleted!');
diff --git a/app/Course.php b/app/Models/Course.php
similarity index 76%
rename from app/Course.php
rename to app/Models/Course.php
index 071ddbd..b32560e 100644
--- a/app/Course.php
+++ b/app/Models/Course.php
@@ -23,14 +23,16 @@ public function getIsNightAttribute()
date_default_timezone_set('Europe/Warsaw');
$hour = date('H', time());
- return !($hour > 6 && $hour < 19);
+ return !($hour > 7 && $hour < 19);
}
- public function user(){
- return $this->belongsTo('App\User');
+ public function topics() {
+ return
+ $this->hasMany('App\Models\Topic');
}
- public function topics() {
- return $this->hasMany('App\Topic');
+ public function user(){
+ return
+ $this->belongsTo('App\Models\User');
}
}
diff --git a/app/Problem.php b/app/Models/Problem.php
similarity index 62%
rename from app/Problem.php
rename to app/Models/Problem.php
index 0c3f6d7..54b6519 100644
--- a/app/Problem.php
+++ b/app/Models/Problem.php
@@ -7,10 +7,10 @@
class Problem extends Model
{
public function quest(){
- return $this->belongsTo('App\Quest');
+ return $this->belongsTo('App\Models\Quest');
}
public function solutions() {
- return $this->hasMany('App\Solution');
+ return $this->hasMany('App\Models\Solution');
}
}
diff --git a/app/Quest.php b/app/Models/Quest.php
similarity index 61%
rename from app/Quest.php
rename to app/Models/Quest.php
index 487159e..de0816d 100644
--- a/app/Quest.php
+++ b/app/Models/Quest.php
@@ -6,11 +6,11 @@
class Quest extends Model
{
- public function topic(){
- return $this->belongsTo('App\Topic');
+ public function problems() {
+ return $this->hasMany('App\Models\Problem');
}
- public function problems() {
- return $this->hasMany('App\Problem');
+ public function topic(){
+ return $this->belongsTo('App\Models\Topic');
}
}
diff --git a/app/Solution.php b/app/Models/Solution.php
similarity index 71%
rename from app/Solution.php
rename to app/Models/Solution.php
index ce75571..6cddb7d 100644
--- a/app/Solution.php
+++ b/app/Models/Solution.php
@@ -7,6 +7,6 @@
class Solution extends Model
{
public function problem(){
- return $this->belongsTo('App\Problem');
+ return $this->belongsTo('App\Models\Problem');
}
}
diff --git a/app/Topic.php b/app/Models/Topic.php
similarity index 60%
rename from app/Topic.php
rename to app/Models/Topic.php
index 0fdabea..4228878 100644
--- a/app/Topic.php
+++ b/app/Models/Topic.php
@@ -6,11 +6,11 @@
class Topic extends Model
{
- public function course(){
- return $this->belongsTo('App\Course');
- }
-
public function quests() {
- return $this->hasMany('App\Quest');
+ return $this->hasMany('App\Models\Quest');
+ }
+
+ public function course(){
+ return $this->belongsTo('App\Models\Course');
}
}
diff --git a/app/User.php b/app/Models/User.php
similarity index 85%
rename from app/User.php
rename to app/Models/User.php
index c9dcbf4..e4ea7a9 100644
--- a/app/User.php
+++ b/app/Models/User.php
@@ -38,10 +38,6 @@ class User extends Authenticatable
];
public function courses() {
- return $this->hasMany('App\Course');
- }
-
- public function photos() {
- return $this->hasMany('App\Photo');
+ return $this->hasMany('App\Models\Course');
}
}
diff --git a/artisan b/artisan
index 5c23e2e..6dcd836 100644
--- a/artisan
+++ b/artisan
@@ -5,7 +5,7 @@ define('LARAVEL_START', microtime(true));
/*
|--------------------------------------------------------------------------
-| Register The Auto Loader
+| Register The Auto Loader.
|--------------------------------------------------------------------------
|
| Composer provides a convenient, automatically generated class loader
@@ -21,7 +21,7 @@ $app = require_once __DIR__.'/bootstrap/app.php';
/*
|--------------------------------------------------------------------------
-| Run The Artisan Application
+| Run The Artisan Application.
|--------------------------------------------------------------------------
|
| When we run the console application, the current CLI command will be
@@ -39,7 +39,7 @@ $status = $kernel->handle(
/*
|--------------------------------------------------------------------------
-| Shutdown The Application
+| Shutdown The Application.
|--------------------------------------------------------------------------
|
| Once Artisan has finished running, we will fire off the shutdown events
diff --git a/bootstrap/app.php b/bootstrap/app.php
index 037e17d..1bd505a 100644
--- a/bootstrap/app.php
+++ b/bootstrap/app.php
@@ -27,13 +27,13 @@
*/
$app->singleton(
- Illuminate\Contracts\Http\Kernel::class,
- App\Http\Kernel::class
+ Illuminate\Contracts\Console\Kernel::class,
+ App\Console\Kernel::class
);
$app->singleton(
- Illuminate\Contracts\Console\Kernel::class,
- App\Console\Kernel::class
+ Illuminate\Contracts\Http\Kernel::class,
+ App\Http\Kernel::class
);
$app->singleton(
diff --git a/composer.json b/composer.json
index 2e6f7cb..3f7cdcd 100644
--- a/composer.json
+++ b/composer.json
@@ -12,8 +12,8 @@
"barryvdh/laravel-cors": "^0.11.3",
"fideloper/proxy": "^4.0",
"graham-campbell/markdown": "^11.1",
- "laravel/framework": "^6.0",
"laravel/tinker": "^1.0",
+ "laravel/framework": "^6.0",
"league/commonmark": "^1.0",
"league/commonmark-extras": "^1.1",
"renatomarinho/laravel-page-speed": "^1.8",
diff --git a/composer.lock b/composer.lock
index e09747a..a0c0d35 100644
--- a/composer.lock
+++ b/composer.lock
@@ -1,8 +1,8 @@
{
"_readme": [
"This file locks the dependencies of your project to a known state",
- "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
- "This file is @generated automatically"
+ "This file is @generated automatically",
+ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies"
],
"content-hash": "bcb01298b711cd2962391b25a445a911",
"packages": [
diff --git a/config/app.php b/config/app.php
index c9960cd..68fd5b5 100644
--- a/config/app.php
+++ b/config/app.php
@@ -13,7 +13,7 @@
|
*/
- 'name' => env('APP_NAME', 'Laravel'),
+ 'name' => env('APP_NAME', 'Timeriddle'),
/*
|--------------------------------------------------------------------------
diff --git a/config/auth.php b/config/auth.php
index 897dc82..86a0ea1 100644
--- a/config/auth.php
+++ b/config/auth.php
@@ -68,7 +68,7 @@
'providers' => [
'users' => [
'driver' => 'eloquent',
- 'model' => App\User::class,
+ 'model' => App\Models\User::class,
],
// 'users' => [
diff --git a/config/services.php b/config/services.php
index f026b2c..1020c0e 100644
--- a/config/services.php
+++ b/config/services.php
@@ -15,8 +15,8 @@
*/
'mailgun' => [
- 'domain' => env('MAILGUN_DOMAIN'),
'secret' => env('MAILGUN_SECRET'),
+ 'domain' => env('MAILGUN_DOMAIN'),
'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'),
],
@@ -35,7 +35,7 @@
],
'stripe' => [
- 'model' => App\User::class,
+ 'model' => App\Models\User::class,
'key' => env('STRIPE_KEY'),
'secret' => env('STRIPE_SECRET'),
'webhook' => [
diff --git a/database/factories/UserFactory.php b/database/factories/UserFactory.php
index 2985ea2..f465b27 100644
--- a/database/factories/UserFactory.php
+++ b/database/factories/UserFactory.php
@@ -1,6 +1,6 @@
bigIncrements('id');
$table->string('name');
+ $table->bigIncrements('id');
$table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
diff --git a/database/migrations/2019_03_06_010514_create_quests_table.php b/database/migrations/2019_03_06_010514_create_quests_table.php
index 7cf861a..bb3c6f8 100644
--- a/database/migrations/2019_03_06_010514_create_quests_table.php
+++ b/database/migrations/2019_03_06_010514_create_quests_table.php
@@ -18,8 +18,8 @@ public function up()
$table->integer('topic_id');
- $table->integer('index');
$table->string('name');
+ $table->integer('index');
$table->text('content')->nullable();
$table->text('content_no_code')->nullable();
$table->text('content_html')->nullable();
diff --git a/database/migrations/2019_03_06_010515_create_problems_table.php b/database/migrations/2019_03_06_010515_create_problems_table.php
index 07b2c0c..cc6d0c2 100644
--- a/database/migrations/2019_03_06_010515_create_problems_table.php
+++ b/database/migrations/2019_03_06_010515_create_problems_table.php
@@ -18,8 +18,8 @@ public function up()
$table->integer('quest_id');
- $table->integer('index');
$table->string('name');
+ $table->integer('index');
$table->text('content')->nullable();
$table->text('content_no_code')->nullable();
$table->text('content_html')->nullable();
diff --git a/database/migrations/2019_03_06_010546_create_topics_table.php b/database/migrations/2019_03_06_010546_create_topics_table.php
index fda4045..adcbdb2 100644
--- a/database/migrations/2019_03_06_010546_create_topics_table.php
+++ b/database/migrations/2019_03_06_010546_create_topics_table.php
@@ -18,11 +18,11 @@ public function up()
$table->integer('course_id');
- $table->integer('index');
$table->string('name');
+ $table->integer('index');
$table->boolean('public');
- $table->text('description')->nullable();
$table->text('description_html')->nullable();
+ $table->text('description')->nullable();
$table->text('links')->nullable();
$table->timestamps();
diff --git a/netlify.toml b/netlify.toml
deleted file mode 100644
index 0d6b1d1..0000000
--- a/netlify.toml
+++ /dev/null
@@ -1,4 +0,0 @@
-[[redirects]]
- from = "/*"
- to = "http://127.0.0.1:8000/:splat"
- status = 200
diff --git a/package-lock.json b/package-lock.json
index 950b3f2..50bf0c6 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,6 +1,6 @@
{
- "requires": true,
"lockfileVersion": 1,
+ "requires": true,
"dependencies": {
"@babel/code-frame": {
"version": "7.5.5",
diff --git a/package.json b/package.json
index d7c9eff..5de834e 100644
--- a/package.json
+++ b/package.json
@@ -6,9 +6,9 @@
"watch": "npm run development -- --watch",
"watch-poll": "npm run watch -- --watch-poll",
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
- "prod": "npm run production",
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"preproduction": "npm run tailwind",
+ "prod": "npm run production",
"tailwind": "./node_modules/.bin/tailwind build ./resources/js/assets/styles/tailwind/tailwind.css -c ./resources/js/assets/styles/tailwind/tailwind.config.js -o ./resources/js/assets/styles/tailwind/tailwind-compiled.css"
},
"devDependencies": {
diff --git a/phpunit.xml b/phpunit.xml
index da4add3..bcf7299 100644
--- a/phpunit.xml
+++ b/phpunit.xml
@@ -2,7 +2,7 @@
diff --git a/routes/web.php b/routes/web.php
index 44a1b17..5f98ca8 100644
--- a/routes/web.php
+++ b/routes/web.php
@@ -29,8 +29,6 @@
Route::get('/courses', 'ManageController@index');
-
-
Route::get('/solutions/filter/{courseId?}/{topicId?}/{questId?}/{problemId?}/', 'SolutionController@index')->name('solutions.problems.quests.topics.filter');
Route::get('/solutions', 'SolutionController@index');
@@ -38,8 +36,6 @@
Route::resource('solutions', 'SolutionController');
-
-
Route::get('/problems/filter/{courseId?}/{topicId?}/{questId?}/', 'ProblemController@index')->name('problems.quests.topics.filter');
Route::get('/problems', 'ProblemController@index');
@@ -47,7 +43,6 @@
Route::resource('problems', 'ProblemController');
-
Route::get('/quests/filter/{courseId}/{topicId?}', 'QuestController@index')->name('quests.topics.filter');
Route::get('/quests/filter/{courseId?}/', 'QuestController@index')->name('quests.filter');
@@ -57,7 +52,6 @@
Route::resource('quests', 'QuestController');
-
Route::get('/topics/filter/{courseId?}', 'TopicController@index')->name('topics.filter');
Route::get('/topics', 'TopicController@index');
diff --git a/server.php b/server.php
index 5fb6379..39f97a8 100644
--- a/server.php
+++ b/server.php
@@ -13,7 +13,7 @@
// This file allows us to emulate Apache's "mod_rewrite" functionality from the
// built-in PHP web server. This provides a convenient way to test a Laravel
-// application without having installed a "real" web server software here.
+// application without having installed a "real" web server software here...
if ($uri !== '/' && file_exists(__DIR__.'/public'.$uri)) {
return false;
}
diff --git a/storage/app/public/.gitignore b/storage/app/public/.gitignore
index d6b7ef3..593bcf0 100644
--- a/storage/app/public/.gitignore
+++ b/storage/app/public/.gitignore
@@ -1,2 +1,2 @@
-*
!.gitignore
+*
diff --git a/tests/Feature/ExampleTest.php b/tests/Feature/ExampleTest.php
index f31e495..d486ef6 100644
--- a/tests/Feature/ExampleTest.php
+++ b/tests/Feature/ExampleTest.php
@@ -16,6 +16,17 @@ public function testBasicTest()
{
$response = $this->get('/');
+ $response->assertStatus(200);
+ }
+ /**
+ * A clear test example.
+ *
+ * @return void
+ */
+ public function testBasicTest()
+ {
+ $response = $this->get('/clear');
+
$response->assertStatus(200);
}
}
diff --git a/webpack.mix.js b/webpack.mix.js
index 19a48fa..e35bb75 100644
--- a/webpack.mix.js
+++ b/webpack.mix.js
@@ -7,7 +7,7 @@ const mix = require('laravel-mix');
|
| Mix provides a clean, fluent API for defining some Webpack build steps
| for your Laravel application. By default, we are compiling the Sass
- | file for the application as well as bundling up all the JS files.
+ | file for the application as well as bundling up all the JS files...
|
*/
diff --git a/yarn.lock b/yarn.lock
index fd19728..6706624 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -1,5 +1,6 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
+#
"@babel/code-frame@^7.0.0":