96 lines
2.7 KiB
PHP
96 lines
2.7 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\bo;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Support\Str;
|
|
use App\Models\HomeSliderPictures;
|
|
|
|
class HomeSliderPicturesController extends Controller
|
|
{
|
|
public function index()
|
|
{
|
|
//
|
|
}
|
|
|
|
public function create()
|
|
{
|
|
return view('bo.home-slider-pictures.create');
|
|
}
|
|
|
|
public function store(Request $request)
|
|
{
|
|
$catchPhrase = $request->catch_phrase;
|
|
$catchColor = $request->catch_color;
|
|
$title = $request->title;
|
|
$titleColor = $request->title_color;
|
|
$picture = $request->picture;
|
|
$picture_r = $request->picture_r;
|
|
$linkLabel = $request->link_label;
|
|
$link = $request->link;
|
|
$linkColor = $request->link_color;
|
|
$newTab = $request->new_tab === null ? 0 : 1;
|
|
$day1 = $request->day1 === null ? 0 : 1;
|
|
$day2 = $request->day2 === null ? 0 : 1;
|
|
$day3 = $request->day3 === null ? 0 : 1;
|
|
$day4 = $request->day4 === null ? 0 : 1;
|
|
$day5 = $request->day5 === null ? 0 : 1;
|
|
$day6 = $request->day6 === null ? 0 : 1;
|
|
$day7 = $request->day7 === null ? 0 : 1;
|
|
$status = 0;
|
|
|
|
$request->validate([
|
|
'picture' => 'required|image|mimes:jpeg,png,jpg|max:2048|dimensions:width=1366,height=553',
|
|
'picture_r' => 'required|image|mimes:jpeg,png,jpg|max:2048|dimensions:width=500,height=671',
|
|
]);
|
|
|
|
$imageName = Str::slug($title) .'.'.$picture->extension();
|
|
$picture->move(public_path('images/slider_accueil'), $imageName);
|
|
$imageName_r = Str::slug($title) .'_r.'.$picture_r->extension();
|
|
$picture_r->move(public_path('images/slider_accueil'), $imageName_r);
|
|
|
|
$hsp = new HomeSlidePictures();
|
|
$hsp->catch_phrase = $catchPhrase;
|
|
$hsp->catch_color = $catchColor;
|
|
$hsp->title = $title;
|
|
$hsp->title_color = $titleColor;
|
|
$hsp->picture = $imageName;
|
|
$hsp->picture_r = $imageName_r;
|
|
$hsp->link_label = $linkLabel;
|
|
$hsp->link = $link;
|
|
$hsp->link_color = $linkColor;
|
|
$hsp->new_tab = $newTab;
|
|
$hsp->day1 = $day1;
|
|
$hsp->day2 = $day2;
|
|
$hsp->day3 = $day3;
|
|
$hsp->day4 = $day4;
|
|
$hsp->day5 = $day5;
|
|
$hsp->day6 = $day6;
|
|
$hsp->day7 = $day7;
|
|
$hsp->status = $status;
|
|
$hsp->save();
|
|
|
|
return redirect()->route('bo.home-slider-pictures.index');
|
|
}
|
|
|
|
public function show($id)
|
|
{
|
|
//
|
|
}
|
|
|
|
public function edit($id)
|
|
{
|
|
//
|
|
}
|
|
|
|
public function update(Request $request, $id)
|
|
{
|
|
//
|
|
}
|
|
|
|
public function destroy($id)
|
|
{
|
|
//
|
|
}
|
|
}
|