Add Encart settings
This commit is contained in:
parent
2249eac2b1
commit
1bee6fd514
8 changed files with 173 additions and 1 deletions
10
app/Http/Controllers/Bo/EncartsController.php
Normal file
10
app/Http/Controllers/Bo/EncartsController.php
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class EncartsController extends Controller
|
||||
{
|
||||
//
|
||||
}
|
||||
30
app/Http/Requests/StoreEncartRequest.php
Normal file
30
app/Http/Requests/StoreEncartRequest.php
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class StoreEncartRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
}
|
||||
30
app/Http/Requests/UpdateEncartRequest.php
Normal file
30
app/Http/Requests/UpdateEncartRequest.php
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class UpdateEncartRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
}
|
||||
16
app/Models/Encart.php
Normal file
16
app/Models/Encart.php
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Enums\Page;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Encart extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
public $castEnums = [
|
||||
'page' => Page::class
|
||||
];
|
||||
}
|
||||
32
database/factories/EncartFactory.php
Normal file
32
database/factories/EncartFactory.php
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\Encart;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class EncartFactory extends Factory
|
||||
{
|
||||
|
||||
protected $model = Encart::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
'title' => $this->faker->words(5),
|
||||
'title' => $this->faker->words(5),
|
||||
'text' => $this->faker->realText(25),
|
||||
'link_label' => $this->faker->text(128),
|
||||
'link' => route('wasup'),
|
||||
'link_new_tab' => rand(0, 1),
|
||||
'date_start' => Carbon::now(),
|
||||
'date_end' => Carbon::now()->addDays(2),
|
||||
'picture' => new SplFileInfo(resource_path('assets/images/image-sample.jpg'))
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateEncartsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('encarts', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->smallInteger('page');
|
||||
$table->string('title');
|
||||
$table->string('subtitle');
|
||||
$table->string('text');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('encarts');
|
||||
}
|
||||
}
|
||||
|
|
@ -16,7 +16,8 @@ class DatabaseSeeder extends Seeder
|
|||
$this->call([
|
||||
|
||||
UserSeeder::class,
|
||||
SlidersSeeder::class
|
||||
SlidersSeeder::class,
|
||||
EncartsSeeder::class,
|
||||
|
||||
]);
|
||||
}
|
||||
|
|
|
|||
18
database/seeders/EncartsSeeder.php
Normal file
18
database/seeders/EncartsSeeder.php
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class EncartSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue