Commit ab97dd98 authored by psl4's avatar psl4
Browse files

Added logic

parent 5f4e2155
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="dataSourceStorageLocal">
<data-source name="@localhost" uuid="f4698a53-1785-4402-b311-5d6e7c205361">
<database-info product="MySQL" version="8.0.19" jdbc-version="4.2" driver-name="MySQL Connector/J" driver-version="mysql-connector-java-8.0.15 (Revision: 79a4336f140499bd22dd07f02b708e163844e3d5)" dbms="MYSQL" exact-version="8.0.19" exact-driver-version="8.0">
<extra-name-characters>#@</extra-name-characters>
<identifier-quote-string>`</identifier-quote-string>
</database-info>
<case-sensitivity plain-identifiers="lower" quoted-identifiers="lower" />
<secret-storage>master_key</secret-storage>
<user-name>root</user-name>
<schema-mapping>
<introspection-scope>
<node kind="schema" qname="unwto_db" />
</introspection-scope>
</schema-mapping>
</data-source>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
<data-source source="LOCAL" name="@localhost" uuid="f4698a53-1785-4402-b311-5d6e7c205361">
<driver-ref>mysql.8</driver-ref>
<synchronize>true</synchronize>
<jdbc-driver>com.mysql.cj.jdbc.Driver</jdbc-driver>
<jdbc-url>jdbc:mysql://localhost:3306</jdbc-url>
<driver-properties>
<property name="serverTimezone" value="UTC" />
</driver-properties>
</data-source>
</component>
</project>
\ No newline at end of file
This diff is collapsed.
#n:information_schema
!<md> [null, 0, null, null, -2147483648, -2147483648]
......@@ -107,6 +107,8 @@
<path value="$PROJECT_DIR$/vendor/barryvdh/laravel-debugbar" />
<path value="$PROJECT_DIR$/vendor/symfony/debug" />
<path value="$PROJECT_DIR$/vendor/maximebf/debugbar" />
<path value="$PROJECT_DIR$/vendor/laravel/ui" />
<path value="$PROJECT_DIR$/vendor/laravelcollective/html" />
</include_path>
</component>
<component name="PhpProjectSharedConfiguration" php_language_level="7.2" />
......
......@@ -14,6 +14,8 @@
<excludeFolder url="file://$MODULE_DIR$/vendor/doctrine/dbal" />
<excludeFolder url="file://$MODULE_DIR$/vendor/doctrine/event-manager" />
<excludeFolder url="file://$MODULE_DIR$/vendor/justinrainbow/json-schema" />
<excludeFolder url="file://$MODULE_DIR$/vendor/laravel/ui" />
<excludeFolder url="file://$MODULE_DIR$/vendor/laravelcollective/html" />
<excludeFolder url="file://$MODULE_DIR$/vendor/maximebf/debugbar" />
<excludeFolder url="file://$MODULE_DIR$/vendor/seld/jsonlint" />
<excludeFolder url="file://$MODULE_DIR$/vendor/seld/phar-utils" />
......
This diff is collapsed.
......@@ -5,7 +5,7 @@ namespace PHPSTORM_META {
/**
* PhpStorm Meta file, to provide autocomplete information for PhpStorm
* Generated on 2020-05-03 06:00:45.
* Generated on 2020-05-16 09:50:37.
*
* @author Barry vd. Heuvel <barryvdh@gmail.com>
* @see https://github.com/barryvdh/laravel-ide-helper
......@@ -138,8 +138,10 @@ namespace PHPSTORM_META {
'flare.client' => \Facade\FlareClient\Flare::class,
'flare.http' => \Facade\FlareClient\Http\Client::class,
'flare.logger' => \Monolog\Logger::class,
'form' => \Collective\Html\FormBuilder::class,
'hash' => \Illuminate\Hashing\HashManager::class,
'hash.driver' => \Illuminate\Hashing\BcryptHasher::class,
'html' => \Collective\Html\HtmlBuilder::class,
'log' => \Illuminate\Log\LogManager::class,
'mail.manager' => \Illuminate\Mail\MailManager::class,
'mailer' => \Illuminate\Mail\Mailer::class,
......@@ -293,8 +295,10 @@ namespace PHPSTORM_META {
'flare.client' => \Facade\FlareClient\Flare::class,
'flare.http' => \Facade\FlareClient\Http\Client::class,
'flare.logger' => \Monolog\Logger::class,
'form' => \Collective\Html\FormBuilder::class,
'hash' => \Illuminate\Hashing\HashManager::class,
'hash.driver' => \Illuminate\Hashing\BcryptHasher::class,
'html' => \Collective\Html\HtmlBuilder::class,
'log' => \Illuminate\Log\LogManager::class,
'mail.manager' => \Illuminate\Mail\MailManager::class,
'mailer' => \Illuminate\Mail\Mailer::class,
......@@ -448,8 +452,10 @@ namespace PHPSTORM_META {
'flare.client' => \Facade\FlareClient\Flare::class,
'flare.http' => \Facade\FlareClient\Http\Client::class,
'flare.logger' => \Monolog\Logger::class,
'form' => \Collective\Html\FormBuilder::class,
'hash' => \Illuminate\Hashing\HashManager::class,
'hash.driver' => \Illuminate\Hashing\BcryptHasher::class,
'html' => \Collective\Html\HtmlBuilder::class,
'log' => \Illuminate\Log\LogManager::class,
'mail.manager' => \Illuminate\Mail\MailManager::class,
'mailer' => \Illuminate\Mail\Mailer::class,
......@@ -603,8 +609,10 @@ namespace PHPSTORM_META {
'flare.client' => \Facade\FlareClient\Flare::class,
'flare.http' => \Facade\FlareClient\Http\Client::class,
'flare.logger' => \Monolog\Logger::class,
'form' => \Collective\Html\FormBuilder::class,
'hash' => \Illuminate\Hashing\HashManager::class,
'hash.driver' => \Illuminate\Hashing\BcryptHasher::class,
'html' => \Collective\Html\HtmlBuilder::class,
'log' => \Illuminate\Log\LogManager::class,
'mail.manager' => \Illuminate\Mail\MailManager::class,
'mailer' => \Illuminate\Mail\Mailer::class,
......@@ -758,8 +766,10 @@ namespace PHPSTORM_META {
'flare.client' => \Facade\FlareClient\Flare::class,
'flare.http' => \Facade\FlareClient\Http\Client::class,
'flare.logger' => \Monolog\Logger::class,
'form' => \Collective\Html\FormBuilder::class,
'hash' => \Illuminate\Hashing\HashManager::class,
'hash.driver' => \Illuminate\Hashing\BcryptHasher::class,
'html' => \Collective\Html\HtmlBuilder::class,
'log' => \Illuminate\Log\LogManager::class,
'mail.manager' => \Illuminate\Mail\MailManager::class,
'mailer' => \Illuminate\Mail\Mailer::class,
......@@ -913,8 +923,10 @@ namespace PHPSTORM_META {
'flare.client' => \Facade\FlareClient\Flare::class,
'flare.http' => \Facade\FlareClient\Http\Client::class,
'flare.logger' => \Monolog\Logger::class,
'form' => \Collective\Html\FormBuilder::class,
'hash' => \Illuminate\Hashing\HashManager::class,
'hash.driver' => \Illuminate\Hashing\BcryptHasher::class,
'html' => \Collective\Html\HtmlBuilder::class,
'log' => \Illuminate\Log\LogManager::class,
'mail.manager' => \Illuminate\Mail\MailManager::class,
'mailer' => \Illuminate\Mail\Mailer::class,
......@@ -1068,8 +1080,10 @@ namespace PHPSTORM_META {
'flare.client' => \Facade\FlareClient\Flare::class,
'flare.http' => \Facade\FlareClient\Http\Client::class,
'flare.logger' => \Monolog\Logger::class,
'form' => \Collective\Html\FormBuilder::class,
'hash' => \Illuminate\Hashing\HashManager::class,
'hash.driver' => \Illuminate\Hashing\BcryptHasher::class,
'html' => \Collective\Html\HtmlBuilder::class,
'log' => \Illuminate\Log\LogManager::class,
'mail.manager' => \Illuminate\Mail\MailManager::class,
'mailer' => \Illuminate\Mail\Mailer::class,
......@@ -1223,8 +1237,10 @@ namespace PHPSTORM_META {
'flare.client' => \Facade\FlareClient\Flare::class,
'flare.http' => \Facade\FlareClient\Http\Client::class,
'flare.logger' => \Monolog\Logger::class,
'form' => \Collective\Html\FormBuilder::class,
'hash' => \Illuminate\Hashing\HashManager::class,
'hash.driver' => \Illuminate\Hashing\BcryptHasher::class,
'html' => \Collective\Html\HtmlBuilder::class,
'log' => \Illuminate\Log\LogManager::class,
'mail.manager' => \Illuminate\Mail\MailManager::class,
'mailer' => \Illuminate\Mail\Mailer::class,
......
This diff is collapsed.
......@@ -3,13 +3,31 @@
namespace App;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class Article extends Model
{
use SoftDeletes;
protected $table = 'articles';
protected $primaryKey = 'articleId';
protected $fillable = ['Header', 'Text', 'Description'];
public $timestamps = false;
protected $primaryKey = 'idArticle';
protected $fillable = [
'Header',
'Text',
'Description',
];
protected $dates = [
'created_at',
'updated_at',
'deleted_at',
];
public function user()
{
return $this->belongsTo('App\User');
}
public function links()
{
......
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class GuestbookMessage extends Model
{
use SoftDeletes;
protected $dates = [
'created_at',
'updated_at',
'deleted_at',
];
protected $fillable = [
'message', 'user_id',
];
public function user()
{
return $this->belongsTo('App\User');
}
}
<?php
namespace App\Http\Controllers;
use App\Article;
use App\Http\Requests\ArticleStoreRequest;
use App\Http\Requests\ArticleUpdateRequest;
use Illuminate\Support\Facades\DB;
class ArticleController extends Controller
{
public function index()
{
$articles = Article::paginate(1);
return view('page.index', compact('articles'));
}
public function create()
{
if (auth()->check())
{
$article = new Article();
return view('page.article.create', compact('article'));
}
return redirect(route('page::index'));
}
public function store(ArticleStoreRequest $request)
{
$article = new Article($request->all());
$article->idUser = \Auth::user()->id;
$article->save();
\Session::flash('result', "Article successfully saved");
return redirect(route('page::index'));
}
public function edit($article)
{
if (auth()->check())
{
if (auth()->user()->id == $article->idUser)
{
return view('page.article.edit', compact('article'));
}
}
return redirect(route('page::index'));
}
public function update(ArticleUpdateRequest $request, $article)
{
if (auth()->check()) {
if (auth()->user()->id == $article->idUser) {
$article_new = new Article($request->all());
$article->Header = $article_new->Header;
$article->Text = $article_new->Text;
$article->Description = $article_new->Description;
$article->save();
\Session::flash('result', "Article successfully updated");
}
}
return redirect(route('page::index'));
}
public function delete($article)
{
if (auth()->check()) {
if (auth()->user()->id == $article->idUser) {
Article::where('idArticle', $article->idArticle)->delete();
}
}
return redirect(route('page::index'));
}
}
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\Providers\RouteServiceProvider;
use Illuminate\Foundation\Auth\ConfirmsPasswords;
class ConfirmPasswordController extends Controller
{
/*
|--------------------------------------------------------------------------
| Confirm Password Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling password confirmations and
| uses a simple trait to include the behavior. You're free to explore
| this trait and override any functions that require customization.
|
*/
use ConfirmsPasswords;
/**
* Where to redirect users when the intended url fails.
*
* @var string
*/
protected $redirectTo = RouteServiceProvider::HOME;
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('auth');
}
}
<?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;
}
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\Providers\RouteServiceProvider;
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 = RouteServiceProvider::HOME;
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest')->except('logout');
}
}
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\Providers\RouteServiceProvider;
use App\User;
use Illuminate\Foundation\Auth\RegistersUsers;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Validator;
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 = RouteServiceProvider::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', 'string', 'max:255'],
'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
'password' => ['required', 'string', 'min:8', 'confirmed'],
]);
}
/**
* Create a new user instance after a valid registration.
*
* @param array $data
* @return \App\User
*/
protected function create(array $data)
{
return User::create([
'name' => $data['name'],
'email' => $data['email'],
'password' => Hash::make($data['password']),
]);
}
}
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\Providers\RouteServiceProvider;
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 = RouteServiceProvider::HOME;
}
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\Providers\RouteServiceProvider;
use Illuminate\Foundation\Auth\VerifiesEmails;
class VerificationController extends Controller
{
/*
|--------------------------------------------------------------------------
| Email Verification Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling email verification for any
| user that recently registered with the application. Emails may also
| be re-sent if the user didn't receive the original email message.
|
*/
use VerifiesEmails;
/**
* Where to redirect users after verification.
*
* @var string
*/
protected $redirectTo = RouteServiceProvider::HOME;
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('auth');
$this->middleware('signed')->only('verify');
$this->middleware('throttle:6,1')->only('verify', 'resend');
}
}
<?php
namespace App\Http\Controllers;
use App\GuestbookMessage;
use App\Http\Requests\MessageStoreRequest;
use App\Http\Requests\MessageUpdateRequest;
use Illuminate\Http\Request;
class GuestbookMessageController extends Controller
{
public function index()
{
$messages = GuestbookMessage::paginate(5);
return view('guestbook.index', compact('messages'));
}
public function create()
{
$message = new GuestbookMessage();
return view('guestbook.message.create', compact('message'));
}
public function store(MessageStoreRequest $request)
{
$message = new GuestbookMessage($request->all());
$message->user_id = \Auth::user()->id;
$message->save();
\Session::flash('result', "Message successfully saved");
return redirect(route('guestbook::index'));
}
public function edit($message) {}
public function update(MessageUpdateRequest $request) {}
public function delete($message) {}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment