Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
8631bde
ADD #10 authenticate and admin role.
TuxBoy Nov 11, 2017
43d5072
FIX #10 Redirect after login
TuxBoy Nov 11, 2017
e351409
ADD #10 admin users.
TuxBoy Nov 11, 2017
99290f0
FIX #10 Delete auth middleware for Home access
TuxBoy Nov 12, 2017
8707989
ADD #10 Message flash for the front
TuxBoy Nov 12, 2017
0b6b750
STD #10 phpdoc + use example
TuxBoy Nov 12, 2017
1eed000
ADD #10 users admin
TuxBoy Nov 12, 2017
e4bc18f
IMP #10 Display links user management on the dashboard.
TuxBoy Nov 12, 2017
ef6e7c2
ADD #10 Post author
TuxBoy Nov 12, 2017
d9e3764
ADD #10 TU for admin access
TuxBoy Nov 12, 2017
ed7d57f
ADD #10 TU for admin access
TuxBoy Nov 12, 2017
cba6802
ADD #10 Markdown for article content
TuxBoy Nov 12, 2017
f69be87
ADD #10 markdown editor
TuxBoy Nov 12, 2017
5ad9e0c
STD #10 composer update
TuxBoy Apr 7, 2018
7ad241b
ADD #10 upload cover image
TuxBoy Apr 7, 2018
c75aab1
IMP #10 Upload post image
TuxBoy Apr 8, 2018
608afab
IMP #10 Delete cover image post
TuxBoy Apr 8, 2018
f47d32d
STD #10 lines
TuxBoy Apr 8, 2018
8e737c5
IMP #10 Simplify use Form builder
TuxBoy Apr 20, 2018
4ee4eb9
IMP #10 find first article in the PostRepository
TuxBoy Apr 20, 2018
29aec79
IMP #10 ignore composer.lock
TuxBoy Apr 20, 2018
7c1d06d
IMP #10 new blog front
TuxBoy Apr 21, 2018
f0d2ced
IMP #10 new blog front
TuxBoy Apr 21, 2018
b7052f1
IMP Use repository class
TuxBoy Apr 29, 2018
4c1171f
FIX Not upload image
TuxBoy Apr 29, 2018
d551ab5
FIX UT with upload image
TuxBoy May 13, 2018
69bb74b
ADD Favorites post stytem
TuxBoy May 16, 2018
eba2a0b
FIX Not redirect /home route after account register
TuxBoy Jun 16, 2018
8dd34f2
FIX Not redirect /home route after account register
TuxBoy Jun 16, 2018
da84f69
ADD listing user favorites list
TuxBoy Jun 16, 2018
ab19a15
Update composer.lock file
TuxBoy Jun 16, 2018
07fb839
ADD Favorites post stytem
TuxBoy Sep 8, 2018
19cc6f3
Merge remote-tracking branch 'origin/10-auth-system' into 10-auth-system
TuxBoy Sep 8, 2018
318f63d
IMP Moved models in the Model namespace
TuxBoy Sep 8, 2018
10239f0
ADD administration users role
TuxBoy Sep 9, 2018
3fc9a65
ADD administration users role
TuxBoy Sep 9, 2018
026bf91
STD lines
TuxBoy Sep 9, 2018
f91f819
IMP Edit/delete role
TuxBoy Sep 9, 2018
37544d8
IMP Edit/delete role
TuxBoy Sep 9, 2018
aabe8f1
IMP Edit/delete role
TuxBoy Sep 9, 2018
c714412
IMP Edit/delete role
TuxBoy Sep 16, 2018
ce073ce
feat(add display/update user account with discord data)
TuxBoy Sep 22, 2018
a344c1d
feat(add user avatar to the discord)
TuxBoy Sep 23, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,7 @@ MAIL_ENCRYPTION=null
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=

# Discord API
DISCORD_TOKEN=
DISCORD_GUILD_ID=
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
/node_modules
/public/hot
/public/storage
/public/posts
/storage/*.key
/vendor
/.idea
/.vagrant
composer.lock
Homestead.json
Homestead.yaml
npm-debug.log
Expand Down
15 changes: 15 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.PHONY: install update test

composer.lock: composer.json
composer update

vendor: composer.lock
composer install

install: vendor

serve: install
php artisan serve

test:
./vendor/bin/phpunit --colors
23 changes: 0 additions & 23 deletions app/Concern/Repository/PostRepository.php

This file was deleted.

10 changes: 10 additions & 0 deletions app/Favorite/Favorite.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

namespace App\Favorite;

use Illuminate\Database\Eloquent\Model;

class Favorite extends Model
{
//
}
41 changes: 41 additions & 0 deletions app/Favorite/HasFavorites.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php

namespace App\Favorite;

use Illuminate\Database\Eloquent\Relations\BelongsToMany;

/**
* Model relationship for favories system
*/
trait HasFavorites
{

/**
* @return string[]
*/
protected function getKeys(): array
{
return ['user_id', 'post_id'];
}

/**
* @return string the model (ex: post_id => App\Model\Post)
*/
private function relatedPivotKeyToModel(): string
{
$pivotKey = $this->getKeys()[1];
return 'App\\Model\\' . ucfirst(str_replace('_id','', $pivotKey));
}

/**
* @return BelongsToMany
*/
public function favorites(): BelongsToMany
{
list($foreignPivotKey, $relatedPivotKey) = $this->getKeys();
return $this
->belongsToMany($this->relatedPivotKeyToModel(), 'favorites', $foreignPivotKey, $relatedPivotKey)
->withTimeStamps();
}

}
45 changes: 45 additions & 0 deletions app/Forms/Admin/AdminForm.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php
namespace App\Forms\Admin;

use App\Http\Tools\Method;
use Kris\LaravelFormBuilder\Form;

/**
* Class AdminForm
*/
abstract class AdminForm extends Form
{

/**
* @var string
*/
protected $label;

/**
* @var string
*/
protected $routePrefixName;

/**
* Default buildForm with crud configuration
*
* @return mixed|void
*/
public function buildForm()
{
if ($this->getModel() && $this->getModel()->id) {
$url = route($this->routePrefixName . '.update', $this->getModel());
$method = Method::PUT;
$this->label = "Editer l'article";
} else {
$url = route($this->routePrefixName . '.store');
$method = Method::POST;
$this->label = "Créer l'article";
}
$this->formOptions = [
'method' => $method,
'url' => $url,
];
parent::buildForm();
}
}
49 changes: 49 additions & 0 deletions app/Forms/Admin/PostsForm.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?php

namespace App\Forms\Admin;

use App\Model\Category;
use Illuminate\Support\Facades\Auth;

/**
* Class PostsForm
*
* Manage the admin form of the articles.
*/
class PostsForm extends AdminForm
{

protected $routePrefixName = 'posts';

/**
* @return mixed|void
*/
public function buildForm()
{
parent::buildForm();
// Classic input
$this
->add('name', 'text')
->add('slug', 'text')
->add('image', 'image')
->add('image_file', 'file')
->add('content', 'textarea', ['attr' => ['id' => 'mdeditor']])
->add('online', 'checkbox')
->add('user_id', 'hidden', ['value' => Auth::user()->id]);

// Entity
$this->addBefore('image', 'category_id', 'entity', [
'class' => Category::class,
'property' => 'name',
'empty_value' => '== Sélectionnez une catégorie ==',
'label_show' => false,
'attr' => ['class' => 'browser-default'],
'rules' => 'required'
]);
$this->add('submit', 'submit', [
'label' => $this->label,
'attr' => ['class' => 'btn btn waves-effect waves-light']
]);
array_merge($this->formOptions, ['file' => true]);
}
}
28 changes: 28 additions & 0 deletions app/Forms/Admin/RolesForm.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php
namespace App\Forms\Admin;

/**
* Class UsersForm
*/
class RolesForm extends AdminForm
{

/**
* @var string
*/
protected $routePrefixName = 'roles';

public function buildForm()
{
parent::buildForm();
$this
->add('name', 'text')
->add('slug', 'text')
->add('description', 'textarea');

$this->add('submit', 'submit', [
'label' => 'Ajouter le role',
'attr' => ['class' => 'btn btn waves-effect waves-light']
]);
}
}
34 changes: 34 additions & 0 deletions app/Forms/Admin/UsersForm.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php
namespace App\Forms\Admin;

use App\Model\Role;

/**
* Class UsersForm
*/
class UsersForm extends AdminForm
{

protected $routePrefixName = 'users';

public function buildForm()
{
parent::buildForm();
$this
->add('name', 'text')
->add('email', 'text')
->add('role_id', 'entity', [
'class' => Role::class,
'property_name' => 'name',
'label_show' => false,
'empty_value' => '== Sélectionnez un role ==',
'attr' => ['class' => 'browser-default'],
'rules' => 'required'
]);

$this->add('submit', 'submit', [
'label' => 'Ajouter cet utilisateur',
'attr' => ['class' => 'btn btn waves-effect waves-light']
]);
}
}
41 changes: 0 additions & 41 deletions app/Forms/PostsForm.php

This file was deleted.

Loading