Laravel 10 CRUD (Create, Read, Update and Delete)

preview_player
Показать описание
Laravel 10 CRUD (Create, Read, Update and Delete)
Рекомендации по теме
Комментарии
Автор

Yah walaupun harus teliti dan harus ngerti dia ngomong apa(pake kursor bjir) mantap gw bisa, recomended rek videonya

ARZKUN
Автор

Awesome. This type of short video needs all time. Please upload a video about Axios CRUD.

armanazij
Автор

You gained one subs....good to go with source code!

chandratheexplorer
Автор

Hello sir, please can you make a video of insert row data using check box in data base with the help flask mysql

sahilkumar-ukxf
Автор

'fruitcake/laravel-cors' has been abandoned. Can you help me ?

kp_czt
Автор

Model galleri foto <?php

namespace App\Models;

use
use

class ImageGallery extends Model
{
use HasFactory;
protected $table = 'image_galleries';
protected $fillable = [
'judul_foto',
'image',
'deksripsi',
];
}

skuycoding
Автор

thanks brother... bt i need multi table concept ..
ex:
tbl1 -> customer
customer_id
name
email
phone
dp

tbl 2 -> customer_address
id
customer_id
add1
add2
add3
zip
city
country

spacelover
Автор

edit blade

edit blade @extends('layouts.app')

@section('title', 'Edit Foto')

@section('content')
<style>
/* Add this CSS to your existing styles or create a new CSS file */

body {
background-color: #f8f3e3;
margin: 0;
font-family: 'Arial', sans-serif;
}

.container {
margin-top: 50px;
}

.card {
border-radius: 15px;
box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
overflow: hidden;
}

.card-header {
background-color: #8d6e63;
color: #fff;
border-radius: 15px 15px 0 0;
padding: 20px;
text-align: center;
font-size: 28px;
font-weight: bold;
}

.form-control {
border-radius: 5px;
border: 2px solid #8d6e63;
padding: 12px;
margin-bottom: 20px;
font-size: 16px;
}

.btn-primary,
.btn-danger {
padding: 12px 24px;
border-radius: 5px;
cursor: pointer;
transition: background-color 0.3s ease-in-out;
}

.btn-primary {
background-color: #8d6e63;
border: none;
color: #fff;
}

.btn-primary:hover {
background-color: #6d4c41;
}

.btn-danger {
background-color: #dc3545;
border: none;
color: #fff;
}

.btn-danger:hover {
background-color: #bd2130;
}

/* Optional: Add media queries for responsiveness */
@media (max-width: 576px) {
.container {
padding: 0 15px;
}

.card {
width: 100%;
}
}

</style>

<div class="container">
<div class="card">
<div class="card-header"><h2>{{ _('Edit Foto') }}</h2></div>

@if ($errors->any())
@foreach ($errors->all() as $error)
<p class="alert alert-danger">{{ $error }}</p>
@endforeach
@endif

<form action="{{ route('home.update', $image->id) }}" method="POST" class="form-image-upload"
@csrf
@method('PUT')

<div class="mb-3">
<label><span class="text-danger">Judul Foto</span></label>
<input class="form-control" required="required" type="text" name="judul_foto" value="{{ $image->judul_foto }}">
</div>

<div class="mb-3">
<label>Image <span
<input class="form-control" type="file" name="image">
<div class="from-text">
<img src="{{ asset('/images/' . $image->image) }}" height="75">
</div>
</div>

<div class="mb-3">
<label>Deskripsi</label>
<textarea class="form-control" name="deksripsi" rows="10">{{ $image->deksripsi }}</textarea>
</div>

<div class="mb-3">
<button class="btn btn-primary">Save</button>
<a class="btn btn-danger" href="{{ route('home') }}">Cancel</a>
</div>
</form>
</div>
</div>
@endsection

skuycoding
Автор

Controller Galleri foto <?php

namespace App\Http\Controllers;

use App\Models\ImageGallery;
use
use Illuminate\Http\Request;

class ImageGalleryController extends Controller
{
public function index()
{
$images =
return view('home', ['images' => $images]);
}

public function upload(Request $request)
{
$this->validate($request, [
'judul_foto' => 'required',
'image' => 'required|image|mimes:jpeg, png, jpg, gif, svg|max:2048'
]);

$imageName = time() . '.' . $request->image->extension();
$request->image->move(public_path('images'), $imageName);


'judul_foto' => $request->judul_foto,
'image' => $imageName,
]);

return redirect()->back()->with('success', 'Image uploaded successfully');
}

public function edit($id){
$image = ImageGallery::find($id);
return view('komen_like', compact('image'));
}
public function komentar(request $request, $id)
{

'isi_komentar' => $request -> comment,
'tanggal_komentar' => $request ->format('D, Y-m-d H:i:s'),
'rate' => $request ->rate,
]);
}

}

skuycoding