uff muchas cosas, agrege projecto y setup

This commit is contained in:
Daniel Cortés
2019-10-14 22:59:22 -03:00
parent 45a441bb2c
commit a7929c0097
36 changed files with 334 additions and 147 deletions

View File

@@ -5,6 +5,7 @@ namespace App\Http\Controllers;
use App\Post; use App\Post;
use App\Now; use App\Now;
use App\Project; use App\Project;
use App\Setup;
use Illuminate\Http\Request; use Illuminate\Http\Request;
class AdminController extends Controller class AdminController extends Controller
@@ -28,4 +29,9 @@ class AdminController extends Controller
{ {
return view('admin.projects.index', ['projects' => Project::orderBy('created_at', 'desc')->get()]); return view('admin.projects.index', ['projects' => Project::orderBy('created_at', 'desc')->get()]);
} }
public function setups()
{
return view('admin.setups.index', ['setups' => Setup::orderBy('created_at', 'desc')->get()]);
}
} }

View File

@@ -0,0 +1,51 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Setup;
class SetupController extends Controller
{
public function index()
{
$setups = Setup::orderBy('created_at', 'desc')->get();
return view('setups.index', ['setups' => $setups] );
}
public function create()
{
return view('admin.setups.create');
}
public function save(Request $request)
{
$setup = new Setup();
$setup->title = $request->title;
$setup->md = $request->md;
$setup->save();
return redirect()->route('admin.setup.index');
}
public function edit($id)
{
return view('admin.setups.edit', ['setup' => Setup::find($id)]);
}
public function update(Request $request, $id)
{
$setup = Setup::find($id);
$setup->title = $request->title;
$setup->md = $request->md;
$setup->save();
return redirect()->route('admin.setup.index');
}
public function delete($id)
{
Setup::find($id)->delete();
return redirect()->route('admin.setup.index');
}
}

View File

@@ -7,9 +7,4 @@ use Illuminate\Database\Eloquent\Model;
class Project extends Model class Project extends Model
{ {
protected $table = 'projects'; protected $table = 'projects';
public function photos()
{
return $this->hasMany('App\ProjectPhoto');
}
} }

View File

@@ -1,14 +0,0 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class ProjectPhoto extends Model
{
protected $table = 'projects_photos';
public function project() {
return $this->belongsTo('App\Project');
}
}

10
app/Setup.php Normal file
View File

@@ -0,0 +1,10 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Setup extends Model
{
protected $tablename = "setups";
}

View File

@@ -0,0 +1,13 @@
<?php
/* @var $factory \Illuminate\Database\Eloquent\Factory */
use App\Model;
use Faker\Generator as Faker;
$factory->define(App\Project::class, function (Faker $faker) {
return [
'title' => $faker->words(5, true),
'md' => $faker->paragraphs(10, true)
];
});

View File

@@ -0,0 +1,13 @@
<?php
/* @var $factory \Illuminate\Database\Eloquent\Factory */
use App\Model;
use Faker\Generator as Faker;
$factory->define(App\Setup::class, function (Faker $faker) {
return [
'title' => $faker->words(5, true),
'md' => $faker->paragraphs(10, true)
];
});

View File

@@ -28,7 +28,7 @@ class CreateBaseDb extends Migration
$table->timestamps(); $table->timestamps();
}); });
Schema::create('setup', function(Blueprint $table) { Schema::create('setups', function(Blueprint $table) {
$table->bigIncrements('id'); $table->bigIncrements('id');
$table->string('title'); $table->string('title');
$table->longText('md'); $table->longText('md');
@@ -41,5 +41,6 @@ class CreateBaseDb extends Migration
Schema::dropIfExists('projects'); Schema::dropIfExists('projects');
Schema::dropIfExists('now'); Schema::dropIfExists('now');
Schema::dropIfExists('posts'); Schema::dropIfExists('posts');
Schema::dropIfExists('setups');
} }
} }

View File

@@ -8,5 +8,7 @@ class DatabaseSeeder extends Seeder
{ {
$this->call(PostTableSeeder::class); $this->call(PostTableSeeder::class);
$this->call(NowTableSeeder::class); $this->call(NowTableSeeder::class);
$this->call(SetupTableSeeder::class);
$this->call(ProjectTableSeeder::class);
} }
} }

View File

@@ -0,0 +1,11 @@
<?php
use Illuminate\Database\Seeder;
class ProjectTableSeeder extends Seeder
{
public function run()
{
factory(App\Project::class, 50)->create();
}
}

View File

@@ -0,0 +1,11 @@
<?php
use Illuminate\Database\Seeder;
class SetupTableSeeder extends Seeder
{
public function run()
{
factory(App\Setup::class, 50)->create();
}
}

4
public/css/app.css vendored
View File

@@ -1610,11 +1610,11 @@ article {
=> Buttons & Links => Buttons & Links
*******************************************************************************/ *******************************************************************************/
.admin-link { .special-link {
color: #ee1155; color: #ee1155;
} }
.admin-link:hover { .special-link:hover {
color: #ee1155; color: #ee1155;
border-bottom: 1px #ee1155 solid; border-bottom: 1px #ee1155 solid;
background-color: transparent; background-color: transparent;

26
public/js/admin.js vendored
View File

@@ -93,27 +93,11 @@
/*! no static exports found */ /*! no static exports found */
/***/ (function(module, exports) { /***/ (function(module, exports) {
switch (window.location.pathname) { posts_edit_regexp = new RegExp("/admin/posts/\\d+/edit");
case "/admin": now_edit_regexp = new RegExp("/admin/now/\\d+/edit");
document.getElementById("title-link").classList.add("pure-menu-highlight"); projects_edit_regexp = new RegExp("/admin/projects/\\d+/edit");
break; setups_edit_regexp = new RegExp("/admin/setups/\\d+/edit");
if (window.location.pathname === "/admin/posts" || window.location.pathname === "/admin/posts/create" || window.location.pathname.match(posts_edit_regexp)) document.getElementById("posts-link").classList.add("pure-menu-highlight");else if (window.location.pathname === "/admin/now" || window.location.pathname === "/admin/now/create" || window.location.pathname.match(now_edit_regexp)) document.getElementById("now-link").classList.add("pure-menu-highlight");else if (window.location.pathname === "/admin/projects" || window.location.pathname === "/admin/projects/create" || window.location.pathname.match(projects_edit_regexp)) document.getElementById("projects-link").classList.add("pure-menu-highlight");else if (window.location.pathname === "/admin/setups" || window.location.pathname === "/admin/setups/create" || window.location.pathname.match(setups_edit_regexp)) document.getElementById("setup-link").classList.add("pure-menu-highlight");
case "/admin/posts":
document.getElementById("posts-link").classList.add("pure-menu-highlight");
break;
case "/admin/now":
document.getElementById("now-link").classList.add("pure-menu-highlight");
break;
case "/admin/projects":
document.getElementById("proyectos-link").classList.add("pure-menu-highlight");
break;
case "/admin/setup":
document.getElementById("setup-link").classList.add("pure-menu-highlight");
break;
}
/***/ }), /***/ }),

24
public/js/app.js vendored
View File

@@ -94,29 +94,7 @@
/***/ (function(module, exports) { /***/ (function(module, exports) {
// Highlight links if in his page // Highlight links if in his page
switch (window.location.pathname) { if (window.location.pathname == "/blog" || window.location.pathname == "/blog.archive") document.getElementById("blog-link").classList.add("pure-menu-highlight");else if (window.location.pathname == "/now") document.getElementById("now-link").classList.add("pure-menu-highlight");else if (window.location.pathname == "/projects") document.getElementById("proyectos-link").classList.add("pure-menu-highlight");else if (window.location.pathname == "/setup") document.getElementById("setup-link").classList.add("pure-menu-highlight"); // Makes all images clickeable
case "/":
document.getElementById("title-link").classList.add("pure-menu-highlight");
break;
case "/blog":
case "/blog/archive":
document.getElementById("blog-link").classList.add("pure-menu-highlight");
break;
case "/now":
document.getElementById("now-link").classList.add("pure-menu-highlight");
break;
case "/projects":
document.getElementById("proyectos-link").classList.add("pure-menu-highlight");
break;
case "/setup":
document.getElementById("setup-link").classList.add("pure-menu-highlight");
break;
} // Makes all images clickeable
var images = document.getElementsByTagName("img"); var images = document.getElementsByTagName("img");

43
resources/js/admin.js vendored
View File

@@ -1,17 +1,32 @@
switch(window.location.pathname){ posts_edit_regexp = new RegExp("/admin/posts/\\d+/edit");
case "/admin": now_edit_regexp = new RegExp("/admin/now/\\d+/edit");
document.getElementById("title-link").classList.add("pure-menu-highlight"); projects_edit_regexp = new RegExp("/admin/projects/\\d+/edit");
break; setups_edit_regexp = new RegExp("/admin/setups/\\d+/edit");
case "/admin/posts":
if(
window.location.pathname === "/admin/posts" ||
window.location.pathname === "/admin/posts/create" ||
window.location.pathname.match(posts_edit_regexp)
)
document.getElementById("posts-link").classList.add("pure-menu-highlight"); document.getElementById("posts-link").classList.add("pure-menu-highlight");
break;
case "/admin/now": else if(
window.location.pathname === "/admin/now" ||
window.location.pathname === "/admin/now/create" ||
window.location.pathname.match(now_edit_regexp)
)
document.getElementById("now-link").classList.add("pure-menu-highlight"); document.getElementById("now-link").classList.add("pure-menu-highlight");
break;
case "/admin/projects": else if(
document.getElementById("proyectos-link").classList.add("pure-menu-highlight"); window.location.pathname === "/admin/projects" ||
break; window.location.pathname === "/admin/projects/create" ||
case "/admin/setup": window.location.pathname.match(projects_edit_regexp)
)
document.getElementById("projects-link").classList.add("pure-menu-highlight");
else if(
window.location.pathname === "/admin/setups" ||
window.location.pathname === "/admin/setups/create" ||
window.location.pathname.match(setups_edit_regexp)
)
document.getElementById("setup-link").classList.add("pure-menu-highlight"); document.getElementById("setup-link").classList.add("pure-menu-highlight");
break;
}

18
resources/js/app.js vendored
View File

@@ -1,22 +1,12 @@
// Highlight links if in his page // Highlight links if in his page
switch(window.location.pathname){ if(window.location.pathname == "/blog" || window.location.pathname == "/blog.archive")
case "/":
document.getElementById("title-link").classList.add("pure-menu-highlight");
break;
case "/blog":
case "/blog/archive":
document.getElementById("blog-link").classList.add("pure-menu-highlight"); document.getElementById("blog-link").classList.add("pure-menu-highlight");
break; else if(window.location.pathname == "/now")
case "/now":
document.getElementById("now-link").classList.add("pure-menu-highlight"); document.getElementById("now-link").classList.add("pure-menu-highlight");
break; else if(window.location.pathname == "/projects")
case "/projects":
document.getElementById("proyectos-link").classList.add("pure-menu-highlight"); document.getElementById("proyectos-link").classList.add("pure-menu-highlight");
break; else if(window.location.pathname == "/setup")
case "/setup":
document.getElementById("setup-link").classList.add("pure-menu-highlight"); document.getElementById("setup-link").classList.add("pure-menu-highlight");
break;
}
// Makes all images clickeable // Makes all images clickeable
var images = document.getElementsByTagName("img"); var images = document.getElementsByTagName("img");

View File

@@ -129,11 +129,11 @@ article {
=> Buttons & Links => Buttons & Links
*******************************************************************************/ *******************************************************************************/
.admin-link { .special-link {
color: $admin-color; color: $admin-color;
} }
.admin-link:hover{ .special-link:hover{
color: $admin-color; color: $admin-color;
border-bottom: 1px $admin-color solid; border-bottom: 1px $admin-color solid;
background-color: transparent; background-color: transparent;

View File

@@ -11,17 +11,16 @@
<a class="pure-menu-heading pure-menu-link" id="title-link" href="{{route('admin')}}">Admin</a> <a class="pure-menu-heading pure-menu-link" id="title-link" href="{{route('admin')}}">Admin</a>
<ul class="pure-menu-list"> <ul class="pure-menu-list">
<li class="pure-menu-item"><a class="pure-menu-link" id="posts-link" href="{{ route('admin.post.index') }}">Posts</a></li> <li class="pure-menu-item"><a class="pure-menu-link" id="posts-link" href="{{ route('admin.post.index') }}">Posts</a></li>
<li class="pure-menu-item"><a class="pure-menu-link" id="now-link"href="{{ route('admin.now.index') }}">Now</a></li> <li class="pure-menu-item"><a class="pure-menu-link" id="now-link" href="{{ route('admin.now.index') }}">Now</a></li>
<li class="pure-menu-item"><a class="pure-menu-link" id="setup-link"href="#">Setup</a></li>
<li class="pure-menu-item"><a class="pure-menu-link" id="projects-link"href="{{ route('admin.project.index') }}">Projects</a></li> <li class="pure-menu-item"><a class="pure-menu-link" id="projects-link"href="{{ route('admin.project.index') }}">Projects</a></li>
<li class="pure-menu-item"><a class="pure-menu-link" href="{{ route('index') }}">Volver</a></li> <li class="pure-menu-item"><a class="pure-menu-link" id="setup-link" href="{{ route('admin.setup.index') }}">Setups</a></li>
<li class="pure-menu-item"><a class="pure-menu-link special-link" href="{{ route('index') }}">Volver</a></li>
</ul> </ul>
</nav> </nav>
<div class="container"> <div class="container">
@yield('content') @yield('content')
</div> </div>
</div>
<script src="{{ asset('js/app.js') }}"></script> <script src="{{ asset('js/app.js') }}"></script>
<script src="{{ asset('js/admin.js') }}"></script> <script src="{{ asset('js/admin.js') }}"></script>

View File

@@ -9,13 +9,13 @@
@csrf @csrf
<fieldset> <fieldset>
<h1>Create Now</h1> <h1>Create Now</h1>
<a class="pure-button button-black-white" href="{{ route('admin.now.index') }}">Volver</a> <a class="pure-button button-black-white" href="{{ route('admin.now.index') }}">Back</a>
<label for="md">Contenido</label> <label for="md">Content</label>
<textarea id="md" name="md"></textarea> <textarea id="md" name="md"></textarea>
<div class="control"> <div class="control">
<button type="submit" class="pure-button button-black-white">Crear</button> <button type="submit" class="pure-button button-black-white">Create</button>
</div> </div>
</fieldset> </fieldset>
</form> </form>

View File

@@ -8,14 +8,14 @@
<form class="pure-form pure-form-stacked" action="{{ route('admin.now.update', ['now' => $now->id]) }}" method="post"> <form class="pure-form pure-form-stacked" action="{{ route('admin.now.update', ['now' => $now->id]) }}" method="post">
@csrf @csrf
<fieldset> <fieldset>
<h1>Editar Now</h1> <h1>Edit Now</h1>
<a href="{{ route('admin.now.index') }}" class="pure-button button-black-white">Volver</a> <a href="{{ route('admin.now.index') }}" class="pure-button button-black-white">Back</a>
<label for="md">Contenido</label> <label for="md">Content</label>
<textarea id="md" name="md">{{ old('md', $now->md) }}</textarea> <textarea id="md" name="md">{{ old('md', $now->md) }}</textarea>
<div class="control"> <div class="control">
<button type="submit" class="pure-button button-black-white">Actualizar</button> <button type="submit" class="pure-button button-black-white">Update</button>
</div> </div>
</fieldset> </fieldset>
</form> </form>

View File

@@ -3,13 +3,13 @@
@section('content') @section('content')
<div class="table-heading"> <div class="table-heading">
<h1>Now</h1> <h1>Now</h1>
<a class="pure-button button-black-white" href="{{ route('admin.now.create') }}">Create</a> <a class="pure-button button-black-white" href="{{ route('admin.now.create') }}">Create Now</a>
</div> </div>
<table class="pure-table"> <table class="pure-table">
<thead> <thead>
<tr> <tr>
<th>Id</th> <th>Id</th>
<th>Fecha</th> <th>Date</th>
<th></th> <th></th>
</tr> </tr>
</thead> </thead>

View File

@@ -8,17 +8,17 @@
<form class="pure-form pure-form-stacked" action="{{ route('admin.post.save') }}" method="post"> <form class="pure-form pure-form-stacked" action="{{ route('admin.post.save') }}" method="post">
@csrf @csrf
<fieldset> <fieldset>
<h1>Create post</h1> <h1>Create Post</h1>
<a class="pure-button button-black-white" href="{{ route('admin.post.index') }}">Volver</a> <a class="pure-button button-black-white" href="{{ route('admin.post.index') }}">Back</a>
<label for="title">Titulo</label> <label for="title">Title</label>
<input type="text" id="title" name="title" required/> <input type="text" id="title" name="title" required/>
<label for="md">Contenido</label> <label for="md">Content</label>
<textarea id="md" name="md"></textarea> <textarea id="md" name="md"></textarea>
<div class="control"> <div class="control">
<button class="pure-button button-black-white" type="submit">Crear</button> <button class="pure-button button-black-white" type="submit">Create</button>
</div> </div>
</fieldset> </fieldset>
</form> </form>

View File

@@ -9,16 +9,16 @@
@csrf @csrf
<fieldset> <fieldset>
<h1>Editar Post</h1> <h1>Editar Post</h1>
<a href="{{ route('admin.post.index') }}" class="pure-button button-black-white">Volver</a> <a href="{{ route('admin.post.index') }}" class="pure-button button-black-white">Back</a>
<label for="title">Titulo</label> <label for="title">Title</label>
<input type="text" id="title" name="title" value="{{ old('title', $post->title) }}" required/> <input type="text" id="title" name="title" value="{{ old('title', $post->title) }}" required/>
<label for="md">Contenido</label> <label for="md">Content</label>
<textarea id="md" name="md">{{ old('md', $post->md) }}</textarea> <textarea id="md" name="md">{{ old('md', $post->md) }}</textarea>
<div class="control"> <div class="control">
<button type="submit" class="pure-button button-black-white">Actualizar</button> <button type="submit" class="pure-button button-black-white">Update</button>
</div> </div>
</fieldset> </fieldset>
</form> </form>

View File

@@ -11,8 +11,8 @@
<thead> <thead>
<tr> <tr>
<th>Id</th> <th>Id</th>
<th>Titulo</th> <th>Title</th>
<th>Fecha</th> <th>Date</th>
<th></th> <th></th>
</tr> </tr>
</thead> </thead>

View File

@@ -9,16 +9,16 @@
@csrf @csrf
<fieldset> <fieldset>
<h1>Add Project</h1> <h1>Add Project</h1>
<a class="pure-button button-black-white" href="{{ route('admin.project.index') }}">Volver</a> <a class="pure-button button-black-white" href="{{ route('admin.project.index') }}">Back</a>
<label for="title">Titulo</label> <label for="title">Title</label>
<input type="text" id="title" name="title" required/> <input type="text" id="title" name="title" required/>
<label for="md">Descripcion</label> <label for="md">Description</label>
<textarea id="md" name="md"></textarea> <textarea id="md" name="md"></textarea>
<div class="control"> <div class="control">
<button class="pure-button button-black-white" type="submit">Crear</button> <button class="pure-button button-black-white" type="submit">Create</button>
</div> </div>
</fieldset> </fieldset>
</form> </form>

View File

@@ -9,16 +9,16 @@
@csrf @csrf
<fieldset> <fieldset>
<h1>Edit Project</h1> <h1>Edit Project</h1>
<a href="{{ route('admin.project.index') }}" class="pure-button button-black-white">Volver</a> <a href="{{ route('admin.project.index') }}" class="pure-button button-black-white">Back</a>
<label for="title">Titulo</label> <label for="title">Title</label>
<input type="text" class="form-input" id="title" name="title" value="{{ old('title', $project->title) }}" required/> <input type="text" class="form-input" id="title" name="title" value="{{ old('title', $project->title) }}" required/>
<label for="md">Descripcion</label> <label for="md">Description</label>
<textarea class="form-input" id="md" name="md">{{ old('md', $project->md) }}</textarea> <textarea class="form-input" id="md" name="md">{{ old('md', $project->md) }}</textarea>
<div class="control"> <div class="control">
<button type="submit" class="pure-button button-black-white">Actualizar</button> <button type="submit" class="pure-button button-black-white">Back</button>
</div> </div>
</fieldset> </fieldset>
</form> </form>

View File

@@ -14,8 +14,8 @@
<thead> <thead>
<tr> <tr>
<th>Id</th> <th>Id</th>
<th>Titulo</th> <th>Title</th>
<th>Fecha</th> <th>Date</th>
<th></th> <th></th>
</tr> </tr>
</thead> </thead>

View File

@@ -0,0 +1,25 @@
@extends('admin.base')
@section('title')
<h1>Add Setup</h1>
@endsection
@section('content')
<form class="pure-form pure-form-stacked" action="{{ route('admin.setup.save') }}" method="post">
@csrf
<fieldset>
<h1>Add Setup</h1>
<a class="pure-button button-black-white" href="{{ route('admin.setup.index') }}">Back</a>
<label for="title">Title</label>
<input type="text" id="title" name="title" required/>
<label for="md">Content</label>
<textarea id="md" name="md"></textarea>
<div class="control">
<button class="pure-button button-black-white" type="submit">Create</button>
</div>
</fieldset>
</form>
@endsection

View File

@@ -0,0 +1,25 @@
@extends('admin.base')
@section('title')
<h1>Edit Setup</h1>
@endsection
@section('content')
<form class="pure-form pure-form-stacked" action="{{ route('admin.setup.update', ['setup' => $setup->id]) }}" method="post">
@csrf
<fieldset>
<h1>Edit Setup</h1>
<a href="{{ route('admin.setup.index') }}" class="pure-button button-black-white">Back</a>
<label for="title">Title</label>
<input type="text" id="title" name="title" value="{{ old('title', $setup->title) }}" required/>
<label for="md">Content</label>
<textarea id="md" name="md">{{ old('md', $setup->md) }}</textarea>
<div class="control">
<button type="submit" class="pure-button button-black-white">Update</button>
</div>
</fieldset>
</form>
@endsection

View File

@@ -0,0 +1,36 @@
@extends('admin.base')
@section('content')
<div class="table-heading">
<h1>Setups</h1>
<a class="pure-button button-black-white" href="{{ route('admin.setup.create') }}">Add Setup</a>
</div>
<table class="pure-table">
<thead>
<tr>
<th>Id</th>
<th>Title</th>
<th>Date</th>
<th></th>
</tr>
</thead>
<tbody>
@foreach($setups as $setup)
<tr>
<td>{{$setup->id}}</td>
<td>{{ Str::limit($setup->title, 30, "...") }}</td>
<td>{{$setup->created_at->format('Y-m-d')}}</td>
<td class="controls">
<a href="{{ route('admin.setup.edit', ['setup' => $setup->id]) }}" class="pure-button button-black-white">Edit</a>
<form action={{ route('admin.setup.delete', ['setup' => $setup->id]) }} method="post">
@csrf
<button type="submit" class="pure-button button-black-white" onclick="return confirm('Estas seguro?')">Delete</button>
</form>
</td>
</tr>
@endforeach
</tbody>
</table>
@endsection

View File

@@ -19,14 +19,14 @@
<a class="pure-menu-link" id="now-link" href="{{route('now.index')}}">Now</a> <a class="pure-menu-link" id="now-link" href="{{route('now.index')}}">Now</a>
</li> </li>
<li class="pure-menu-item"> <li class="pure-menu-item">
<a class="pure-menu-link" id="proyectos-link" href="{{route('project.index')}}">Proyectos</a> <a class="pure-menu-link" id="proyectos-link" href="{{route('project.index')}}">Projects</a>
</li> </li>
<li class="pure-menu-item"> <li class="pure-menu-item">
<a class="pure-menu-link" id="setup-link" href="{{route('setup')}}">Setup</a> <a class="pure-menu-link" id="setup-link" href="{{route('setups.index')}}">Setups</a>
</li> </li>
@auth @auth
<li class="pure-menu-item"> <li class="pure-menu-item">
<a class="pure-menu-link admin-link" href="{{route('admin')}}">Admin</a> <a class="pure-menu-link special-link" href="{{route('admin')}}">Admin</a>
</li> </li>
@endauth @endauth
</ul> </ul>

View File

@@ -12,8 +12,7 @@
</header> </header>
{!! $parse->text($project->md) !!} {!! $parse->text($project->md) !!}
</article>
</section>
@endforeach @endforeach
<hr/> <hr/>
@endsection @endsection

View File

@@ -1,5 +0,0 @@
@extends('base')
@section('content')
<h1>Setup</h1>
@endsection

View File

@@ -0,0 +1,16 @@
@extends('base')
@php
$parse = new Parsedown();
@endphp
@section('content')
@foreach($setups as $setup)
<article>
<header>
<h1>{{$setup->title}}</h1>
</header>
{!! $parse->text($setup->md) !!}
</article>
@endforeach
@endsection

View File

@@ -0,0 +1,15 @@
@extends('base')
@php
$parse = new Parsedown();
@endphp
@section('content')
<article>
<header>
<h1>{{$setup->title}}</h1>
</header>
{!! $parse->text($setup->md) !!}
</article>
<hr/>
@endsection

View File

@@ -7,6 +7,8 @@ Route::get('/now', 'NowController@index')->name('now.index');
Route::get('/projects', 'ProjectController@index')->name('project.index'); Route::get('/projects', 'ProjectController@index')->name('project.index');
Route::get('/setups', 'SetupController@index')->name('setups.index');
Route::prefix('blog')->group(function() { Route::prefix('blog')->group(function() {
Route::get('/', 'BlogController@index')->name('blog.index'); Route::get('/', 'BlogController@index')->name('blog.index');
Route::get('archive', 'BlogController@archive')->name('blog.archive'); Route::get('archive', 'BlogController@archive')->name('blog.archive');
@@ -45,6 +47,15 @@ Route::middleware('auth')->group(function() {
Route::post('{post}/edit', 'ProjectController@update')->name('admin.project.update'); Route::post('{post}/edit', 'ProjectController@update')->name('admin.project.update');
Route::post('{post}/delete', 'ProjectController@delete')->name('admin.project.delete'); Route::post('{post}/delete', 'ProjectController@delete')->name('admin.project.delete');
}); });
Route::prefix('setups')->group(function() {
Route::get('/', 'AdminController@setups')->name('admin.setup.index');
Route::get('create', 'SetupController@create')->name('admin.setup.create');
Route::post('create', 'SetupController@save')->name('admin.setup.save');
Route::get('{setup}/edit', 'SetupController@edit')->name('admin.setup.edit');
Route::post('{setup}/edit', 'SetupController@update')->name('admin.setup.update');
Route::post('{setup}/delete', 'SetupController@delete')->name('admin.setup.delete');
});
}); });
}); });