protected $moduleName = 'pdfFiles';
+
+
+
+
}
--- /dev/null
+<?php
+
+namespace App\Http\Controllers\Admin;
+
+use A17\Twill\Http\Controllers\Admin\ModuleController;
+
+class SocialArticleController extends ModuleController
+{
+ protected $moduleName = 'socialArticles';
+
+ protected $indexColumns = [
+ 'title' => [
+ 'title' => 'Titre',
+ 'field' => 'title',
+ 'sort' => true,
+ ],
+ 'count' => [
+ 'title' => "Nombre d'impressions",
+ 'field' => 'count',
+ ],
+ ];
+
+ protected $permalinkBase = 'article';
+}
--- /dev/null
+<?php
+
+namespace App\Http\Controllers;
+
+use App\Models\SocialArticle;
+use App\Repositories\SocialArticleRepository;
+use Illuminate\Http\Request;
+use Symfony\Component\HttpKernel\Exception\HttpException;
+
+class SocialArticleController extends Controller
+{
+ public function show($slug, SocialArticleRepository $repository)
+ {
+ /** @var SocialArticle $article */
+ $article = $repository->forSlug($slug);
+
+ if($article === null) {
+ abort(404, "Cet article n'existe pas !");
+ }
+
+ $article->addView();
+
+ \View::share('article', $article);
+
+ return view('social-articles.show');
+ }
+}
--- /dev/null
+<?php
+
+namespace App\Http\Requests\Admin;
+
+use A17\Twill\Http\Requests\Admin\Request;
+
+class SocialArticleRequest extends Request
+{
+ public function rulesForCreate()
+ {
+ return [];
+ }
+
+ public function rulesForUpdate()
+ {
+ return [];
+ }
+}
'description',
'position',
];
-
+
public $slugAttributes = [
'title',
];
-
+
public $mediasParams = [
'cover' => [
'desktop' => [
],
],
];
+
+
+
}
+++ /dev/null
-<?php
-
-namespace App\Models\Revisions;
-
-use A17\Twill\Models\Revision;
-
-class GuestRevision extends Revision
-{
- protected $table = "guest_revisions";
-}
--- /dev/null
+<?php
+
+namespace App\Models\Revisions;
+
+use A17\Twill\Models\Revision;
+
+class SocialArticleRevision extends Revision
+{
+ protected $table = "social_article_revisions";
+}
--- /dev/null
+<?php
+
+namespace App\Models\Slugs;
+
+use A17\Twill\Models\Model;
+
+class SocialArticleSlug extends Model
+{
+ protected $table = "social_article_slugs";
+}
--- /dev/null
+<?php
+
+namespace App\Models;
+
+use A17\Twill\Models\Behaviors\HasBlocks;
+use A17\Twill\Models\Behaviors\HasTranslation;
+use A17\Twill\Models\Behaviors\HasSlug;
+use A17\Twill\Models\Behaviors\HasMedias;
+use A17\Twill\Models\Behaviors\HasFiles;
+use A17\Twill\Models\Behaviors\HasRevisions;
+use A17\Twill\Models\Behaviors\HasPosition;
+use A17\Twill\Models\Behaviors\Sortable;
+use A17\Twill\Models\Model;
+
+class SocialArticle extends Model
+{
+ use HasBlocks, HasSlug, HasMedias;
+
+ protected $fillable = [
+ 'published',
+ 'title',
+ ];
+
+
+ public $slugAttributes = [
+ 'title',
+ ];
+
+
+ /**
+ * Increments view count
+ */
+ public function addView(): void
+ {
+ $this->count ++;
+ $this->save();
+ }
+
+
+}
+++ /dev/null
-<?php
-
-namespace App\Models\Translations;
-
-use A17\Twill\Models\Model;
-use App\Models\Guest;
-
-class GuestTranslation extends Model
-{
- protected $baseModuleModel = Guest::class;
-}
namespace App;
use A17\Twill\Models\Behaviors\HasPosition;
+use A17\Twill\Models\Behaviors\HasSlug;
use A17\Twill\Models\Behaviors\Sortable;
use A17\Twill\Models\Model as TwillModel;
use App\Flowpaper\Pdf2Json;
{
use HasPosition;
+
protected $appends = [
'coverUrl',
];
protected $fillable = [
- 'public',
+ 'free',
'position',
'title',
'file_name',
'collection_id',
'ref',
'headlines',
+ 'published',
];
protected $casts = [
--- /dev/null
+<?php
+
+namespace App\Repositories;
+
+use A17\Twill\Repositories\Behaviors\HandleBlocks;
+use A17\Twill\Repositories\Behaviors\HandleTranslations;
+use A17\Twill\Repositories\Behaviors\HandleSlugs;
+use A17\Twill\Repositories\Behaviors\HandleMedias;
+use A17\Twill\Repositories\Behaviors\HandleFiles;
+use A17\Twill\Repositories\Behaviors\HandleRevisions;
+use A17\Twill\Repositories\ModuleRepository;
+use App\Models\SocialArticle;
+
+class SocialArticleRepository extends ModuleRepository
+{
+ use HandleBlocks, HandleSlugs, HandleMedias;
+
+ public function __construct(SocialArticle $model)
+ {
+ $this->model = $model;
+ }
+}
'route' => 'admin.publish',
],
'content' => [
- 'title' => 'Gestion du Contenu',
+ 'title' => 'Contenu du site',
'route' => 'admin.content.homepage',
'primary_navigation' => [
'homepage' => [
'title' => "Page d'accueil",
'route' => 'admin.content.homepage',
],
+// 'pdfFiles' => [
+// 'title' => 'Lettres',
+// 'module' => true
+// ],
+
'adCampaigns' => [
'title' => 'Campagnes publicitaires',
'module' => true
]
]
],
+ 'other_content' => [
+ 'title' => 'Autre contenu',
+ 'route' => 'admin.other-content.socialArticles.index',
+ 'primary_navigation' => [
+ 'socialArticles' => [
+ 'title' => 'Articles réseaux sociaux',
+ 'module' => true
+ ]
+
+ ]
+ ]
--- /dev/null
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+
+class CreateSocialArticlesTables extends Migration
+{
+ public function up()
+ {
+ Schema::create('social_articles', function (Blueprint $table) {
+ // this will create an id, a "published" column, and soft delete and timestamps columns
+ createDefaultTableFields($table);
+
+ $table->string('title');
+ $table->unsignedInteger('count')->default(0);
+
+
+ // add those 2 columns to enable publication timeframe fields (you can use publish_start_date only if you don't need to provide the ability to specify an end date)
+ // $table->timestamp('publish_start_date')->nullable();
+ // $table->timestamp('publish_end_date')->nullable();
+ });
+
+
+ Schema::create('social_article_slugs', function (Blueprint $table) {
+ createDefaultSlugsTableFields($table, 'social_article');
+ });
+
+ }
+
+ public function down()
+ {
+ Schema::dropIfExists('social_article_slugs');
+ Schema::dropIfExists('social_articles');
+ }
+}
@section('contentFields')
@formField('input', [
- 'name' => 'description',
+ 'name' => 'slug',
'label' => 'Description',
'maxlength' => 100
])
--- /dev/null
+@extends('twill::layouts.form')
+
+@section('contentFields')
+ @formField('block_editor', ['blocks' => ['image', 'text', 'youtube']])
+@stop
-@extends('errors::minimal')
-
+@extends('layouts.app')
@section('title', __('Not Found'))
-@section('code', '404')
-@section('message', __('Not Found'))
+
+@section('content')
+
+ <div class="container error-404">
+
+
+ <h1>{{($m = $exception->getMessage()) === '' ? __('Not Found') : $m }}</h1>
+
+ <p>Cette page est introuvable... <a href="/">cliquez ici pour retourner sur la page d'accueil</a></p>
+
+
+ </div>
+@endsection
@extends('layouts.app', ['hideNav' => true])
@section('content')
- @yield('content')
+ <article class="container">
+ <div class="content">
+ @yield('content')
+
+ </div>
+
+ </article>
@endsection
--- /dev/null
+@extends('layouts.app')
+
+@section('content')
+
+ <article class="container">
+ <div class="row">
+
+ <div class="col-sm-4">
+ <x-pill-box slug="article-reseaux-sociaux" class="mb-4"></x-pill-box>
+ </div>
+ <div class="col-sm-8">
+ <h2>{{$article->title}}</h2>
+ <div class="content">
+ {!! $article->renderBlocks() !!}
+ </div>
+
+ </div>
+
+ </div>
+
+ </article>
+
+@endsection
/** Dynamic content */
Route::prefix('content')->group(function() {
+ Route::module('pdfFiles');
Route::module('articles');
Route::module('adCampaigns');
Route::module('events');
Route::module('pillBoxSpaces');
});
+Route::prefix('other-content')->group(function () {
+ Route::module('socialArticles');
+});
+
/** Publishing and mass sending process */
Route::prefix('publish')->group(function() {
Route::get('{slug}', 'ActuLabosController@show')->name('actus-labos.show');
});
+ Route::get('article/{slug}', 'SocialArticleController@show')->name('social-article.show');
+
/** Metadata */
Route::prefix('/files/{file:slug}')->group(function () {
Route::get('/cover', 'FileController@cover');