<?php
namespace App\Http\Controllers;
use Carbon\Carbon;
use Corcel\Model\Post;
use Corcel\Model\Menu;
use Corcel\Model\Option;
class PostController extends Controller {
public function index() {
$menu = Menu::slug('menu-principal')->first();
$posts = Post::status('publish')->type('post')->newest()->paginate(5);
$options = Option::asArray();
return view('index', compact('menu', 'posts', 'options'));
}
public function post($slug) {
$options = Option::asArray();
$menu = Menu::slug('menu-principal')->first();
$post = Post::where('post_name', $slug)->first();
$subhead = 'Publicado';
if ($post) {
if ($post->author) {
$subhead .= ' por ' . $post->author->display_name;
}
$subhead .= ' el ' . Carbon::createFromFormat('Y - m - d H:i:s', $post->post_modified_gmt)->format('d / m / Y');
}
return view('post', compact('options', 'menu', 'post', 'subhead'));
}
}
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Post extends Model
{
use HasFactory;
}
<?php
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\PostController;
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
Route::get('/', [PostController::class,'index'])->name('index');
Route::get('/{id}', [PostController::class,'post'])->name('post');
<IfModule mod_rewrite.c>
RewriteEngine Off
</IfModule>
<?php
/**
* The base configuration for WordPress
*
* The wp-config.php creation script uses this file during the installation.
* You don't have to use the web site, you can copy this file to "wp-config.php"
* and fill in the values.
*
* This file contains the following configurations:
*
* * Database settings
* * Secret keys
* * Database table prefix
* * ABSPATH
*
* @link https://wordpress.org/support/article/editing-wp-config-php/
*
* @package WordPress
*/
// ** Database settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'corcel');
/** MySQL database username */
define('DB_USER', 'root');
/** MySQL database password */
define('DB_PASSWORD', '');
/** Config the front-end url */
define('WP_HOME', 'https://oec.wayarmy.net');
/** Config the admin url */
define('WP_SITEURL', 'https://oec.wayarmy.net/admin');
/** Database hostname */
define( 'DB_HOST', 'localhost' );
/** Database charset to use in creating database tables. */
define( 'DB_CHARSET', 'utf8' );
/** The database collate type. Don't change this if in doubt. */
define( 'DB_COLLATE', '' );
/**#@+
* Authentication unique keys and salts.
*
* Change these to different unique phrases! You can generate these using
* the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}.
*
* You can change these at any point in time to invalidate all existing cookies.
* This will force all users to have to log in again.
*
* @since 2.6.0
*/
define( 'AUTH_KEY', '/9/^WAsfTE(2!ZCyD9ym$?}IqK>L1&8`y]y~vvOjl90vP?7=COe$<R9WH*}K$TgQ' );
define( 'SECURE_AUTH_KEY', '1&EDWWRlzZ?/#z|/sOMB4/<[W$%uN~VTFf=h0FC.v2J.r[ z-E|eT3::(`m??:I-' );
define( 'LOGGED_IN_KEY', '_7 m?(o3s_ja7vv~guzN.#&Q28R$_dV&R^$?D0vi%*@IZ4i^<8ZzWCTApaU C`D ' );
define( 'NONCE_KEY', 'RUJCg^no1SZsd@kw~|#RB*r<p{C4A{F5ef^9-ov>GW_`.{eishp|)%rhI<LKq^V2' );
define( 'AUTH_SALT', '5t%dw,y>a631:T}{GMWf+yDp#i!86o];W#-{vmsg=?8!eb+X^N`GyY{;6B]NqW7Y' );
define( 'SECURE_AUTH_SALT', '!.C~RVXk%i%c<awK:y&_gz4T0Z?!SE+l*H$lL?H_e]QE3mt,Ihjb]IZX-=A|P7q7' );
define( 'LOGGED_IN_SALT', 'Mro1#5j~]!cps-w}SiLCOV}CL(d&#g&s{v|]_6onOP6O-&)Wb/Caylo0eZg^}39*' );
define( 'NONCE_SALT', 'c0;mxhJ 7neo!+:r{!%6dI8H`onNcw/%d8%xNg>-^ JRCE2!C^eFJ,#2t3u?klvw' );
/**#@-*/
/**
* WordPress database table prefix.
*
* You can have multiple installations in one database if you give each
* a unique prefix. Only numbers, letters, and underscores please!
*/
$table_prefix = 'wp_';
/**
* For developers: WordPress debugging mode.
*
* Change this to true to enable the display of notices during development.
* It is strongly recommended that plugin and theme developers use WP_DEBUG
* in their development environments.
*
* For information on other constants that can be used for debugging,
* visit the documentation.
*
* @link https://wordpress.org/support/article/debugging-in-wordpress/
*/
define( 'WP_DEBUG', false );
/* Add any custom values between this line and the "stop editing" line. */
/* That's all, stop editing! Happy publishing. */
/** Absolute path to the WordPress directory. */
if ( ! defined( 'ABSPATH' ) ) {
define( 'ABSPATH', __DIR__ . '/' );
}
/** Sets up WordPress vars and included files. */
require_once ABSPATH . 'wp-settings.php';