I am beginner in Laravel. I use in my project Laravel 5.8.
I have problem with textpages.
TextPages model
class TextPages extends Model
{
protected $quarded = [];
protected $fillable = ['company_id', 'enable', 'system', 'page_type', 'page_type2', 'page_type3', 'page_type4', 'page_type5', 'id_category_page', 'id_category_page2', 'id_category_page3', 'id_category_page4', 'id_category_page5', 'id_categories_of_photos', 'author_add', 'author_update', 'title_on_the_list', 'visible_on_the_top_menu', 'visible_on_the_left_menu', 'visible_on_promo_box', 'date', 'hideData', 'dateToShow', 'title', 'description', 'keywords', 'short_content', 'content', 'url_address'];
}
Schema:
Schema::create('text_pages', function (Blueprint $table) {
$table->bigIncrements('id');
$table->bigInteger('company_id')->unsigned();
$table->foreign('company_id')->references('id')->on('companies')->onDelete('cascade');
$table->boolean('enable')->default(0);
$table->boolean('system')->default(0);
$table->bigInteger('page_type')->default(0);
$table->bigInteger('page_type2')->default(0);
$table->bigInteger('page_type3')->default(0);
$table->bigInteger('page_type4')->default(0);
$table->bigInteger('page_type5')->default(0);
$table->bigInteger('id_category_page')->default(0);
$table->bigInteger('id_category_page2')->default(0);
$table->bigInteger('id_category_page3')->default(0);
$table->bigInteger('id_category_page4')->default(0);
$table->bigInteger('id_category_page5')->default(0);
$table->bigInteger('id_gallery')->default(0);
$table->bigInteger('author_add')->default(0);
$table->bigInteger('author_update')->default(0);
$table->string('title_on_the_list', 200);
$table->boolean('visible_on_the_top_menu')->default(0);
$table->boolean('visible_on_the_left_menu')->default(0);
$table->boolean('visible_on_promo_box')->default(0);
$table->date('date');
$table->string('file', 160)->nullable();
$table->boolean('hideData')->default(0);
$table->date('dateToShow')->nullable();
$table->string('title', 200);
$table->string('description', 155);
$table->string('keywords', 155);
$table->longText('short_content')->nullable();
$table->longText('content')->nullable();
$table->string('url_address', 160)->nullable();
$table->timestamps();
$table->engine = "InnoDB";
});
web.php
Route::get('/', 'FrontendController@index')->name('index');
Route::get('/index', 'FrontendController@index')->name('index');
Route::post('/acceptUserAge', 'FrontendController@acceptUserAge')->name('acceptUserAge');
Route::get('/p/{slug}', 'FrontendController@txtPages')->name('txtPages');
// access only fro user with role USER
Route::group(['prefix' => 'admin'], function () {
Route::get('/', 'BackendController@index')->name('adminHome')->middleware(['CheckRole:user,userPremium,userCompany,userSponsor,UserGuest']);
});
// access only fro user with role ADMIN
Route::get('cms/', 'CMSController@index')->name('indexAdmin');
Route::get('cms/login', 'CMSController@loginAdmin')->name('loginAdmin');
Route::group(['prefix' => 'cms', 'middleware' => 'auth'], function () {
Route::get('/adminLoginHistory', 'CMSController@adminLoginHistory')->name('adminLoginHistory')->middleware(['CheckRole:admin,telemarketer,receptionist,adminCompany'])->middleware('verified');
Route::get('/paymentRegister', 'CMSController@paymentRegister')->name('paymentRegister')->middleware(['CheckRole:admin'])->middleware('verified');
Route::match(['GET'], '/paymentRegisterEdit' . '/{id}', 'CMSController@paymentRegisterEdit')->name('paymentRegisterEdit')->middleware(['CheckRole:admin'])->middleware('verified');
});
Auth::routes(['verify' => true]);
Currently, I use route to display text pages:
Route::get('/p/{slug}', 'FrontendController@txtPages')->name('txtPages');
Website address: name.com/p/page-name
I need to do a routing for pages, but without this "/ p" in the URL - I would like to reach the url for text pages: name.com/page-name
Pages are dynamically created in CMS.
How to do it?
from Newest questions tagged laravel-5 - Stack Overflow http://bit.ly/2IvFLXs
via IFTTT
Aucun commentaire:
Enregistrer un commentaire