Skip to content

Commit 2c056d2

Browse files
committed
4th commit
1 parent 7d94c44 commit 2c056d2

File tree

9 files changed

+16
-177
lines changed

9 files changed

+16
-177
lines changed

app/Http/Controllers/FirstTable.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,16 +65,16 @@ public function update(Request $req){
6565
if($image){
6666
$firsttable = DB::table('firsttable') -> where('id', $req->id)->first();
6767
$old_image=$firsttable->image;
68-
if(file_exists($old_image)){
69-
unlink($old_image);
70-
}
7168
$name = hexdec(uniqid());
7269
$fullname = $name.'.webp';
7370
$path = 'images/firsttable/';
7471
$url = $path.$fullname;
7572
$resize_image=Image::make($image->getRealPath());
7673
$resize_image->resize(300,300);
7774
$resize_image->save('images/firsttable/'.$fullname);
75+
if(file_exists($old_image)){
76+
unlink($old_image);
77+
}
7878
$data['text'] = $req -> text;
7979
$data['number'] = $req -> number;
8080
$data['image'] = $url;

package-lock.json

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
17 KB
Loading

resources/js/app.js

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,8 @@ window.toastr = toastr
1717
axios.interceptors.response.use(
1818
response => response,
1919
async(error) => {
20-
if(error.response.status === 500 && store.getters.getAppDebug === 'false'){
21-
store.dispatch('setServerError')
22-
router.push({name: '500'})
23-
}
24-
else if(error.response.status === 500 && store.getters.getAppDebug === 'true'){
25-
store.dispatch('setServerError')
26-
store.dispatch('setAppDebugData', error.response.data)
27-
router.push({name: 'appDebug'})
20+
if(error.response.status === 500){
21+
toastr.error('Something went wrong')
2822
}
2923
return Promise.reject(error)
3024
}

resources/js/pages/errors/500.vue

Lines changed: 0 additions & 45 deletions
This file was deleted.

resources/js/pages/errors/app_debug.vue

Lines changed: 0 additions & 44 deletions
This file was deleted.

resources/js/router.js

Lines changed: 6 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -5,79 +5,38 @@ import show_first_table_data from './pages/show_first_table_data.vue';
55
import store_data_in_second_table from './pages/store_data_in_second_table.vue';
66
import show_second_table_data from './pages/show_second_table_data.vue';
77
import pageNotFound from './pages/errors/404.vue';
8-
import serverError from './pages/errors/500.vue';
9-
import appDebug from './pages/errors/app_debug.vue';
108

119
const routes = [
1210
{
1311
path: '/',
1412
name: 'Home',
15-
component: home,
16-
meta: {
17-
isServerError: false
18-
}
13+
component: home
1914
},
2015
{
2116
path: '/show-first-table-data',
2217
name: 'Show-First-Table-Data',
23-
component: show_first_table_data,
24-
meta: {
25-
isServerError: false
26-
}
18+
component: show_first_table_data
2719
},
2820
{
2921
path: '/store-data-in-second-table',
3022
name: 'Store-Data-In-Second-Table',
31-
component: store_data_in_second_table,
32-
meta: {
33-
isServerError: false
34-
}
23+
component: store_data_in_second_table
3524
},
3625
{
3726
path: '/show-second-table-data',
3827
name: 'Show-Second-Table-Data',
39-
component: show_second_table_data,
40-
meta: {
41-
isServerError: false
42-
}
28+
component: show_second_table_data
4329
},
4430
{
4531
path: '/:pathMatch(.*)*',
4632
name: '404',
47-
component: pageNotFound,
48-
meta: {
49-
isServerError: false
50-
}
51-
},
52-
{
53-
path: '/server-error',
54-
name: '500',
55-
component: serverError,
56-
meta: {
57-
isServerError: true
58-
}
59-
},
60-
{
61-
path: '/app-debug',
62-
name: 'appDebug',
63-
component: appDebug,
64-
meta: {
65-
isServerError: true
66-
}
33+
component: pageNotFound
6734
}
6835
]
36+
6937
const router = createRouter({
7038
history: createWebHistory(),
7139
routes
7240
})
7341

74-
router.beforeEach((to, from, next) => {
75-
if(to.meta.isServerError === true && store.getters.getServerError === false){
76-
next({name: '404'})
77-
}
78-
else{
79-
next()
80-
}
81-
})
82-
8342
export default router

resources/js/store.js

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ const store = createStore({
99
datas: [],
1010
data: {},
1111
firstTables: [],
12-
editName: null,
13-
serverError: false,
14-
appDebugData: {}
12+
editName: null
1513
},
1614
mutations:{
1715
updateImageError(state, payload){
@@ -31,12 +29,6 @@ const store = createStore({
3129
},
3230
updateEditName(state, payload){
3331
state.editName = payload
34-
},
35-
updateServerError(state, payload){
36-
state.serverError = payload
37-
},
38-
updateAppDebugData(state, payload){
39-
state.appDebugData = payload
4032
}
4133
},
4234
actions:{
@@ -75,18 +67,6 @@ const store = createStore({
7567
},
7668
removeEditName(context){
7769
context.commit('updateEditName', null)
78-
},
79-
setServerError(context){
80-
context.commit('updateServerError', true)
81-
},
82-
removeServerError(context){
83-
context.commit('updateServerError', false)
84-
},
85-
setAppDebugData(context, payload){
86-
context.commit('updateAppDebugData', payload)
87-
},
88-
removeAppDebugData(context){
89-
context.commit('updateAppDebugData', {})
9070
}
9171
},
9272
getters:{
@@ -113,12 +93,6 @@ const store = createStore({
11393
},
11494
getEditName: function(state){
11595
return state.editName
116-
},
117-
getServerError: function(state){
118-
return state.serverError
119-
},
120-
getAppDebugData: function(state){
121-
return state.appDebugData
12296
}
12397
}
12498
})

resources/views/layouts/app.blade.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
<!DOCTYPE html>
2-
<html lang="en">
2+
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://ogp.me/ns/fb#">
33
<head>
44
<meta charset="utf-8">
55
<meta name="viewport" content="width=device-width, initial-scale=1">
6+
<meta name="robots" content="noindex, nofollow">
7+
<meta property="og:image" content="{{ asset('images/icons/facebookimage.png') }}">
68

7-
<link rel="icon" type="image/x-icon" href="{{asset('images/icons/favicon.webp')}}">
9+
<link rel="icon" type="image/webp" href="{{asset('images/icons/favicon.webp')}}">
810

911
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.6.0/css/bootstrap.min.css">
1012
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">

0 commit comments

Comments
 (0)