ifox
09/24/2021, 7:38 AM`Sebastlan
09/24/2021, 7:39 AM`Sebastlan
09/24/2021, 7:40 AM`Sebastlan
09/24/2021, 7:40 AMifox
09/24/2021, 7:44 AM`Sebastlan
09/24/2021, 7:48 AM`Sebastlan
09/24/2021, 7:49 AMBaymac
09/24/2021, 8:01 AMphp artisan migrate. Any ideas? Do I need to do this?
Migrating: 2019_02_17_173805_create_twill_users_tables
Illuminate\Database\QueryException
SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'twill_users' already exists`Sebastlan
09/24/2021, 8:54 AM`Sebastlan
09/24/2021, 8:54 AMchrispymm
09/24/2021, 9:01 AMchrispymm
09/24/2021, 9:02 AMchrispymm
09/24/2021, 9:03 AM`Sebastlan
09/24/2021, 10:52 AM`Sebastlan
09/24/2021, 10:53 AM`Sebastlan
09/24/2021, 10:53 AM`Sebastlan
09/24/2021, 11:40 AM`Sebastlan
09/24/2021, 11:41 AM<?php
namespace App\Http\Controllers;
use App\Repositories\PostRepository;
use Illuminate\Http\Request;
class PostController extends Controller
{
public function __construct(PostRepository $repository)
{
$this->repository = $repository;
}
public function index()
{
// $posts = Post::where('published', '1')->get();
return view('blog.index', [
'posts' => $this->repository->blog()
]);
}
public function show($slug)
{
$post = $this->repository->forSlug($slug);
abort_unless($post, 404, 'Post');
return view('blog.show', compact('post'));
}
}`Sebastlan
09/24/2021, 11:41 AM<?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\HandleTags;
use A17\Twill\Repositories\Behaviors\HandleRevisions;
use A17\Twill\Repositories\ModuleRepository;
use App\Models\Post;
class PostRepository extends ModuleRepository
{
use HandleBlocks, HandleTranslations, HandleSlugs, HandleMedias, HandleTags, HandleRevisions;
public function __construct(Post $model)
{
$this->model = $model;
}
public function blog()
{
return $this->model->published()->orderBy('created_at', 'desc')->get();
}
}`Sebastlan
09/24/2021, 11:42 AM<?php
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\PageController;
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('/', function () {
return view('home');
});
// podstrony
Route::get('/{slug}', [PageController::class, 'show']);
// blog
Route::prefix('blog')->group(function () {
Route::get('/', [PostController::class, 'index']);
Route::get('/{slug}', [PostController::class, 'show']);
});
// Route::get('/blog/{slug}', [PostController::class, 'show']);
// Route::get('/blog', [PostController::class, 'index']);pboivin
09/24/2021, 12:01 PMpboivin
09/24/2021, 12:11 PMRoute::get('/{slug}', ...); is too generic. It should probably be declared last, otherwise it would have precedence over e.g. /blog.`Sebastlan
09/24/2021, 1:05 PMpboivin
09/24/2021, 1:08 PM`Sebastlan
09/24/2021, 1:10 PM`Sebastlan
09/24/2021, 1:10 PM`Sebastlan
09/24/2021, 1:10 PMdomihagen
09/24/2021, 2:10 PMforSlug('some-slug') as wrong after updating to 2.5.2. So i checked the HandleSlugs.php where the DocBlock says $slug (first Parameter) has to be of type Array instead of string. Is my Method-Call wrong or just the DocBlock? forSlugPreview is the same.pboivin
09/24/2021, 2:14 PMdomihagen
09/24/2021, 2:16 PM