Anyone who used Laravel with AWS and maybe Jenkins?
can anyone help me?
how can I use php artisan commands on host ?
Did you do that?
each page takes 1 minute to load and the icons do not load proberly.
can anyone help me?
php artisan config:cache
php artisan view:cache
php artisan route:cache
also instead of all of above commands you can use below command but if you’re using laravel version 7 or 8 i’m suggesting you above commands
php artisan optimize
in a delete ajax call, delete one image and select 4 images and send it as a response to your delete ajax query, and replace the existing div part where you loaded 5 images with the response you get from delete ajax call
php artisan view:cache
php artisan route:cache
also instead of all of above commands you can use below command but if you’re using laravel version 7 or 8 i’m suggesting you above commands
php artisan optimize
project uploaded on the host
how can I use php artisan commands on host ?
how can I use php artisan commands on host ?
You don’t have terminal access in your host?
how can I use php artisan commands on host ?
if you don’t have access t terminal, you should create route for Artisan command.
You can use artisan commands via Artisan class
no
Use
Artisan::call(‘your command’)
Artisan::call(‘your command’)
he should search on google ))) you gave complete answer.
Artisan::call(‘your command’)
thank you 🌹
You’re welcome
May be you have permission issue
When you’ve deployed your project on your host you have to serve it to work
https://pastebin.com/bQsGJsej
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Here is my code…
<script type=”text/javascript”>
$(document).ready(function (e) {
$(‘#laravel_crud’).show();
$.ajaxSetup({
headers: {
‘X-CSRF-TOKEN’: $(‘meta[name=”csrf-token”]’).attr(‘content’)
}
});
$(‘#image’).change(function(){
let reader = new FileReader();
reader.onload = (e) => {
$(‘#display-image-preview’).attr(‘src’, e.target.result);
}
reader.readAsDataURL(this.files[0]);
});
$(‘#ajax-image-upload-form’).submit(function(e) {
e.preventDefault();
var formData = new FormData(this);
$.ajax({
type:’POST’,
url: “{{ url(‘/post’)}}”,
data: formData,
cache:false,
contentType: false,
processData: false,
success: (data) => {
this.reset();
//alert(‘Image has been uploaded!’);
window.location.reload();
},
error: function(data){
console.log(data);
}
});
});
});
</script>
controller
public function store(Request $request)
{
request()->validate([
‘image’ => ‘required|image|mimes:jpeg,png,jpg,gif,svg|max:2048’,
‘body’ => ‘required’,
]);
$response = Response()->json([
“success” => false,
“image” => ”,
“body” => ”
]);
if ($files = $request->file(‘image’))
{
$destinationPath = ‘public/images/’; // upload path
$imageName = date(‘YmdHis’) . “.” . $files->getClientOriginalExtension();
$files->move($destinationPath, $imageName);
$post= new Post;
$post->title = “$imageName”;
$post->body = $request->body;
$post->user()->associate($request->user());
$post->save();
}
$response = Response()->json([
“success” => true,
“image” => $post
]);
this code is working to store now need help to update
return Response()->json($response);
}
Here is my code…
<script type=”text/javascript”>
$(document).ready(function (e) {
$(‘#laravel_crud’).show();
$.ajaxSetup({
headers: {
‘X-CSRF-TOKEN’: $(‘meta[name=”csrf-token”]’).attr(‘content’)
}
});
$(‘#image’).change(function(){
let reader = new FileReader();
reader.onload = (e) => {
$(‘#display-image-preview’).attr(‘src’, e.target.result);
}
reader.readAsDataURL(this.files[0]);
});
$(‘#ajax-image-upload-form’).submit(function(e) {
e.preventDefault();
var formData = new FormData(this);
$.ajax({
type:’POST’,
url: “{{ url(‘/post’)}}”,
data: formData,
cache:false,
contentType: false,
processData: false,
success: (data) => {
this.reset();
//alert(‘Image has been uploaded!’);
window.location.reload();
},
error: function(data){
console.log(data);
}
});
});
});
</script>
controller
public function store(Request $request)
{
request()->validate([
‘image’ => ‘required|image|mimes:jpeg,png,jpg,gif,svg|max:2048’,
‘body’ => ‘required’,
]);
$response = Response()->json([
“success” => false,
“image” => ”,
“body” => ”
]);
if ($files = $request->file(‘image’))
{
$destinationPath = ‘public/images/’; // upload path
$imageName = date(‘YmdHis’) . “.” . $files->getClientOriginalExtension();
$files->move($destinationPath, $imageName);
$post= new Post;
$post->title = “$imageName”;
$post->body = $request->body;
$post->user()->associate($request->user());
$post->save();
}
$response = Response()->json([
“success” => true,
“image” => $post
]);
this code is working to store now need help to update
return Response()->json($response);
}
I’ve activated ssl on cpanel n all apis n site may use https.. but i can’t access the cpanel n whm through https..
when i attempt :
myDomain.com/cpanel
It redirects to:
myHostname:port
N it doesn’t use ssl;
..
Tnx a zill ☘️
Here is my code…
<script type=”text/javascript”>
$(document).ready(function (e) {
$(‘#laravel_crud’).show();
$.ajaxSetup({
headers: {
‘X-CSRF-TOKEN’: $(‘meta[name=”csrf-token”]’).attr(‘content’)
}
});
$(‘#image’).change(function(){
let reader = new FileReader();
reader.onload = (e) => {
$(‘#display-image-preview’).attr(‘src’, e.target.result);
}
reader.readAsDataURL(this.files[0]);
});
$(‘#ajax-image-upload-form’).submit(function(e) {
e.preventDefault();
var formData = new FormData(this);
$.ajax({
type:’POST’,
url: “{{ url(‘/post’)}}”,
data: formData,
cache:false,
contentType: false,
processData: false,
success: (data) => {
this.reset();
//alert(‘Image has been uploaded!’);
window.location.reload();
},
error: function(data){
console.log(data);
}
});
});
});
</script>
controller
public function store(Request $request)
{
request()->validate([
‘image’ => ‘required|image|mimes:jpeg,png,jpg,gif,svg|max:2048’,
‘body’ => ‘required’,
]);
$response = Response()->json([
“success” => false,
“image” => ”,
“body” => ”
]);
if ($files = $request->file(‘image’))
{
$destinationPath = ‘public/images/’; // upload path
$imageName = date(‘YmdHis’) . “.” . $files->getClientOriginalExtension();
$files->move($destinationPath, $imageName);
$post= new Post;
$post->title = “$imageName”;
$post->body = $request->body;
$post->user()->associate($request->user());
$post->save();
}
$response = Response()->json([
“success” => true,
“image” => $post
]);
this code is working to store now need help to update
return Response()->json($response);
}
Use the same name for inserting and updating so while updating an image the corressponding old image gets replaced by new image
Explain me with example
Ok I’ll try this code 😊


When I click Edit

Record is updated with the last record but not with the current record which I edited…
ok thanx , I got it but now the AJAX button click work first time, everything cool, I loaded the partial view to the html by jqwuery, but the button is firing the second time, I need to refresh page.. any idea why ?