uff muchas cosas, agrege projecto y setup
This commit is contained in:
@@ -5,6 +5,7 @@ namespace App\Http\Controllers;
|
||||
use App\Post;
|
||||
use App\Now;
|
||||
use App\Project;
|
||||
use App\Setup;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class AdminController extends Controller
|
||||
@@ -28,4 +29,9 @@ class AdminController extends Controller
|
||||
{
|
||||
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()]);
|
||||
}
|
||||
}
|
||||
|
||||
51
app/Http/Controllers/SetupController.php
Normal file
51
app/Http/Controllers/SetupController.php
Normal 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');
|
||||
}
|
||||
}
|
||||
@@ -7,9 +7,4 @@ use Illuminate\Database\Eloquent\Model;
|
||||
class Project extends Model
|
||||
{
|
||||
protected $table = 'projects';
|
||||
|
||||
public function photos()
|
||||
{
|
||||
return $this->hasMany('App\ProjectPhoto');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
10
app/Setup.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Setup extends Model
|
||||
{
|
||||
protected $tablename = "setups";
|
||||
}
|
||||
13
database/factories/ProjectsFactory.php
Normal file
13
database/factories/ProjectsFactory.php
Normal 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)
|
||||
];
|
||||
});
|
||||
13
database/factories/SetupFactory.php
Normal file
13
database/factories/SetupFactory.php
Normal 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)
|
||||
];
|
||||
});
|
||||
@@ -28,7 +28,7 @@ class CreateBaseDb extends Migration
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::create('setup', function(Blueprint $table) {
|
||||
Schema::create('setups', function(Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->string('title');
|
||||
$table->longText('md');
|
||||
@@ -41,5 +41,6 @@ class CreateBaseDb extends Migration
|
||||
Schema::dropIfExists('projects');
|
||||
Schema::dropIfExists('now');
|
||||
Schema::dropIfExists('posts');
|
||||
Schema::dropIfExists('setups');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,5 +8,7 @@ class DatabaseSeeder extends Seeder
|
||||
{
|
||||
$this->call(PostTableSeeder::class);
|
||||
$this->call(NowTableSeeder::class);
|
||||
$this->call(SetupTableSeeder::class);
|
||||
$this->call(ProjectTableSeeder::class);
|
||||
}
|
||||
}
|
||||
|
||||
11
database/seeds/ProjectTableSeeder.php
Normal file
11
database/seeds/ProjectTableSeeder.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class ProjectTableSeeder extends Seeder
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
factory(App\Project::class, 50)->create();
|
||||
}
|
||||
}
|
||||
11
database/seeds/SetupTableSeeder.php
Normal file
11
database/seeds/SetupTableSeeder.php
Normal 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
4
public/css/app.css
vendored
@@ -1610,11 +1610,11 @@ article {
|
||||
=> Buttons & Links
|
||||
*******************************************************************************/
|
||||
|
||||
.admin-link {
|
||||
.special-link {
|
||||
color: #ee1155;
|
||||
}
|
||||
|
||||
.admin-link:hover {
|
||||
.special-link:hover {
|
||||
color: #ee1155;
|
||||
border-bottom: 1px #ee1155 solid;
|
||||
background-color: transparent;
|
||||
|
||||
26
public/js/admin.js
vendored
26
public/js/admin.js
vendored
@@ -93,27 +93,11 @@
|
||||
/*! no static exports found */
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
switch (window.location.pathname) {
|
||||
case "/admin":
|
||||
document.getElementById("title-link").classList.add("pure-menu-highlight");
|
||||
break;
|
||||
|
||||
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;
|
||||
}
|
||||
posts_edit_regexp = new RegExp("/admin/posts/\\d+/edit");
|
||||
now_edit_regexp = new RegExp("/admin/now/\\d+/edit");
|
||||
projects_edit_regexp = new RegExp("/admin/projects/\\d+/edit");
|
||||
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");
|
||||
|
||||
/***/ }),
|
||||
|
||||
|
||||
24
public/js/app.js
vendored
24
public/js/app.js
vendored
@@ -94,29 +94,7 @@
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
// Highlight links if in his page
|
||||
switch (window.location.pathname) {
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
var images = document.getElementsByTagName("img");
|
||||
|
||||
|
||||
43
resources/js/admin.js
vendored
43
resources/js/admin.js
vendored
@@ -1,17 +1,32 @@
|
||||
switch(window.location.pathname){
|
||||
case "/admin":
|
||||
document.getElementById("title-link").classList.add("pure-menu-highlight");
|
||||
break;
|
||||
case "/admin/posts":
|
||||
posts_edit_regexp = new RegExp("/admin/posts/\\d+/edit");
|
||||
now_edit_regexp = new RegExp("/admin/now/\\d+/edit");
|
||||
projects_edit_regexp = new RegExp("/admin/projects/\\d+/edit");
|
||||
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");
|
||||
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");
|
||||
break;
|
||||
case "/admin/projects":
|
||||
document.getElementById("proyectos-link").classList.add("pure-menu-highlight");
|
||||
break;
|
||||
case "/admin/setup":
|
||||
|
||||
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");
|
||||
break;
|
||||
}
|
||||
|
||||
18
resources/js/app.js
vendored
18
resources/js/app.js
vendored
@@ -1,22 +1,12 @@
|
||||
// Highlight links if in his page
|
||||
switch(window.location.pathname){
|
||||
case "/":
|
||||
document.getElementById("title-link").classList.add("pure-menu-highlight");
|
||||
break;
|
||||
case "/blog":
|
||||
case "/blog/archive":
|
||||
if(window.location.pathname == "/blog" || window.location.pathname == "/blog.archive")
|
||||
document.getElementById("blog-link").classList.add("pure-menu-highlight");
|
||||
break;
|
||||
case "/now":
|
||||
else if(window.location.pathname == "/now")
|
||||
document.getElementById("now-link").classList.add("pure-menu-highlight");
|
||||
break;
|
||||
case "/projects":
|
||||
else if(window.location.pathname == "/projects")
|
||||
document.getElementById("proyectos-link").classList.add("pure-menu-highlight");
|
||||
break;
|
||||
case "/setup":
|
||||
else if(window.location.pathname == "/setup")
|
||||
document.getElementById("setup-link").classList.add("pure-menu-highlight");
|
||||
break;
|
||||
}
|
||||
|
||||
// Makes all images clickeable
|
||||
var images = document.getElementsByTagName("img");
|
||||
|
||||
4
resources/sass/app.scss
vendored
4
resources/sass/app.scss
vendored
@@ -129,11 +129,11 @@ article {
|
||||
=> Buttons & Links
|
||||
*******************************************************************************/
|
||||
|
||||
.admin-link {
|
||||
.special-link {
|
||||
color: $admin-color;
|
||||
}
|
||||
|
||||
.admin-link:hover{
|
||||
.special-link:hover{
|
||||
color: $admin-color;
|
||||
border-bottom: 1px $admin-color solid;
|
||||
background-color: transparent;
|
||||
|
||||
@@ -12,16 +12,15 @@
|
||||
<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="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" 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>
|
||||
</nav>
|
||||
|
||||
<div class="container">
|
||||
@yield('content')
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="{{ asset('js/app.js') }}"></script>
|
||||
<script src="{{ asset('js/admin.js') }}"></script>
|
||||
|
||||
@@ -9,13 +9,13 @@
|
||||
@csrf
|
||||
<fieldset>
|
||||
<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>
|
||||
|
||||
<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>
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
@@ -8,14 +8,14 @@
|
||||
<form class="pure-form pure-form-stacked" action="{{ route('admin.now.update', ['now' => $now->id]) }}" method="post">
|
||||
@csrf
|
||||
<fieldset>
|
||||
<h1>Editar Now</h1>
|
||||
<a href="{{ route('admin.now.index') }}" class="pure-button button-black-white">Volver</a>
|
||||
<h1>Edit Now</h1>
|
||||
<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>
|
||||
|
||||
<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>
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
@section('content')
|
||||
<div class="table-heading">
|
||||
<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>
|
||||
<table class="pure-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Id</th>
|
||||
<th>Fecha</th>
|
||||
<th>Date</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
@@ -8,17 +8,17 @@
|
||||
<form class="pure-form pure-form-stacked" action="{{ route('admin.post.save') }}" method="post">
|
||||
@csrf
|
||||
<fieldset>
|
||||
<h1>Create post</h1>
|
||||
<a class="pure-button button-black-white" href="{{ route('admin.post.index') }}">Volver</a>
|
||||
<h1>Create Post</h1>
|
||||
<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/>
|
||||
|
||||
<label for="md">Contenido</label>
|
||||
<label for="md">Content</label>
|
||||
<textarea id="md" name="md"></textarea>
|
||||
|
||||
<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>
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
@@ -9,16 +9,16 @@
|
||||
@csrf
|
||||
<fieldset>
|
||||
<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/>
|
||||
|
||||
<label for="md">Contenido</label>
|
||||
<label for="md">Content</label>
|
||||
<textarea id="md" name="md">{{ old('md', $post->md) }}</textarea>
|
||||
|
||||
<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>
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Id</th>
|
||||
<th>Titulo</th>
|
||||
<th>Fecha</th>
|
||||
<th>Title</th>
|
||||
<th>Date</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
@@ -9,16 +9,16 @@
|
||||
@csrf
|
||||
<fieldset>
|
||||
<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/>
|
||||
|
||||
<label for="md">Descripcion</label>
|
||||
<label for="md">Description</label>
|
||||
<textarea id="md" name="md"></textarea>
|
||||
|
||||
<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>
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
@@ -9,16 +9,16 @@
|
||||
@csrf
|
||||
<fieldset>
|
||||
<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/>
|
||||
|
||||
<label for="md">Descripcion</label>
|
||||
<label for="md">Description</label>
|
||||
<textarea class="form-input" id="md" name="md">{{ old('md', $project->md) }}</textarea>
|
||||
|
||||
<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>
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Id</th>
|
||||
<th>Titulo</th>
|
||||
<th>Fecha</th>
|
||||
<th>Title</th>
|
||||
<th>Date</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
25
resources/views/admin/setups/create.blade.php
Normal file
25
resources/views/admin/setups/create.blade.php
Normal 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
|
||||
25
resources/views/admin/setups/edit.blade.php
Normal file
25
resources/views/admin/setups/edit.blade.php
Normal 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
|
||||
36
resources/views/admin/setups/index.blade.php
Normal file
36
resources/views/admin/setups/index.blade.php
Normal 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
|
||||
@@ -19,14 +19,14 @@
|
||||
<a class="pure-menu-link" id="now-link" href="{{route('now.index')}}">Now</a>
|
||||
</li>
|
||||
<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 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>
|
||||
@auth
|
||||
<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>
|
||||
@endauth
|
||||
</ul>
|
||||
|
||||
@@ -12,8 +12,7 @@
|
||||
</header>
|
||||
|
||||
{!! $parse->text($project->md) !!}
|
||||
|
||||
</section>
|
||||
</article>
|
||||
@endforeach
|
||||
<hr/>
|
||||
@endsection
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
@extends('base')
|
||||
|
||||
@section('content')
|
||||
<h1>Setup</h1>
|
||||
@endsection
|
||||
16
resources/views/setups/index.blade.php
Normal file
16
resources/views/setups/index.blade.php
Normal 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
|
||||
15
resources/views/setups/show.blade.php
Normal file
15
resources/views/setups/show.blade.php
Normal 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
|
||||
@@ -7,6 +7,8 @@ Route::get('/now', 'NowController@index')->name('now.index');
|
||||
|
||||
Route::get('/projects', 'ProjectController@index')->name('project.index');
|
||||
|
||||
Route::get('/setups', 'SetupController@index')->name('setups.index');
|
||||
|
||||
Route::prefix('blog')->group(function() {
|
||||
Route::get('/', 'BlogController@index')->name('blog.index');
|
||||
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}/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');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user