create: new folder
This commit is contained in:
parent
54b2797861
commit
3d93355bd9
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
api-regression-model-skripsi-main/all_model.pkl
Normal file
BIN
api-regression-model-skripsi-main/all_model.pkl
Normal file
Binary file not shown.
5
api-regression-model-skripsi-main/app.py
Normal file
5
api-regression-model-skripsi-main/app.py
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
from flask import Flask
|
||||
from flask_cors import CORS, cross_origin
|
||||
|
||||
app = Flask(__name__)
|
||||
CORS(app)
|
||||
BIN
api-regression-model-skripsi-main/implements_result.pkl
Normal file
BIN
api-regression-model-skripsi-main/implements_result.pkl
Normal file
Binary file not shown.
746
api-regression-model-skripsi-main/main.py
Normal file
746
api-regression-model-skripsi-main/main.py
Normal file
|
|
@ -0,0 +1,746 @@
|
|||
import mysql.connector as connection
|
||||
import pandas as pd
|
||||
import numpy as np
|
||||
from app import app
|
||||
from flask import jsonify
|
||||
from flask import flash, request, json
|
||||
from sklearn.linear_model import LinearRegression
|
||||
from sklearn.preprocessing import PolynomialFeatures
|
||||
from sklearn.ensemble import RandomForestRegressor
|
||||
from sklearn.svm import SVR
|
||||
from sklearn.pipeline import make_pipeline
|
||||
from sklearn.preprocessing import StandardScaler
|
||||
from sklearn.model_selection import train_test_split
|
||||
from sklearn.metrics import mean_squared_error
|
||||
from sklearn.model_selection import GridSearchCV
|
||||
from sklearn.pipeline import Pipeline
|
||||
from werkzeug.exceptions import HTTPException
|
||||
from joblib import Parallel, delayed
|
||||
import joblib
|
||||
|
||||
def connectDB():
|
||||
try:
|
||||
mydb = connection.connect(host="localhost", database = 'mitra_panen_skripsi',user="root", passwd="",use_pure=True)
|
||||
return mydb
|
||||
except Exception as e:
|
||||
print(str(e))
|
||||
|
||||
# Define the function to return the MAPE values
|
||||
def calculate_mape(actual, predicted) -> float:
|
||||
# Convert actual and predicted
|
||||
# to numpy array data type if not already
|
||||
if not all([isinstance(actual, np.ndarray),
|
||||
isinstance(predicted, np.ndarray)]):
|
||||
actual, predicted = np.array(actual),
|
||||
np.array(predicted)
|
||||
|
||||
# Calculate the MAPE value and return
|
||||
return round(np.mean(np.abs((
|
||||
actual - predicted) / actual)) * 100, 3)
|
||||
|
||||
@app.route('/training/full')
|
||||
def training_full():
|
||||
try:
|
||||
# get data from database
|
||||
mydb = connectDB()
|
||||
query = "SELECT fish_type_id, seed_amount, seed_weight, survival_rate, average_weight, pond_volume, total_feed_spent, harvest_amount FROM harvest_fish"
|
||||
df = pd.read_sql(query,mydb)
|
||||
# print(df)
|
||||
|
||||
# set data train
|
||||
x_train = df.iloc[:, :7].values
|
||||
y_train = df.iloc[:, 7].values
|
||||
|
||||
# Training Model
|
||||
method = request.args.get('method')
|
||||
if(method == 'linear'):
|
||||
print("Linear Regression")
|
||||
# Linear Regression Model
|
||||
model = LinearRegression()
|
||||
model.fit(x_train, y_train)
|
||||
elif(method == 'poly'):
|
||||
print("Polynomial Regression")
|
||||
# Polynomial Regression Model full data
|
||||
model_poly = PolynomialFeatures(degree = 3)
|
||||
x_poly = model_poly.fit_transform(x_train)
|
||||
model_poly.fit(x_poly, y_train)
|
||||
model = LinearRegression()
|
||||
model.fit(x_poly, y_train)
|
||||
elif(method == 'rf'):
|
||||
print("Random Forest Regression")
|
||||
# Random Forest Regression Model
|
||||
model = RandomForestRegressor(min_samples_leaf=1, n_estimators=100, random_state=0)
|
||||
model.fit(x_train, y_train)
|
||||
elif(method == 'svr'):
|
||||
print("SVR")
|
||||
model = make_pipeline(StandardScaler(), SVR(kernel="poly", C=100, gamma="scale", degree=3, coef0=2))
|
||||
model.fit(x_train, y_train)
|
||||
else:
|
||||
print("tidak ada request")
|
||||
model = LinearRegression()
|
||||
model.fit(x_train, y_train)
|
||||
|
||||
# save regression model to file
|
||||
joblib.dump(model, 'regression_model.pkl')
|
||||
joblib.dump(method, 'method.pkl')
|
||||
if(method == 'poly'):
|
||||
joblib.dump(model_poly, 'regression_model_poly.pkl')
|
||||
|
||||
# respon API
|
||||
respon = jsonify()
|
||||
respon.data = json.dumps({
|
||||
"code": 200,
|
||||
"status": 'Success',
|
||||
"message": "Berhasil menyimpan training model",
|
||||
})
|
||||
respon.status_code = 200
|
||||
return respon
|
||||
except Exception as e:
|
||||
print(str(e))
|
||||
|
||||
def get_total_feed_spent(fish_id, seed_amount, sr) -> float:
|
||||
# check seed amount
|
||||
if(seed_amount == 1000 or seed_amount == 1500 or seed_amount == 2000):
|
||||
temp_amount = seed_amount
|
||||
check = 0
|
||||
else:
|
||||
temp_amount = 1000
|
||||
check = 1
|
||||
|
||||
# get data from database
|
||||
mydb = connectDB()
|
||||
query = "SELECT total_feed_spent FROM harvest_fish WHERE fish_type_id=" + fish_id + " AND seed_amount=" + str(temp_amount)
|
||||
df = pd.read_sql(query,mydb)
|
||||
df_values = df.values.flatten()
|
||||
|
||||
# calculate total feed spent
|
||||
if(check == 1):
|
||||
for i in range(len(df_values)):
|
||||
df_values[i] = seed_amount / 1000 * df_values[i]
|
||||
total_feed_spent = sum(df_values) / len(df_values)
|
||||
total_feed_spent = sr / 100 * total_feed_spent
|
||||
return round(total_feed_spent, 1)
|
||||
|
||||
@app.route('/implements')
|
||||
def implements_model():
|
||||
try:
|
||||
# get data
|
||||
fish_id = request.args.get('fish_id')
|
||||
seed_amount = request.args.get('seed_amount')
|
||||
seed_weight = request.args.get('seed_weight')
|
||||
pond_volume = request.args.get('pond_volume')
|
||||
total_fish_count = request.args.get('total_fish_count')
|
||||
|
||||
# processing data
|
||||
average_weight = 1000 / int(total_fish_count)
|
||||
average_weight = round(average_weight, 2)
|
||||
if(fish_id == '1'):
|
||||
sr_arr = [85,87,89,91,93]
|
||||
elif(fish_id == '2'):
|
||||
sr_arr = [84,86,88,90,92]
|
||||
else:
|
||||
sr_arr = [65,70,75,80,85]
|
||||
|
||||
# load model
|
||||
method = joblib.load('method.pkl')
|
||||
model = joblib.load('regression_model.pkl')
|
||||
|
||||
# predict data with regression model by survival rate
|
||||
result_predict = []
|
||||
table_result = []
|
||||
graph_result = []
|
||||
tfs = []
|
||||
for i in range(len(sr_arr)):
|
||||
sr = sr_arr[i]
|
||||
total_feed_spent = get_total_feed_spent(fish_id, int(seed_amount), sr)
|
||||
tfs.append(total_feed_spent)
|
||||
data = np.array([[fish_id, seed_amount, seed_weight, sr, average_weight, pond_volume, total_feed_spent]])
|
||||
data = np.array(data, dtype=float)
|
||||
if(method == 'poly'):
|
||||
model_poly = joblib.load('regression_model_poly.pkl')
|
||||
predict = model.predict(model_poly.fit_transform(data))
|
||||
else:
|
||||
predict = model.predict(data)
|
||||
|
||||
# control value of prediction
|
||||
max_harvest = average_weight * int(seed_amount) / 1000
|
||||
if(predict[0] > max_harvest):
|
||||
predict[0] = max_harvest
|
||||
elif(predict[0] < 0):
|
||||
predict[0] = 0
|
||||
|
||||
result_predict.append(round(predict[0],3))
|
||||
table_result.append({"sr":sr, "predict":round(predict[0],3)})
|
||||
graph_result.append({"x":sr, "y":round(predict[0],3)})
|
||||
|
||||
# save implements result to file
|
||||
implements_result = {
|
||||
"fish_id":fish_id, "seed_amount":seed_amount, "seed_weight":seed_weight,
|
||||
"average_weight":average_weight, "total_feed_spent":tfs, "sr_arr":sr_arr,
|
||||
"result_predict":result_predict, "table_result":table_result, "graph_result":graph_result
|
||||
}
|
||||
joblib.dump(implements_result, "implements_result.pkl")
|
||||
|
||||
# response API
|
||||
respon = jsonify()
|
||||
respon.data = json.dumps({
|
||||
"code": 200,
|
||||
"status": 'Success',
|
||||
"message": "Berhasil implements model",
|
||||
"method": method,
|
||||
"predict": result_predict,
|
||||
})
|
||||
respon.status_code = 200
|
||||
return respon
|
||||
except Exception as e:
|
||||
print(str(e))
|
||||
|
||||
@app.route('/implements/prediction')
|
||||
def implements_prediction():
|
||||
try:
|
||||
# get data
|
||||
fish_id = request.args.get('fish_id')
|
||||
seed_amount = request.args.get('seed_amount')
|
||||
seed_weight = request.args.get('seed_weight')
|
||||
pond_volume = request.args.get('pond_volume')
|
||||
total_fish_count = request.args.get('total_fish_count')
|
||||
sr = request.args.get('survival_rate')
|
||||
sr = float(sr)
|
||||
|
||||
# processing data
|
||||
average_weight = 1000 / int(total_fish_count)
|
||||
average_weight = round(average_weight, 2)
|
||||
|
||||
# load model
|
||||
method = joblib.load('method.pkl')
|
||||
model = joblib.load('regression_model.pkl')
|
||||
|
||||
# predict data with regression model
|
||||
total_feed_spent = get_total_feed_spent(fish_id, int(seed_amount), sr)
|
||||
data = np.array([[fish_id, seed_amount, seed_weight, sr, average_weight, pond_volume, total_feed_spent]])
|
||||
data = np.array(data, dtype=float)
|
||||
if(method == 'poly'):
|
||||
model_poly = joblib.load('regression_model_poly.pkl')
|
||||
predict = model.predict(model_poly.fit_transform(data))
|
||||
else:
|
||||
predict = model.predict(data)
|
||||
|
||||
# control value of prediction
|
||||
max_harvest = average_weight * int(seed_amount) / 1000
|
||||
if(predict[0] > max_harvest):
|
||||
predict[0] = max_harvest
|
||||
elif(predict[0] < 0):
|
||||
predict[0] = 0
|
||||
|
||||
# duration fish
|
||||
if(fish_id == '1'):
|
||||
day = list(range(1, 91))
|
||||
else:
|
||||
day = list(range(1,181))
|
||||
|
||||
# cultivation data
|
||||
total_fish = predict[0] * 1000 / average_weight
|
||||
growth = (average_weight - float(seed_weight)) / (len(day)-1)
|
||||
weight = []
|
||||
feed_spent = []
|
||||
simulation_table = []
|
||||
current_feed = 0.0
|
||||
current_total_feed = 0.0
|
||||
current_weight = 0.0
|
||||
temp_total_feed = 0.0
|
||||
rule_feed = [0.0] * 4
|
||||
for j in range(len(day)):
|
||||
# simulation weight
|
||||
if(day[j] == 1):
|
||||
current_weight += float(seed_weight)
|
||||
else:
|
||||
current_weight = float(current_weight) + float(growth)
|
||||
weight.append({"x":day[j], "y":round(current_weight,3)})
|
||||
|
||||
# make rule feed using percentage above day 30
|
||||
if(day[j] == 31):
|
||||
temp_total_feed = total_feed_spent - current_total_feed
|
||||
if(fish_id == '1'):
|
||||
rule_feed[0] = (temp_total_feed * 0.4) / 30 # day 31-60 feed spent 40%
|
||||
rule_feed[1] = (temp_total_feed * 0.6) / 30 # day 61-90 feed spent 60%
|
||||
else:
|
||||
rule_feed[0] = (temp_total_feed * 0.1) / 30 # day 31-60 feed spent 10%
|
||||
rule_feed[1] = (temp_total_feed * 0.15) / 30 # day 61-90 feed spent 15%
|
||||
rule_feed[2] = (temp_total_feed * 0.45) / 60 # day 91-150 feed spent 45%
|
||||
rule_feed[3] = (temp_total_feed * 0.3) / 30 # day 151-180 feed spent 30%
|
||||
|
||||
# simulation feed spent
|
||||
if(day[j] == 1 or day[j] == 2): # day 1-2 feed spent 0
|
||||
current_feed = 0.0
|
||||
elif(day[j] >= 3 and day[j] <= 5): # day 3-5 feed spent 0.15kg
|
||||
current_feed = 0.15 * float(seed_amount) / 1000
|
||||
elif(day[j] == 6 or day[j] == 7): # day 6-7 feed spent 0.3kg
|
||||
current_feed = 0.3 * float(seed_amount) / 1000
|
||||
elif(day[j] == 8 or day[j] == 9): # day 8-9 feed spent 0.4kg
|
||||
current_feed = 0.4 * float(seed_amount) / 1000
|
||||
elif(day[j] >= 10 and day[j] <= 30): # day 10-30 feed spent 0.6kg
|
||||
current_feed = 0.6 * float(seed_amount) / 1000
|
||||
elif(day[j] >= 31 and day[j] <= 60): # day 31-60 feed spent rule[0]
|
||||
current_feed = rule_feed[0]
|
||||
elif(day[j] >= 61 and day[j] <= 90): # day 61-90 feed spent rule[1]
|
||||
current_feed = rule_feed[1]
|
||||
elif(day[j] >= 91 and day[j] <= 150): # day 91-150 feed spent rule[2]
|
||||
current_feed = rule_feed[2]
|
||||
elif(day[j] >= 151 and day[j] <= 180): # day 151-180 feed spetn rule[3]
|
||||
current_feed = rule_feed[3]
|
||||
else:
|
||||
current_feed = 1
|
||||
|
||||
current_total_feed += float(current_feed)
|
||||
feed_spent.append({"x":day[j], "y":round(current_feed,1)})
|
||||
total_weight = total_fish * current_weight / 1000
|
||||
simulation_table.append({"day":day[j], "weight":round(current_weight,1), "feed_spent":round(current_feed,1), "total_feed_spent":round(current_total_feed,1), "total_weight":round(total_weight,1)})
|
||||
|
||||
# response API
|
||||
respon = jsonify()
|
||||
respon.data = json.dumps({
|
||||
"code": 200,
|
||||
"status": 'Success',
|
||||
"message": "Berhasil implements prediction model",
|
||||
"method": method,
|
||||
"predict": round(predict[0],1),
|
||||
"total_feed_spent": round(total_feed_spent,1),
|
||||
"simulation_table": simulation_table
|
||||
})
|
||||
respon.status_code = 200
|
||||
return respon
|
||||
except Exception as e:
|
||||
print(str(e))
|
||||
|
||||
@app.route('/implements/result')
|
||||
def get_implements_result():
|
||||
try:
|
||||
# get implements result data
|
||||
implements_result = joblib.load("implements_result.pkl")
|
||||
fish_id = implements_result["fish_id"]
|
||||
seed_amount = implements_result["seed_amount"]
|
||||
seed_weight = implements_result["seed_weight"]
|
||||
average_weight = implements_result["average_weight"]
|
||||
total_feed_spent = implements_result["total_feed_spent"]
|
||||
sr_arr = implements_result["sr_arr"]
|
||||
result_predict = implements_result["result_predict"]
|
||||
table_result = implements_result["table_result"]
|
||||
graph_result = implements_result["graph_result"]
|
||||
|
||||
# duration fish
|
||||
if(fish_id == '1'):
|
||||
day = list(range(1, 91))
|
||||
day_range = ['1-2', '3-5', '6-7', '8-9', '10-30', '31-60', '61-90']
|
||||
else:
|
||||
day = list(range(1,181))
|
||||
day_range = ['1-2', '3-5', '6-7', '8-9', '10-30', '31-60', '61-90', '91-150', '151-180']
|
||||
|
||||
# processing simulation weight and feed spent
|
||||
graph_weight = []
|
||||
graph_feed_spent = []
|
||||
feed_spent_arr = []
|
||||
total_weight_arr = []
|
||||
simulation_table_arr = []
|
||||
simple_feed_arr = []
|
||||
for i in range(len(sr_arr)):
|
||||
total_fish = result_predict[i] * 1000 / average_weight
|
||||
growth = (average_weight - float(seed_weight)) / (len(day)-1)
|
||||
weight = []
|
||||
feed_spent = []
|
||||
simulation_table = []
|
||||
simple_feed = []
|
||||
current_feed = 0.0
|
||||
current_total_feed = 0.0
|
||||
current_weight = 0.0
|
||||
temp_total_feed = 0.0
|
||||
rule_feed = [0.0] * 4
|
||||
for j in range(len(day)):
|
||||
# simulation weight
|
||||
if(day[j] == 1):
|
||||
current_weight += float(seed_weight)
|
||||
else:
|
||||
current_weight = float(current_weight) + float(growth)
|
||||
weight.append({"x":day[j], "y":round(current_weight,3)})
|
||||
|
||||
# make rule feed using percentage above day 30
|
||||
if(day[j] == 31):
|
||||
temp_total_feed = total_feed_spent[i] - current_total_feed
|
||||
if(fish_id == '1'):
|
||||
rule_feed[0] = (temp_total_feed * 0.4) / 30 # day 31-60 feed spent 40%
|
||||
rule_feed[1] = (temp_total_feed * 0.6) / 30 # day 61-90 feed spent 60%
|
||||
else:
|
||||
rule_feed[0] = (temp_total_feed * 0.1) / 30 # day 31-60 feed spent 10%
|
||||
rule_feed[1] = (temp_total_feed * 0.15) / 30 # day 61-90 feed spent 15%
|
||||
rule_feed[2] = (temp_total_feed * 0.45) / 60 # day 91-150 feed spent 45%
|
||||
rule_feed[3] = (temp_total_feed * 0.3) / 30 # day 151-180 feed spent 30%
|
||||
|
||||
# simulation feed spent
|
||||
if(day[j] == 1 or day[j] == 2): # day 1-2 feed spent 0
|
||||
current_feed = 0.0
|
||||
elif(day[j] >= 3 and day[j] <= 5): # day 3-5 feed spent 0.15kg
|
||||
current_feed = 0.15 * float(seed_amount) / 1000
|
||||
elif(day[j] == 6 or day[j] == 7): # day 6-7 feed spent 0.3kg
|
||||
current_feed = 0.3 * float(seed_amount) / 1000
|
||||
elif(day[j] == 8 or day[j] == 9): # day 8-9 feed spent 0.4kg
|
||||
current_feed = 0.4 * float(seed_amount) / 1000
|
||||
elif(day[j] >= 10 and day[j] <= 30): # day 10-30 feed spent 0.6kg
|
||||
current_feed = 0.6 * float(seed_amount) / 1000
|
||||
elif(day[j] >= 31 and day[j] <= 60): # day 31-60 feed spent rule[0]
|
||||
current_feed = rule_feed[0]
|
||||
elif(day[j] >= 61 and day[j] <= 90): # day 61-90 feed spent rule[1]
|
||||
current_feed = rule_feed[1]
|
||||
elif(day[j] >= 91 and day[j] <= 150): # day 91-150 feed spent rule[2]
|
||||
current_feed = rule_feed[2]
|
||||
elif(day[j] >= 151 and day[j] <= 180): # day 151-180 feed spetn rule[3]
|
||||
current_feed = rule_feed[3]
|
||||
else:
|
||||
current_feed = 1
|
||||
|
||||
current_total_feed += float(current_feed)
|
||||
feed_spent.append({"x":day[j], "y":round(current_feed,1)})
|
||||
total_weight = total_fish * current_weight / 1000
|
||||
simulation_table.append({"day":day[j], "weight":round(current_weight,3), "feed_spent":round(current_feed,1), "total_weight":round(total_weight,3)})
|
||||
simple_feed.append(round(current_feed,1))
|
||||
total_weight_arr.append(round(total_weight,3))
|
||||
feed_spent_arr.append(round(current_total_feed,1))
|
||||
simulation_table_arr.append(simulation_table)
|
||||
graph_weight.append(weight)
|
||||
graph_feed_spent.append(feed_spent)
|
||||
simple_feed = list(set(simple_feed))
|
||||
simple_feed_arr.append(simple_feed)
|
||||
|
||||
# mapping simple simulation feed
|
||||
simple_table_arr = []
|
||||
for i in range(len(simple_feed_arr)):
|
||||
simple_table = []
|
||||
for j in range(len(day_range)):
|
||||
simple_table.append({'day_range':day_range[j], 'feed_spent':simple_feed_arr[i][j]})
|
||||
simple_table_arr.append(simple_table)
|
||||
|
||||
# response API
|
||||
respon = jsonify()
|
||||
respon.data = json.dumps({
|
||||
"code": 200,
|
||||
"status": 'Success',
|
||||
"message": "Berhasil mendapatkan data hasil implementasi",
|
||||
"sr": sr_arr,
|
||||
"total_feed_spent": total_feed_spent,
|
||||
"predict": result_predict,
|
||||
"table_result": table_result,
|
||||
"graph_result": graph_result,
|
||||
"table_simulation_1": simulation_table_arr[0],
|
||||
"table_simulation_2": simulation_table_arr[1],
|
||||
"table_simulation_3": simulation_table_arr[2],
|
||||
"table_simulation_4": simulation_table_arr[3],
|
||||
"table_simulation_5": simulation_table_arr[4],
|
||||
"graph_weight": graph_weight,
|
||||
"graph_feed": graph_feed_spent,
|
||||
"table_simple_1": simple_table_arr[0],
|
||||
"table_simple_2": simple_table_arr[1],
|
||||
"table_simple_3": simple_table_arr[2],
|
||||
"table_simple_4": simple_table_arr[3],
|
||||
"table_simple_5": simple_table_arr[4],
|
||||
"total_feed_spent_arr": feed_spent_arr,
|
||||
"total_weight": total_weight_arr
|
||||
})
|
||||
respon.status_code = 200
|
||||
return respon
|
||||
except Exception as e:
|
||||
print(str(e))
|
||||
|
||||
@app.route('/best/params')
|
||||
def get_best_param():
|
||||
try:
|
||||
# get data from database
|
||||
mydb = connectDB()
|
||||
query = "SELECT fish_type_id, seed_amount, seed_weight, survival_rate, average_weight, pond_volume, total_feed_spent, harvest_amount FROM harvest_fish"
|
||||
df = pd.read_sql(query,mydb)
|
||||
x = df.iloc[:, :7].values
|
||||
y = df.iloc[:, 7].values
|
||||
|
||||
# make pipeline for polynomial regression
|
||||
pipeline_poly = Pipeline([
|
||||
('poly', PolynomialFeatures()),
|
||||
('regression', LinearRegression())
|
||||
])
|
||||
|
||||
# make pipeline for SVR
|
||||
pipeline_svr = Pipeline([
|
||||
('scaler', StandardScaler()),
|
||||
('svr', SVR())
|
||||
])
|
||||
|
||||
model_params = {
|
||||
'linear_regression': {
|
||||
'model': LinearRegression(),
|
||||
'params' : {
|
||||
# No Parameter
|
||||
}
|
||||
},
|
||||
'polynomial_regression': {
|
||||
'model': pipeline_poly,
|
||||
'params' : {
|
||||
'poly__degree' : [2,3,4]
|
||||
}
|
||||
},
|
||||
'random_forest': {
|
||||
'model': RandomForestRegressor(),
|
||||
'params' : {
|
||||
'n_estimators': [1,10,100],
|
||||
'min_samples_leaf' : [1,2,3],
|
||||
'random_state': [0]
|
||||
}
|
||||
},
|
||||
'svr': {
|
||||
'model': pipeline_svr,
|
||||
'params': {
|
||||
'svr__kernel': ["linear", "poly", "rbf", "sigmoid", "precomputed"],
|
||||
'svr__degree': [2,3,4],
|
||||
'svr__gamma': ['scale', 'auto'],
|
||||
'svr__coef0': [0,1,2],
|
||||
'svr__C': [1,10,100],
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# get best parameter model
|
||||
scores = []
|
||||
for model_name, mp in model_params.items():
|
||||
clf = GridSearchCV(mp['model'], mp['params'], scoring='neg_root_mean_squared_error', cv=19)
|
||||
clf.fit(x, y)
|
||||
scores.append({
|
||||
'model': model_name,
|
||||
'best_score': clf.best_score_,
|
||||
'best_params': clf.best_params_
|
||||
})
|
||||
score_df = pd.DataFrame(scores,columns=['model','best_score','best_params'])
|
||||
table_scores = score_df.to_html(index=False)
|
||||
|
||||
# response API
|
||||
respon = jsonify()
|
||||
respon.data = json.dumps({
|
||||
"code": 200,
|
||||
"status": 'Success',
|
||||
"message": "Berhasil mendapatkan parameter terbaik setiap model",
|
||||
"scores": scores,
|
||||
"table_scores": table_scores
|
||||
})
|
||||
respon.status_code = 200
|
||||
return respon
|
||||
except Exception as e:
|
||||
print(str(e))
|
||||
|
||||
@app.route('/split/data')
|
||||
def split_data():
|
||||
try:
|
||||
# get data from database
|
||||
mydb = connectDB()
|
||||
test_size = request.args.get('test_size')
|
||||
test_size = float(test_size)
|
||||
query = "SELECT fish_type_id, seed_amount, seed_weight, survival_rate, average_weight, pond_volume, total_feed_spent, harvest_amount FROM harvest_fish"
|
||||
df = pd.read_sql(query,mydb)
|
||||
|
||||
# split data to train and test
|
||||
x = df.iloc[:, :7].values
|
||||
y = df.iloc[:, 7].values
|
||||
x_train, x_test, y_train, y_test = train_test_split(x,y,test_size=test_size,random_state=0)
|
||||
|
||||
# save split data
|
||||
split_data = {"x_train":x_train, "x_test":x_test, "y_train":y_train, "y_test":y_test}
|
||||
joblib.dump(split_data, "split_data.pkl")
|
||||
|
||||
# setting tuning hyperparameter
|
||||
setting_param = request.args.get('setting')
|
||||
if(setting_param == "default"):
|
||||
# Linear Regression Model
|
||||
lin = LinearRegression()
|
||||
lin.fit(x_train, y_train)
|
||||
|
||||
# Polynomial Regression Model
|
||||
poly = PolynomialFeatures()
|
||||
x_poly = poly.fit_transform(x_train)
|
||||
poly.fit(x_poly, y_train)
|
||||
lin2 = LinearRegression()
|
||||
lin2.fit(x_poly, y_train)
|
||||
|
||||
# Random Forest Regression Model
|
||||
regressor = RandomForestRegressor(random_state=0)
|
||||
regressor.fit(x_train, y_train)
|
||||
|
||||
# SVR Model
|
||||
# model dengan akurasi terbaik : SVR(kernel="poly", C=100, gamma="auto", degree=2, coef0=1)
|
||||
regr = make_pipeline(StandardScaler(), SVR())
|
||||
regr.fit(x_train, y_train)
|
||||
else :
|
||||
# Linear Regression Model
|
||||
lin = LinearRegression()
|
||||
lin.fit(x_train, y_train)
|
||||
|
||||
# Polynomial Regression Model
|
||||
poly = PolynomialFeatures(degree = 3)
|
||||
x_poly = poly.fit_transform(x_train)
|
||||
poly.fit(x_poly, y_train)
|
||||
lin2 = LinearRegression()
|
||||
lin2.fit(x_poly, y_train)
|
||||
|
||||
# Random Forest Regression Model
|
||||
regressor = RandomForestRegressor(min_samples_leaf=1, n_estimators=100, random_state=0)
|
||||
regressor.fit(x_train, y_train)
|
||||
|
||||
# SVR Model
|
||||
regr = make_pipeline(StandardScaler(), SVR(kernel="poly", C=100, gamma="scale", degree=3, coef0=2))
|
||||
regr.fit(x_train, y_train)
|
||||
|
||||
# save all model
|
||||
all_model = {"linear":lin, "poly":poly, "lin2":lin2, "rf":regressor, "svr":regr}
|
||||
joblib.dump(all_model, "all_model.pkl")
|
||||
|
||||
respon = jsonify()
|
||||
respon.data = json.dumps({
|
||||
"code": 200,
|
||||
"status": 'Success',
|
||||
"message": "Berhasil simpan split data",
|
||||
})
|
||||
respon.status_code = 200
|
||||
return respon
|
||||
except Exception as e:
|
||||
print(str(e))
|
||||
|
||||
@app.route('/testing/model')
|
||||
def testing_model():
|
||||
try:
|
||||
# get split data
|
||||
split_data = joblib.load("split_data.pkl")
|
||||
x_train = split_data["x_train"]
|
||||
y_train = split_data["y_train"]
|
||||
x_test = split_data["x_test"]
|
||||
y_test = split_data["y_test"]
|
||||
|
||||
# set data train
|
||||
data_train = []
|
||||
for i in range(len(y_train)):
|
||||
data_train.append({"fish_type_id":x_train[i][0], "seed_amount":x_train[i][1], "seed_weight":x_train[i][2], "survival_rate":x_train[i][3], "average_weight":x_train[i][4], "pond_volume":x_train[i][5], "total_feed_spent":x_train[i][6], "harvest_amount":y_train[i]})
|
||||
|
||||
# set data test
|
||||
data_test = []
|
||||
for i in range(len(y_test)):
|
||||
data_test.append({"fish_type_id":x_test[i][0], "seed_amount":x_test[i][1], "seed_weight":x_test[i][2], "survival_rate":x_test[i][3], "average_weight":x_test[i][4], "pond_volume":x_test[i][5], "total_feed_spent":x_test[i][6], "harvest_amount":y_test[i]})
|
||||
|
||||
# load all regression model
|
||||
all_model = joblib.load("all_model.pkl")
|
||||
lin = all_model["linear"]
|
||||
poly = all_model["poly"]
|
||||
lin2 = all_model["lin2"]
|
||||
regressor = all_model["rf"]
|
||||
regr = all_model["svr"]
|
||||
|
||||
# predict with data test
|
||||
y_linear = lin.predict(x_test)
|
||||
y_poly = lin2.predict(poly.fit_transform(x_test))
|
||||
y_rf = regressor.predict(x_test)
|
||||
y_svr = regr.predict(x_test)
|
||||
|
||||
# set data comparison between harvest_amount actual (data test) with predict
|
||||
data_compare = []
|
||||
for i in range(len(y_test)):
|
||||
data_compare.append({"actual":y_test[i], "y_linear":round(y_linear[i],3), "y_poly":round(y_poly[i],3), "y_rf":round(y_rf[i],3), "y_svr":round(y_svr[i],3)})
|
||||
|
||||
#setup data graph
|
||||
actual_graph = []
|
||||
linear_graph = []
|
||||
poly_graph = []
|
||||
rf_graph = []
|
||||
svr_graph = []
|
||||
data_compare = sorted(data_compare, key=lambda data:data["actual"])
|
||||
for i in range(len(y_test)):
|
||||
actual_graph.append({"x":i+1, "y":data_compare[i]["actual"]})
|
||||
linear_graph.append({"x":i+1, "y":data_compare[i]["y_linear"]})
|
||||
poly_graph.append({"x":i+1, "y":data_compare[i]["y_poly"]})
|
||||
rf_graph.append({"x":i+1, "y":data_compare[i]["y_rf"]})
|
||||
svr_graph.append({"x":i+1, "y":data_compare[i]["y_svr"]})
|
||||
|
||||
# test accuracy model with RMSE and MAPE
|
||||
rmse = [0] * 4
|
||||
rmse[0] = round(mean_squared_error(y_test, y_linear, squared=False),3)
|
||||
rmse[1] = round(mean_squared_error(y_test, y_poly, squared=False),3)
|
||||
rmse[2] = round(mean_squared_error(y_test, y_rf, squared=False),3)
|
||||
rmse[3] = round(mean_squared_error(y_test, y_svr, squared=False),3)
|
||||
mape = [0] * 4
|
||||
mape[0] = str(calculate_mape(y_test, y_linear)) + ' %'
|
||||
mape[1] = str(calculate_mape(y_test, y_poly)) + ' %'
|
||||
mape[2] = str(calculate_mape(y_test, y_rf)) + ' %'
|
||||
mape[3] = str(calculate_mape(y_test, y_svr)) + ' %'
|
||||
mape_num = [0] * 4
|
||||
mape_num[0] = calculate_mape(y_test, y_linear)
|
||||
mape_num[1] = calculate_mape(y_test, y_poly)
|
||||
mape_num[2] = calculate_mape(y_test, y_rf)
|
||||
mape_num[3] = calculate_mape(y_test, y_svr)
|
||||
metode = ['Linear Regression', 'Polynomial Regression', 'Random Forest Regression', 'SVR']
|
||||
_method = ['linear', 'poly', 'rf', 'svr']
|
||||
test_result = []
|
||||
result = []
|
||||
for i in range(len(metode)):
|
||||
test_result.append({"metode":metode[i], "rmse":rmse[i], "mape":mape[i]})
|
||||
result.append({"method":_method[i], "rmse":rmse[i], "mape":mape_num[i]})
|
||||
|
||||
# check if minimal rmse not same with minimal mape so use minimal rmse for best method
|
||||
minimal_rmse = min(result, key=lambda x: x["rmse"])
|
||||
minimal_mape = min(result, key=lambda x: x["mape"])
|
||||
if(minimal_rmse["method"] != minimal_mape["method"]):
|
||||
best_method = minimal_rmse["method"]
|
||||
else:
|
||||
best_method = minimal_mape["method"]
|
||||
|
||||
# Save model with high accuracy
|
||||
joblib.dump(best_method, 'method.pkl')
|
||||
if(best_method == "linear"):
|
||||
joblib.dump(lin, 'regression_model.pkl')
|
||||
elif(best_method == "poly"):
|
||||
joblib.dump(lin2, 'regression_model.pkl')
|
||||
joblib.dump(poly, 'regression_model_poly.pkl')
|
||||
elif(best_method == "rf"):
|
||||
joblib.dump(regressor, 'regression_model.pkl')
|
||||
else:
|
||||
joblib.dump(regr, 'regression_model.pkl')
|
||||
|
||||
# response API
|
||||
respon = jsonify()
|
||||
respon.data = json.dumps({
|
||||
"code": 200,
|
||||
"status": 'Success',
|
||||
"message": "Berhasil testing model",
|
||||
"data_train": data_train,
|
||||
"data_test": data_test,
|
||||
"data_compare": data_compare,
|
||||
"test_result": test_result,
|
||||
"minimal_rmse": minimal_rmse,
|
||||
"minimal_mape": minimal_mape,
|
||||
"best_method": best_method,
|
||||
"actual_graph": actual_graph,
|
||||
"linear_graph": linear_graph,
|
||||
"poly_graph": poly_graph,
|
||||
"rf_graph": rf_graph,
|
||||
"svr_graph": svr_graph
|
||||
})
|
||||
respon.status_code = 200
|
||||
return respon
|
||||
|
||||
except Exception as e:
|
||||
print(str(e))
|
||||
|
||||
@app.errorhandler(HTTPException)
|
||||
def handle_exception(e):
|
||||
"""Return JSON instead of HTML for HTTP errors."""
|
||||
# start with the correct headers and status code from the error
|
||||
response = e.get_response()
|
||||
# replace the body with JSON
|
||||
response.data = json.dumps({
|
||||
"code": e.code,
|
||||
"name": e.name,
|
||||
"description": e.description,
|
||||
})
|
||||
response.content_type = "application/json"
|
||||
return response
|
||||
|
||||
if __name__ == "__main__":
|
||||
app.run(host="0.0.0.0",port=4000)
|
||||
BIN
api-regression-model-skripsi-main/method.pkl
Normal file
BIN
api-regression-model-skripsi-main/method.pkl
Normal file
Binary file not shown.
BIN
api-regression-model-skripsi-main/regression_model.pkl
Normal file
BIN
api-regression-model-skripsi-main/regression_model.pkl
Normal file
Binary file not shown.
BIN
api-regression-model-skripsi-main/regression_model_poly.pkl
Normal file
BIN
api-regression-model-skripsi-main/regression_model_poly.pkl
Normal file
Binary file not shown.
10
api-regression-model-skripsi-main/requirements.txt
Normal file
10
api-regression-model-skripsi-main/requirements.txt
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
flask==2.3.2
|
||||
flask-mysql==1.5.2
|
||||
flask-cors==3.0.10
|
||||
mysql-connector-python==8.0.33
|
||||
joblib==1.2.0
|
||||
scikit-learn==1.2.2
|
||||
scipy==1.10.1
|
||||
threadpoolctl==3.1.0
|
||||
SQLAlchemy==2.0.12
|
||||
greenlet==2.0.2
|
||||
BIN
api-regression-model-skripsi-main/split_data.pkl
Normal file
BIN
api-regression-model-skripsi-main/split_data.pkl
Normal file
Binary file not shown.
Binary file not shown.
18
mitra-panen-skripsi-main/.editorconfig
Normal file
18
mitra-panen-skripsi-main/.editorconfig
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
indent_size = 4
|
||||
indent_style = space
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
[*.{yml,yaml}]
|
||||
indent_size = 2
|
||||
|
||||
[docker-compose.yml]
|
||||
indent_size = 4
|
||||
58
mitra-panen-skripsi-main/.env.example
Normal file
58
mitra-panen-skripsi-main/.env.example
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
APP_NAME=Laravel
|
||||
APP_ENV=local
|
||||
APP_KEY=
|
||||
APP_DEBUG=true
|
||||
APP_URL=http://localhost
|
||||
|
||||
LOG_CHANNEL=stack
|
||||
LOG_DEPRECATIONS_CHANNEL=null
|
||||
LOG_LEVEL=debug
|
||||
|
||||
DB_CONNECTION=mysql
|
||||
DB_HOST=127.0.0.1
|
||||
DB_PORT=3306
|
||||
DB_DATABASE=skripsi_mitra_panen
|
||||
DB_USERNAME=root
|
||||
DB_PASSWORD=
|
||||
|
||||
BROADCAST_DRIVER=log
|
||||
CACHE_DRIVER=file
|
||||
FILESYSTEM_DISK=local
|
||||
QUEUE_CONNECTION=sync
|
||||
SESSION_DRIVER=file
|
||||
SESSION_LIFETIME=120
|
||||
|
||||
MEMCACHED_HOST=127.0.0.1
|
||||
|
||||
REDIS_HOST=127.0.0.1
|
||||
REDIS_PASSWORD=null
|
||||
REDIS_PORT=6379
|
||||
|
||||
MAIL_MAILER=smtp
|
||||
MAIL_HOST=mailpit
|
||||
MAIL_PORT=1025
|
||||
MAIL_USERNAME=null
|
||||
MAIL_PASSWORD=null
|
||||
MAIL_ENCRYPTION=null
|
||||
MAIL_FROM_ADDRESS="hello@example.com"
|
||||
MAIL_FROM_NAME="${APP_NAME}"
|
||||
|
||||
AWS_ACCESS_KEY_ID=
|
||||
AWS_SECRET_ACCESS_KEY=
|
||||
AWS_DEFAULT_REGION=us-east-1
|
||||
AWS_BUCKET=
|
||||
AWS_USE_PATH_STYLE_ENDPOINT=false
|
||||
|
||||
PUSHER_APP_ID=
|
||||
PUSHER_APP_KEY=
|
||||
PUSHER_APP_SECRET=
|
||||
PUSHER_HOST=
|
||||
PUSHER_PORT=443
|
||||
PUSHER_SCHEME=https
|
||||
PUSHER_APP_CLUSTER=mt1
|
||||
|
||||
VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
|
||||
VITE_PUSHER_HOST="${PUSHER_HOST}"
|
||||
VITE_PUSHER_PORT="${PUSHER_PORT}"
|
||||
VITE_PUSHER_SCHEME="${PUSHER_SCHEME}"
|
||||
VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
|
||||
11
mitra-panen-skripsi-main/.gitattributes
vendored
Normal file
11
mitra-panen-skripsi-main/.gitattributes
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
* text=auto
|
||||
|
||||
*.blade.php diff=html
|
||||
*.css diff=css
|
||||
*.html diff=html
|
||||
*.md diff=markdown
|
||||
*.php diff=php
|
||||
|
||||
/.github export-ignore
|
||||
CHANGELOG.md export-ignore
|
||||
.styleci.yml export-ignore
|
||||
18
mitra-panen-skripsi-main/.gitignore
vendored
Normal file
18
mitra-panen-skripsi-main/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
/node_modules
|
||||
/public/build
|
||||
/public/hot
|
||||
/public/storage
|
||||
/storage/*.key
|
||||
/vendor
|
||||
.env
|
||||
.env.backup
|
||||
.env.production
|
||||
.phpunit.result.cache
|
||||
Homestead.json
|
||||
Homestead.yaml
|
||||
auth.json
|
||||
npm-debug.log
|
||||
yarn-error.log
|
||||
/.fleet
|
||||
/.idea
|
||||
/.vscode
|
||||
66
mitra-panen-skripsi-main/README.md
Normal file
66
mitra-panen-skripsi-main/README.md
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
<p align="center"><a href="https://laravel.com" target="_blank"><img src="https://raw.githubusercontent.com/laravel/art/master/logo-lockup/5%20SVG/2%20CMYK/1%20Full%20Color/laravel-logolockup-cmyk-red.svg" width="400" alt="Laravel Logo"></a></p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://github.com/laravel/framework/actions"><img src="https://github.com/laravel/framework/workflows/tests/badge.svg" alt="Build Status"></a>
|
||||
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/dt/laravel/framework" alt="Total Downloads"></a>
|
||||
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/v/laravel/framework" alt="Latest Stable Version"></a>
|
||||
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/l/laravel/framework" alt="License"></a>
|
||||
</p>
|
||||
|
||||
## About Laravel
|
||||
|
||||
Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as:
|
||||
|
||||
- [Simple, fast routing engine](https://laravel.com/docs/routing).
|
||||
- [Powerful dependency injection container](https://laravel.com/docs/container).
|
||||
- Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage.
|
||||
- Expressive, intuitive [database ORM](https://laravel.com/docs/eloquent).
|
||||
- Database agnostic [schema migrations](https://laravel.com/docs/migrations).
|
||||
- [Robust background job processing](https://laravel.com/docs/queues).
|
||||
- [Real-time event broadcasting](https://laravel.com/docs/broadcasting).
|
||||
|
||||
Laravel is accessible, powerful, and provides tools required for large, robust applications.
|
||||
|
||||
## Learning Laravel
|
||||
|
||||
Laravel has the most extensive and thorough [documentation](https://laravel.com/docs) and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework.
|
||||
|
||||
You may also try the [Laravel Bootcamp](https://bootcamp.laravel.com), where you will be guided through building a modern Laravel application from scratch.
|
||||
|
||||
If you don't feel like reading, [Laracasts](https://laracasts.com) can help. Laracasts contains over 2000 video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library.
|
||||
|
||||
## Laravel Sponsors
|
||||
|
||||
We would like to extend our thanks to the following sponsors for funding Laravel development. If you are interested in becoming a sponsor, please visit the Laravel [Patreon page](https://patreon.com/taylorotwell).
|
||||
|
||||
### Premium Partners
|
||||
|
||||
- **[Vehikl](https://vehikl.com/)**
|
||||
- **[Tighten Co.](https://tighten.co)**
|
||||
- **[Kirschbaum Development Group](https://kirschbaumdevelopment.com)**
|
||||
- **[64 Robots](https://64robots.com)**
|
||||
- **[Cubet Techno Labs](https://cubettech.com)**
|
||||
- **[Cyber-Duck](https://cyber-duck.co.uk)**
|
||||
- **[Many](https://www.many.co.uk)**
|
||||
- **[Webdock, Fast VPS Hosting](https://www.webdock.io/en)**
|
||||
- **[DevSquad](https://devsquad.com)**
|
||||
- **[Curotec](https://www.curotec.com/services/technologies/laravel/)**
|
||||
- **[OP.GG](https://op.gg)**
|
||||
- **[WebReinvent](https://webreinvent.com/?utm_source=laravel&utm_medium=github&utm_campaign=patreon-sponsors)**
|
||||
- **[Lendio](https://lendio.com)**
|
||||
|
||||
## Contributing
|
||||
|
||||
Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions).
|
||||
|
||||
## Code of Conduct
|
||||
|
||||
In order to ensure that the Laravel community is welcoming to all, please review and abide by the [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct).
|
||||
|
||||
## Security Vulnerabilities
|
||||
|
||||
If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via [taylor@laravel.com](mailto:taylor@laravel.com). All security vulnerabilities will be promptly addressed.
|
||||
|
||||
## License
|
||||
|
||||
The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).
|
||||
32
mitra-panen-skripsi-main/app/Console/Kernel.php
Normal file
32
mitra-panen-skripsi-main/app/Console/Kernel.php
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
namespace App\Console;
|
||||
|
||||
use Illuminate\Console\Scheduling\Schedule;
|
||||
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
||||
|
||||
class Kernel extends ConsoleKernel
|
||||
{
|
||||
/**
|
||||
* Define the application's command schedule.
|
||||
*
|
||||
* @param \Illuminate\Console\Scheduling\Schedule $schedule
|
||||
* @return void
|
||||
*/
|
||||
protected function schedule(Schedule $schedule)
|
||||
{
|
||||
// $schedule->command('inspire')->hourly();
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the commands for the application.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function commands()
|
||||
{
|
||||
$this->load(__DIR__.'/Commands');
|
||||
|
||||
require base_path('routes/console.php');
|
||||
}
|
||||
}
|
||||
50
mitra-panen-skripsi-main/app/Exceptions/Handler.php
Normal file
50
mitra-panen-skripsi-main/app/Exceptions/Handler.php
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
<?php
|
||||
|
||||
namespace App\Exceptions;
|
||||
|
||||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
||||
use Throwable;
|
||||
|
||||
class Handler extends ExceptionHandler
|
||||
{
|
||||
/**
|
||||
* A list of exception types with their corresponding custom log levels.
|
||||
*
|
||||
* @var array<class-string<\Throwable>, \Psr\Log\LogLevel::*>
|
||||
*/
|
||||
protected $levels = [
|
||||
//
|
||||
];
|
||||
|
||||
/**
|
||||
* A list of the exception types that are not reported.
|
||||
*
|
||||
* @var array<int, class-string<\Throwable>>
|
||||
*/
|
||||
protected $dontReport = [
|
||||
//
|
||||
];
|
||||
|
||||
/**
|
||||
* A list of the inputs that are never flashed to the session on validation exceptions.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $dontFlash = [
|
||||
'current_password',
|
||||
'password',
|
||||
'password_confirmation',
|
||||
];
|
||||
|
||||
/**
|
||||
* Register the exception handling callbacks for the application.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
$this->reportable(function (Throwable $e) {
|
||||
//
|
||||
});
|
||||
}
|
||||
}
|
||||
32
mitra-panen-skripsi-main/app/Exports/SimulationExport.php
Normal file
32
mitra-panen-skripsi-main/app/Exports/SimulationExport.php
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
namespace App\Exports;
|
||||
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Maatwebsite\Excel\Concerns\FromView;
|
||||
|
||||
class SimulationExport implements FromView
|
||||
{
|
||||
/**
|
||||
* @return \Illuminate\Support\Collection
|
||||
*/
|
||||
public function view(): View
|
||||
{
|
||||
try {
|
||||
$url = config('app.api_python_url') . "/implements/result";
|
||||
$response = Http::get($url);
|
||||
$data = $response->json();
|
||||
$collection = collect($data);
|
||||
$table1 = collect($collection["table_simulation_1"]);
|
||||
$count = $table1->count();
|
||||
$table_name = ["table_simulation_1", "table_simulation_2", "table_simulation_3", "table_simulation_4", "table_simulation_5"];
|
||||
$table_name = collect($table_name);
|
||||
return view('mitra.table_simulation', compact('url', 'collection', 'count', 'table_name'));
|
||||
} catch (\Throwable $th) {
|
||||
$error = $th->getMessage();
|
||||
return view('mitra.error_table', compact('error'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,226 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\CommodityStoreRequest;
|
||||
use App\Http\Requests\CommodityUpdateRequest;
|
||||
use App\Models\FishType;
|
||||
use App\Traits\FileStore;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Yajra\DataTables\Facades\DataTables;
|
||||
use Illuminate\Support\Facades\File;
|
||||
|
||||
class CommodityController extends Controller
|
||||
{
|
||||
use FileStore;
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index(Request $request)
|
||||
{
|
||||
if ($request->ajax()) {
|
||||
// query get user data
|
||||
$query = FishType::get();
|
||||
|
||||
// setup datatable
|
||||
return DataTables::of($query)
|
||||
->addColumn('checkbox', function ($item) {
|
||||
$checkbox = '<input class="form-check-input id-check" type="checkbox" name="id[]" value="' . $item->id . '">';
|
||||
return $checkbox;
|
||||
})
|
||||
->addColumn('name', function ($item) {
|
||||
return $item->name;
|
||||
})
|
||||
->addColumn('latin_name', function ($item) {
|
||||
return $item->latin_name;
|
||||
})
|
||||
->addColumn('duration', function ($item) {
|
||||
return $item->duration_time;
|
||||
})
|
||||
->addColumn('actions', function ($item) {
|
||||
$button = ' <a href="' . route('commodity.show', $item->id) . '"
|
||||
class="btn btn-light btn-active-light-primary btn-sm">Show</a> ';
|
||||
return $button;
|
||||
})
|
||||
->rawColumns(['checkbox', 'name', 'latin_name', 'duration', 'actions'])
|
||||
->make(true);
|
||||
}
|
||||
return view('admin.commodity.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
return view('admin.commodity.create');
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(CommodityStoreRequest $request)
|
||||
{
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$commodity = new FishType();
|
||||
$commodity->name = $request->name;
|
||||
$commodity->latin_name = $request->latin_name;
|
||||
$commodity->duration = $request->duration_type == 'bulan' ? ($request->duration * 31) : $request->duration;
|
||||
$commodity->photo = $this->getPathFile($request->file('cover'), 'photo_commodity');
|
||||
|
||||
if($request->selling_price){
|
||||
$selling_price = str_replace('Rp ', '', $request->selling_price);
|
||||
$selling_price = str_replace('.', '', $selling_price);
|
||||
$commodity->selling_price = $selling_price;
|
||||
}
|
||||
|
||||
if($request->temp_bottom && $request->temp_up){
|
||||
$commodity->temperature = $request->temp_bottom . "-" . $request->temp_up;
|
||||
}
|
||||
|
||||
if($request->ph_bottom && $request->ph_up){
|
||||
$commodity->ph = $request->ph_bottom . "-" . $request->ph_up;
|
||||
}
|
||||
|
||||
if($request->water_height_bottom && $request->water_height_up){
|
||||
$commodity->water_height = $request->water_height_bottom . "-" . $request->water_height_up;
|
||||
}
|
||||
|
||||
$commodity->water_type = $request->water_type;
|
||||
$commodity->preparation_description = $request->preparation_description;
|
||||
$commodity->seeding_description = $request->seeding_description;
|
||||
$commodity->cutivation_description = $request->cutivation_description;
|
||||
$commodity->save();
|
||||
|
||||
DB::commit();
|
||||
return redirect()->route('commodity.index')->with('success', 'Berhasil menambahkan komoditas baru');
|
||||
} catch (\Throwable $th) {
|
||||
DB::rollback();
|
||||
return back()->with('toast_error', $th->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
$commodity = FishType::find($id);
|
||||
$temp = $commodity->temperature ? explode('-', $commodity->temperature) : [0,0];
|
||||
$ph = $commodity->ph ? explode('-', $commodity->ph) : [0,0];
|
||||
$water_height = $commodity->water_height ? explode('-', $commodity->water_height) : [0,0];
|
||||
return view('admin.commodity.show', compact('commodity', 'temp', 'ph', 'water_height'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$commodity = FishType::find($id);
|
||||
// $commodity->name = $request->name;
|
||||
// $commodity->latin_name = $request->latin_name;
|
||||
// $commodity->duration = $request->duration_type == 'bulan' ? ($request->duration * 31) : $request->duration;
|
||||
|
||||
if($request->file('cover')){
|
||||
File::delete(public_path("storage/".$commodity->photo));
|
||||
$commodity->photo = $this->getPathFile($request->file('cover'), 'photo_commodity');
|
||||
}
|
||||
|
||||
if($request->selling_price){
|
||||
$selling_price = str_replace('Rp ', '', $request->selling_price);
|
||||
$selling_price = str_replace('.', '', $selling_price);
|
||||
$commodity->selling_price = $selling_price;
|
||||
}
|
||||
|
||||
if($request->temp_bottom && $request->temp_up){
|
||||
$commodity->temperature = $request->temp_bottom . "-" . $request->temp_up;
|
||||
}
|
||||
|
||||
if($request->ph_bottom && $request->ph_up){
|
||||
$commodity->ph = $request->ph_bottom . "-" . $request->ph_up;
|
||||
}
|
||||
|
||||
if($request->water_height_bottom && $request->water_height_up){
|
||||
$commodity->water_height = $request->water_height_bottom . "-" . $request->water_height_up;
|
||||
}
|
||||
|
||||
$commodity->water_type = $request->water_type;
|
||||
$commodity->preparation_description = $request->preparation_description;
|
||||
$commodity->seeding_description = $request->seeding_description;
|
||||
$commodity->cutivation_description = $request->cutivation_description;
|
||||
$commodity->save();
|
||||
DB::commit();
|
||||
return redirect()->route('commodity.show', $commodity->id)->with('success', 'Berhasil update data komoditas');
|
||||
} catch (\Throwable $th) {
|
||||
DB::rollback();
|
||||
return back()->with('toast_error', $th->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
public function deleteCommodity(Request $request)
|
||||
{
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$commodities = FishType::whereIn('id', $request->commodity_id)->get();
|
||||
foreach ($commodities as $commodity) {
|
||||
File::delete(public_path("storage/".$commodity->photo));
|
||||
$commodity->delete();
|
||||
}
|
||||
|
||||
DB::commit();
|
||||
return response()->json([
|
||||
'status' => '200',
|
||||
'commodities' => $commodities,
|
||||
'message' => "komoditas berhasil dihapus",
|
||||
], 200);
|
||||
} catch (\Throwable $th) {
|
||||
DB::rollback();
|
||||
return response()->json([
|
||||
'status' => '500',
|
||||
'message' => $th->getMessage(),
|
||||
], 500);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\HarvestFish;
|
||||
use Illuminate\Http\Request;
|
||||
use Yajra\DataTables\Facades\DataTables;
|
||||
|
||||
class RegressionModelController extends Controller
|
||||
{
|
||||
public function train_model(Request $request)
|
||||
{
|
||||
if ($request->ajax()) {
|
||||
// query get user data
|
||||
$query = HarvestFish::get();
|
||||
|
||||
// setup datatable
|
||||
return DataTables::of($query)
|
||||
->addColumn('fish_type_id', function ($item) {
|
||||
return $item->fish_type_id;
|
||||
})
|
||||
->addColumn('seed_amount', function ($item) {
|
||||
return $item->seed_amount;
|
||||
})
|
||||
->addColumn('seed_weight', function ($item) {
|
||||
return $item->seed_weight;
|
||||
})
|
||||
->addColumn('survival_rate', function ($item) {
|
||||
return $item->survival_rate;
|
||||
})
|
||||
->addColumn('average_weight', function ($item) {
|
||||
return $item->average_weight;
|
||||
})
|
||||
->addColumn('pond_volume', function ($item) {
|
||||
return $item->pond_volume;
|
||||
})
|
||||
->addColumn('total_feed_spent', function ($item) {
|
||||
return $item->total_feed_spent;
|
||||
})
|
||||
->addColumn('harvest_amount', function ($item) {
|
||||
return $item->harvest_amount;
|
||||
})
|
||||
->rawColumns(['fish_type_id', 'seed_amount', 'seed_weight', 'survival_rate', 'average_weight', 'pond_volume', 'total_feed_spent', 'harvest_amount'])
|
||||
->make(true);
|
||||
}
|
||||
return view('admin.regression_model.train_model');
|
||||
}
|
||||
|
||||
public function test_model()
|
||||
{
|
||||
return view('admin.regression_model.test_model');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,195 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\UserStoreRequest;
|
||||
use App\Http\Requests\UserUpdateRequest;
|
||||
use App\Models\User;
|
||||
use App\Traits\FileStore;
|
||||
use App\Traits\PhoneNumberFormatter;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Yajra\DataTables\Facades\DataTables;
|
||||
use Illuminate\Support\Facades\File;
|
||||
|
||||
class UserController extends Controller
|
||||
{
|
||||
use PhoneNumberFormatter, FileStore;
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index(Request $request)
|
||||
{
|
||||
if ($request->ajax()) {
|
||||
// query get user data
|
||||
$query = User::when($request->filter, function ($query) use ($request) {
|
||||
if ($request->filter == 'admin') {
|
||||
$query->where('role', User::ADMIN);
|
||||
} else if ($request->filter == 'mitra') {
|
||||
$query->where('role', User::MITRA);
|
||||
}
|
||||
})->get();
|
||||
|
||||
// setup datatable
|
||||
return DataTables::of($query)
|
||||
->addColumn('checkbox', function ($item) {
|
||||
$checkbox = '<input class="form-check-input id-check" type="checkbox" name="id[]" value="' . $item->id . '">';
|
||||
return $checkbox;
|
||||
})
|
||||
->addColumn('name', function ($item) {
|
||||
return $item->name;
|
||||
})
|
||||
->addColumn('joinedSince', function ($item) {
|
||||
return $item->joined_since;
|
||||
})
|
||||
->addColumn('role', function ($item) {
|
||||
return $item->role_name;
|
||||
})
|
||||
->addColumn('phonenumber', function ($item) {
|
||||
return $item->phone_number;
|
||||
})
|
||||
->addColumn('pondsAmount', function ($item) {
|
||||
return $item->ponds_amount;
|
||||
})
|
||||
->addColumn('actions', function ($item) {
|
||||
$button = ' <a href="' . route('user.show', $item->id) . '"
|
||||
class="btn btn-light btn-active-light-primary btn-sm">Show</a> ';
|
||||
return $button;
|
||||
})
|
||||
->rawColumns(['checkbox', 'name', 'joinedSince', 'role', 'phonenumber', 'actions'])
|
||||
->make(true);
|
||||
}
|
||||
return view('admin.users.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
return view('admin.users.create');
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(UserStoreRequest $request)
|
||||
{
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$user = new User();
|
||||
$user->avatar = $this->getPathFile($request->file('avatar'), 'avatar');
|
||||
$user->name = $request->name;
|
||||
$user->email = $request->email;
|
||||
$user->phone_number = $this->format($request->phone_number);
|
||||
$user->role = $request->role;
|
||||
$user->password = Hash::make($request->password);
|
||||
$user->save();
|
||||
DB::commit();
|
||||
return redirect()->route('user.index')->with('success', 'Berhasil menambahkan user baru');
|
||||
} catch (\Throwable $th) {
|
||||
DB::rollback();
|
||||
return back()->with('toast_error', $th->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
$user = User::find($id);
|
||||
return view('admin.users.show', compact('user'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(UserUpdateRequest $request, $id)
|
||||
{
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$user = User::find($id);
|
||||
|
||||
if($request->file('avatar')){
|
||||
File::delete(public_path("storage/".$user->avatar));
|
||||
$user->avatar = $this->getPathFile($request->file('avatar'), 'avatar');
|
||||
}
|
||||
|
||||
$user->name = $request->name;
|
||||
$user->email = $request->email;
|
||||
$user->phone_number = $this->format($request->phone_number);
|
||||
$user->role = $request->role;
|
||||
$user->save();
|
||||
|
||||
DB::commit();
|
||||
return redirect()->route('user.show', $user->id)->with('success', 'Berhasil update data user');
|
||||
} catch (\Throwable $th) {
|
||||
DB::rollback();
|
||||
return back()->with('toast_error', $th->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
public function deleteUser(Request $request)
|
||||
{
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$users = User::whereIn('id', $request->user_id)->get();
|
||||
foreach ($users as $user) {
|
||||
File::delete(public_path("storage/".$user->avatar));
|
||||
$user->delete();
|
||||
}
|
||||
|
||||
DB::commit();
|
||||
return response()->json([
|
||||
'status' => '200',
|
||||
'users' => $users,
|
||||
'message' => "user berhasil dihapus",
|
||||
], 200);
|
||||
} catch (\Throwable $th) {
|
||||
DB::rollback();
|
||||
return response()->json([
|
||||
'status' => '500',
|
||||
'message' => $th->getMessage(),
|
||||
], 500);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Providers\RouteServiceProvider;
|
||||
use Illuminate\Foundation\Auth\ConfirmsPasswords;
|
||||
|
||||
class ConfirmPasswordController extends Controller
|
||||
{
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Confirm Password Controller
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This controller is responsible for handling password confirmations and
|
||||
| uses a simple trait to include the behavior. You're free to explore
|
||||
| this trait and override any functions that require customization.
|
||||
|
|
||||
*/
|
||||
|
||||
use ConfirmsPasswords;
|
||||
|
||||
/**
|
||||
* Where to redirect users when the intended url fails.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $redirectTo = RouteServiceProvider::HOME;
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
|
||||
|
||||
class ForgotPasswordController extends Controller
|
||||
{
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Password Reset Controller
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This controller is responsible for handling password reset emails and
|
||||
| includes a trait which assists in sending these notifications from
|
||||
| your application to your users. Feel free to explore this trait.
|
||||
|
|
||||
*/
|
||||
|
||||
use SendsPasswordResetEmails;
|
||||
}
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Providers\RouteServiceProvider;
|
||||
use Illuminate\Foundation\Auth\AuthenticatesUsers;
|
||||
|
||||
class LoginController extends Controller
|
||||
{
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Login Controller
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This controller handles authenticating users for the application and
|
||||
| redirecting them to your home screen. The controller uses a trait
|
||||
| to conveniently provide its functionality to your applications.
|
||||
|
|
||||
*/
|
||||
|
||||
use AuthenticatesUsers;
|
||||
|
||||
/**
|
||||
* Where to redirect users after login.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $redirectTo = RouteServiceProvider::HOME;
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('guest')->except('logout');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,73 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Providers\RouteServiceProvider;
|
||||
use App\Models\User;
|
||||
use Illuminate\Foundation\Auth\RegistersUsers;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
|
||||
class RegisterController extends Controller
|
||||
{
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Register Controller
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This controller handles the registration of new users as well as their
|
||||
| validation and creation. By default this controller uses a trait to
|
||||
| provide this functionality without requiring any additional code.
|
||||
|
|
||||
*/
|
||||
|
||||
use RegistersUsers;
|
||||
|
||||
/**
|
||||
* Where to redirect users after registration.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $redirectTo = RouteServiceProvider::HOME;
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('guest');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a validator for an incoming registration request.
|
||||
*
|
||||
* @param array $data
|
||||
* @return \Illuminate\Contracts\Validation\Validator
|
||||
*/
|
||||
protected function validator(array $data)
|
||||
{
|
||||
return Validator::make($data, [
|
||||
'name' => ['required', 'string', 'max:255'],
|
||||
'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
|
||||
'password' => ['required', 'string', 'min:8', 'confirmed'],
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new user instance after a valid registration.
|
||||
*
|
||||
* @param array $data
|
||||
* @return \App\Models\User
|
||||
*/
|
||||
protected function create(array $data)
|
||||
{
|
||||
return User::create([
|
||||
'name' => $data['name'],
|
||||
'email' => $data['email'],
|
||||
'password' => Hash::make($data['password']),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Providers\RouteServiceProvider;
|
||||
use Illuminate\Foundation\Auth\ResetsPasswords;
|
||||
|
||||
class ResetPasswordController extends Controller
|
||||
{
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Password Reset Controller
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This controller is responsible for handling password reset requests
|
||||
| and uses a simple trait to include this behavior. You're free to
|
||||
| explore this trait and override any methods you wish to tweak.
|
||||
|
|
||||
*/
|
||||
|
||||
use ResetsPasswords;
|
||||
|
||||
/**
|
||||
* Where to redirect users after resetting their password.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $redirectTo = RouteServiceProvider::HOME;
|
||||
}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Providers\RouteServiceProvider;
|
||||
use Illuminate\Foundation\Auth\VerifiesEmails;
|
||||
|
||||
class VerificationController extends Controller
|
||||
{
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Email Verification Controller
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This controller is responsible for handling email verification for any
|
||||
| user that recently registered with the application. Emails may also
|
||||
| be re-sent if the user didn't receive the original email message.
|
||||
|
|
||||
*/
|
||||
|
||||
use VerifiesEmails;
|
||||
|
||||
/**
|
||||
* Where to redirect users after verification.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $redirectTo = RouteServiceProvider::HOME;
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth');
|
||||
$this->middleware('signed')->only('verify');
|
||||
$this->middleware('throttle:6,1')->only('verify', 'resend');
|
||||
}
|
||||
}
|
||||
13
mitra-panen-skripsi-main/app/Http/Controllers/Controller.php
Normal file
13
mitra-panen-skripsi-main/app/Http/Controllers/Controller.php
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||
use Illuminate\Foundation\Validation\ValidatesRequests;
|
||||
use Illuminate\Routing\Controller as BaseController;
|
||||
|
||||
class Controller extends BaseController
|
||||
{
|
||||
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
|
||||
}
|
||||
138
mitra-panen-skripsi-main/app/Http/Controllers/HomeController.php
Normal file
138
mitra-panen-skripsi-main/app/Http/Controllers/HomeController.php
Normal file
|
|
@ -0,0 +1,138 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\Requests\UpdatePasswordRequest;
|
||||
use App\Models\FishType;
|
||||
use App\Models\HarvestFish;
|
||||
use App\Models\User;
|
||||
use App\Traits\FileStore;
|
||||
use App\Traits\PhoneNumberFormatter;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\File;
|
||||
|
||||
class HomeController extends Controller
|
||||
{
|
||||
use PhoneNumberFormatter, FileStore;
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the application dashboard.
|
||||
*
|
||||
* @return \Illuminate\Contracts\Support\Renderable
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$role = Auth::user()->role;
|
||||
if ($role == User::ADMIN) {
|
||||
toast()->success('Success', 'Berhasil login sebagai Admin');
|
||||
} else if ($role == User::MITRA) {
|
||||
toast()->success('Success', 'Berhasil login sebagai mitra');
|
||||
} else {
|
||||
alert()->error('Error', 'Terjadi kesalahan saat login');
|
||||
return redirect()->to('/');
|
||||
}
|
||||
return redirect()->route('home');
|
||||
}
|
||||
|
||||
public function home()
|
||||
{
|
||||
if (Auth::user()->role == User::ADMIN) {
|
||||
// count data
|
||||
$users = User::all()->count();
|
||||
$mitra = User::where('role', User::MITRA)->count();
|
||||
$admin = User::where('role', User::ADMIN)->count();
|
||||
$commodity = FishType::all()->count();
|
||||
return view('admin.home_admin', compact('users', 'mitra', 'admin', 'commodity'));
|
||||
} else {
|
||||
return view('home');
|
||||
}
|
||||
}
|
||||
|
||||
public function getData()
|
||||
{
|
||||
// get data sr commodity
|
||||
$fish_id = HarvestFish::distinct()->pluck('fish_type_id');
|
||||
$fish_type = [];
|
||||
$fish_sr = [];
|
||||
$fish_harvest = [];
|
||||
foreach ($fish_id as $id) {
|
||||
$harvest = HarvestFish::where('fish_type_id', $id)->get();
|
||||
if (count($harvest) > 1) {
|
||||
// calculate average sr
|
||||
$all_sr = HarvestFish::where('fish_type_id', $id)->pluck('survival_rate')->toArray();
|
||||
$sr = array_sum($all_sr) / count($all_sr);
|
||||
|
||||
// calculate harvest amount
|
||||
$all_harvest = HarvestFish::where('fish_type_id', $id)->pluck('harvest_amount')->toArray();
|
||||
$harvest_amount = array_sum($all_harvest) / count($all_harvest);
|
||||
|
||||
// push data to array
|
||||
array_push($fish_type, $harvest->first()->fish->name);
|
||||
array_push($fish_sr, $sr);
|
||||
array_push($fish_harvest, $harvest_amount);
|
||||
}
|
||||
}
|
||||
$series = [];
|
||||
$series[] = [
|
||||
"name" => 'Survival Rate (%)',
|
||||
"data" => $fish_sr
|
||||
];
|
||||
|
||||
$series_harvest = [];
|
||||
$series_harvest[] = [
|
||||
"name" => 'Rata-Rata Hasil Panen (kg)',
|
||||
"data" => $fish_harvest
|
||||
];
|
||||
return response()->json(['fish_type' => $fish_type, 'series' => $series, 'series_harvest' => $series_harvest]);
|
||||
}
|
||||
|
||||
public function profile()
|
||||
{
|
||||
return view('profile');
|
||||
}
|
||||
|
||||
public function updateProfile(Request $request)
|
||||
{
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$user = User::find(Auth::user()->id);
|
||||
|
||||
if ($request->file('avatar')) {
|
||||
File::delete(public_path("storage/" . $user->avatar));
|
||||
$user->avatar = $this->getPathFile($request->file('avatar'), 'avatar');
|
||||
}
|
||||
|
||||
$user->name = $request->name;
|
||||
$user->email = $request->email;
|
||||
$user->phone_number = $this->format($request->phone_number);
|
||||
$user->save();
|
||||
|
||||
DB::commit();
|
||||
return redirect()->route('profile')->with('success', 'Berhasil update profile');
|
||||
} catch (\Throwable $th) {
|
||||
DB::rollback();
|
||||
return back()->with('toast_error', $th->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function updatePassword(UpdatePasswordRequest $request)
|
||||
{
|
||||
$request->user()->update([
|
||||
'password' => Hash::make($request->get('password'))
|
||||
]);
|
||||
|
||||
return redirect()->route('profile')->with('success', 'Berhasil Mengganti Password');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,256 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Mitra;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Cultivation;
|
||||
use App\Models\FishType;
|
||||
use App\Models\HarvestFish;
|
||||
use App\Models\Pond;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Yajra\DataTables\Facades\DataTables;
|
||||
|
||||
class CultivationController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index(Request $request)
|
||||
{
|
||||
// automated update status pond
|
||||
$today = Carbon::today();
|
||||
$ponds = Pond::where('user_id', Auth::user()->id)->get();
|
||||
foreach ($ponds as $pond) {
|
||||
$sow_date = Carbon::parse($pond->sow_date);
|
||||
$diffInDays = $today->diffInDays($sow_date);
|
||||
$diffInDays += 1;
|
||||
$max_day = $pond->cultivations->max('day');
|
||||
if ($diffInDays >= $max_day) {
|
||||
$pond->status = Pond::HARVEST;
|
||||
$pond->save();
|
||||
}
|
||||
}
|
||||
|
||||
if ($request->ajax()) {
|
||||
// query get user data
|
||||
$query = Pond::where('user_id', Auth::user()->id)->get();
|
||||
|
||||
// setup datatable
|
||||
return DataTables::of($query)
|
||||
->addColumn('checkbox', function ($item) {
|
||||
$checkbox = '<input class="form-check-input id-check" type="checkbox" name="id[]" value="' . $item->id . '">';
|
||||
return $checkbox;
|
||||
})
|
||||
->addColumn('name', function ($item) {
|
||||
return $item->name;
|
||||
})
|
||||
->addColumn('sow_date', function ($item) {
|
||||
return $item->date_sow;
|
||||
})
|
||||
->addColumn('seed_amount', function ($item) {
|
||||
return $item->seed_amount;
|
||||
})
|
||||
->addColumn('volume_pond', function ($item) {
|
||||
return $item->volume_pond;
|
||||
})
|
||||
->addColumn('status', function ($item) {
|
||||
$status = '';
|
||||
if ($item->status == Pond::PROCESS) {
|
||||
$status = '<span class="badge badge-info">Proses</span>';
|
||||
} else if ($item->status == Pond::HARVEST) {
|
||||
$status = '<span class="badge badge-light-warning">Panen</span>';
|
||||
} else {
|
||||
$status = '<span class="badge badge-light-danger">Nonaktif</span>';
|
||||
}
|
||||
return $status;
|
||||
})
|
||||
->addColumn('actions', function ($item) {
|
||||
$button = ' <a href="' . route('cultivation.show', $item->id) . '"
|
||||
class="btn btn-light btn-active-light-primary btn-sm">Show</a> ';
|
||||
return $button;
|
||||
})
|
||||
->rawColumns(['checkbox', 'name', 'sow_date', 'seed_amount', 'volume_pond', 'status', 'actions'])
|
||||
->make(true);
|
||||
}
|
||||
return view('mitra.cultivation.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$fish_type = FishType::all();
|
||||
return view('mitra.cultivation.create', compact('fish_type'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
// set data
|
||||
$fish_id = $request->fish_type;
|
||||
$seed_amount = $request->seed_amount;
|
||||
$seed_weight = $request->seed_weight;
|
||||
$pond_volume = $request->pond_volume;
|
||||
$total_fish_count = $request->total_fish_count;
|
||||
$survival_rate = HarvestFish::where('fish_type_id', $fish_id)->avg('survival_rate');
|
||||
$survival_rate = round($survival_rate, 1);
|
||||
$average_weight = 1000 / $total_fish_count;
|
||||
$average_weight = round($average_weight, 1);
|
||||
|
||||
// get data prediction from API
|
||||
$url = config('app.api_python_url') . "/implements/prediction";
|
||||
$response = Http::get($url, [
|
||||
'fish_id' => $fish_id,
|
||||
'seed_amount' => $seed_amount,
|
||||
'seed_weight' => $seed_weight,
|
||||
'pond_volume' => $pond_volume,
|
||||
'total_fish_count' => $total_fish_count,
|
||||
'survival_rate' => $survival_rate
|
||||
]);
|
||||
|
||||
// check response successfull
|
||||
if ($response->successful()) {
|
||||
$data = $response->json();
|
||||
$simulation_table = $data['simulation_table'];
|
||||
$prediction = $data['predict'];
|
||||
$total_feed_spent = $data['total_feed_spent'];
|
||||
} else {
|
||||
// if request failed
|
||||
return back()->with('toast_error', "Terdapat Error pada API Python");
|
||||
}
|
||||
|
||||
// new pond
|
||||
$pond = new Pond();
|
||||
$pond->user_id = Auth::user()->id;
|
||||
$pond->fish_id = $request->fish_type;
|
||||
$pond->name = $this->generateName($fish_id, Auth::user()->id);
|
||||
$pond->sow_date = $request->sow_date;
|
||||
$pond->seed_amount = $seed_amount;
|
||||
$pond->seed_weight = $seed_weight;
|
||||
$pond->survival_rate = $survival_rate;
|
||||
$pond->volume_pond = $pond_volume;
|
||||
$pond->average_weight = $average_weight;
|
||||
$pond->total_feed_spent = $total_feed_spent;
|
||||
$pond->prediction = $prediction;
|
||||
$pond->status = Pond::PROCESS;
|
||||
$pond->save();
|
||||
|
||||
// new cultivation
|
||||
foreach ($simulation_table as $value) {
|
||||
$cultivation = new Cultivation();
|
||||
$cultivation->pond_id = $pond->id;
|
||||
$cultivation->day = $value['day'];
|
||||
$cultivation->weight = $value['weight'];
|
||||
$cultivation->feed_spent = $value['feed_spent'];
|
||||
$cultivation->total_feed_spent = $value['total_feed_spent'];
|
||||
$cultivation->total_fish_weight = $value['total_weight'];
|
||||
$cultivation->save();
|
||||
}
|
||||
DB::commit();
|
||||
return redirect()->route('cultivation.index')->with('success', 'Berhasil menambahkan budidaya baru');
|
||||
} catch (\Throwable $th) {
|
||||
DB::rollback();
|
||||
return back()->with('toast_error', $th->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
$pond = Pond::find($id);
|
||||
$today = Carbon::today();
|
||||
$today_date = Carbon::today()->locale('id')->isoFormat('D MMMM Y');
|
||||
$sow_date = Carbon::parse($pond->sow_date);
|
||||
$diffInDays = $today->diffInDays($sow_date);
|
||||
$diffInDays += 1;
|
||||
if($pond->status == Pond::PROCESS){
|
||||
$cultivation = Cultivation::where([['pond_id', $pond->id], ['day', $diffInDays]])->first();
|
||||
} else {
|
||||
$cultivation = Cultivation::where([['pond_id', $pond->id]])->latest()->first();
|
||||
}
|
||||
return view('mitra.cultivation.show', compact('pond', 'cultivation', 'today_date'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
public function generateName($fish_id, $user_id)
|
||||
{
|
||||
$pond_count = Pond::where([['user_id', $user_id], ['fish_id', $fish_id]])->count();
|
||||
$pond_count += 1;
|
||||
$fish_name = FishType::find($fish_id)->name;
|
||||
$pond_name = "Kolam " . $fish_name . " " . $pond_count;
|
||||
return $pond_name;
|
||||
}
|
||||
|
||||
public function getChartSimulation(Request $request)
|
||||
{
|
||||
$pond = Pond::find($request->pond_id);
|
||||
$data_weight = [];
|
||||
$data_feed = [];
|
||||
foreach($pond->cultivations as $data){
|
||||
$data_weight[] = [
|
||||
"x" => $data->day,
|
||||
"y" => $data->weight
|
||||
];
|
||||
|
||||
$data_feed[] = [
|
||||
"x" => $data->day,
|
||||
"y" => $data->feed_spent
|
||||
];
|
||||
}
|
||||
return response()->json(['data_weight'=>$data_weight, 'data_feed'=>$data_feed]);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,126 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Mitra;
|
||||
|
||||
use App\Exports\SimulationExport;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\FishType;
|
||||
use App\Models\HarvestFish;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
|
||||
class PredictionController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$fish_type = FishType::all();
|
||||
return view('mitra.index_prediction', compact('fish_type'));
|
||||
}
|
||||
|
||||
public function getRangeSr(Request $request)
|
||||
{
|
||||
$sr = HarvestFish::where('fish_type_id', $request->fish_id)->pluck('survival_rate')->toArray();
|
||||
$max_sr = max($sr);
|
||||
$min_sr = min($sr);
|
||||
return response()->json([
|
||||
'max_sr' => $max_sr,
|
||||
'min_sr' => $min_sr
|
||||
]);
|
||||
}
|
||||
|
||||
public function getFishDesc(Request $request)
|
||||
{
|
||||
$fish = FishType::find($request->fish_id);
|
||||
return response()->json([
|
||||
"preparation" => $fish->preparation_description,
|
||||
"seeding" => $fish->seeding_description,
|
||||
"cultivation" => $fish->cutivation_description
|
||||
]);
|
||||
}
|
||||
|
||||
public function getVolumePond(Request $request)
|
||||
{
|
||||
if ($request->seed_amount) {
|
||||
if ($request->seed_amount == 1000 || $request->seed_amount == 1500 || $request->seed_amount == 2000) {
|
||||
$seed_amount = $request->seed_amount;
|
||||
$check = 0;
|
||||
} else {
|
||||
$seed_amount = 1000;
|
||||
$check = 1;
|
||||
}
|
||||
$volume = HarvestFish::where([['fish_type_id', $request->fish_id], ['seed_amount', $seed_amount]])->distinct()->orderBy('pond_volume')->pluck('pond_volume');
|
||||
$data = [];
|
||||
foreach ($volume as $v) {
|
||||
if ($check == 1) {
|
||||
$v = $request->seed_amount / 1000 * $v;
|
||||
$v = round($v, 2);
|
||||
}
|
||||
$data[] = [
|
||||
'id' => $v,
|
||||
'text' => $v
|
||||
];
|
||||
}
|
||||
} else {
|
||||
$volume = HarvestFish::where('fish_type_id', $request->fish_id)->distinct()->orderBy('pond_volume')->pluck('pond_volume');
|
||||
$data = [];
|
||||
foreach ($volume as $v) {
|
||||
$data[] = [
|
||||
'id' => $v,
|
||||
'text' => $v
|
||||
];
|
||||
}
|
||||
}
|
||||
return response()->json(['results' => $data]);
|
||||
}
|
||||
|
||||
public function getTotalFishCount(Request $request)
|
||||
{
|
||||
$data = [];
|
||||
if ($request->fish_id == 1) {
|
||||
$fish_count = [7, 8, 9, 10];
|
||||
foreach ($fish_count as $f) {
|
||||
$weight = round(1000 / $f, 1);
|
||||
$text = strval($weight) . " gram (" . strval($f) . " ekor dalam 1kg penjualan)";
|
||||
$data[] = [
|
||||
'id' => $f,
|
||||
'text' => $text
|
||||
];
|
||||
}
|
||||
} else if ($request->fish_id == 2 || $request->fish_id == 3) {
|
||||
$fish_count = [2, 3, 4];
|
||||
foreach ($fish_count as $f) {
|
||||
$weight = round(1000 / $f, 1);
|
||||
$text = strval($weight) . " gram (" . strval($f) . " ekor dalam 1kg penjualan)";
|
||||
$data[] = [
|
||||
'id' => $f,
|
||||
'text' => $text
|
||||
];
|
||||
}
|
||||
} else {
|
||||
$data[] = [
|
||||
'id' => 10,
|
||||
'text' => 10
|
||||
];
|
||||
}
|
||||
return response()->json(['results' => $data]);
|
||||
}
|
||||
|
||||
public function downloadExcel()
|
||||
{
|
||||
return Excel::download(new SimulationExport, 'simulation_data.xlsx');
|
||||
// $url = config('app.api_python_url') . "/implements/result";
|
||||
// $response = Http::get($url);
|
||||
// if ($response->successful()) {
|
||||
// $data = $response->json();
|
||||
// $collection = collect($data);
|
||||
// $table1 = collect($collection["table_simulation_1"]);
|
||||
// $count = $table1->count();
|
||||
// $table_name = ["table_simulation_1", "table_simulation_2", "table_simulation_3", "table_simulation_4", "table_simulation_5"];
|
||||
// $table_name = collect($table_name);
|
||||
// return view('mitra.table_simulation', compact('url', 'collection', 'count', 'table_name'));
|
||||
// } else {
|
||||
// return back()->withErrors("Terjadi Error Get API");
|
||||
// }
|
||||
}
|
||||
}
|
||||
70
mitra-panen-skripsi-main/app/Http/Kernel.php
Normal file
70
mitra-panen-skripsi-main/app/Http/Kernel.php
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http;
|
||||
|
||||
use Illuminate\Foundation\Http\Kernel as HttpKernel;
|
||||
|
||||
class Kernel extends HttpKernel
|
||||
{
|
||||
/**
|
||||
* The application's global HTTP middleware stack.
|
||||
*
|
||||
* These middleware are run during every request to your application.
|
||||
*
|
||||
* @var array<int, class-string|string>
|
||||
*/
|
||||
protected $middleware = [
|
||||
// \App\Http\Middleware\TrustHosts::class,
|
||||
\App\Http\Middleware\TrustProxies::class,
|
||||
\Illuminate\Http\Middleware\HandleCors::class,
|
||||
\App\Http\Middleware\PreventRequestsDuringMaintenance::class,
|
||||
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
|
||||
\App\Http\Middleware\TrimStrings::class,
|
||||
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
|
||||
];
|
||||
|
||||
/**
|
||||
* The application's route middleware groups.
|
||||
*
|
||||
* @var array<string, array<int, class-string|string>>
|
||||
*/
|
||||
protected $middlewareGroups = [
|
||||
'web' => [
|
||||
\App\Http\Middleware\EncryptCookies::class,
|
||||
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
|
||||
\Illuminate\Session\Middleware\StartSession::class,
|
||||
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
|
||||
\App\Http\Middleware\VerifyCsrfToken::class,
|
||||
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||
\RealRashid\SweetAlert\ToSweetAlert::class,
|
||||
],
|
||||
|
||||
'api' => [
|
||||
// \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,
|
||||
'throttle:api',
|
||||
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* The application's route middleware.
|
||||
*
|
||||
* These middleware may be assigned to groups or used individually.
|
||||
*
|
||||
* @var array<string, class-string|string>
|
||||
*/
|
||||
protected $routeMiddleware = [
|
||||
'auth' => \App\Http\Middleware\Authenticate::class,
|
||||
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
|
||||
'auth.session' => \Illuminate\Session\Middleware\AuthenticateSession::class,
|
||||
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
|
||||
'can' => \Illuminate\Auth\Middleware\Authorize::class,
|
||||
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
|
||||
'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class,
|
||||
'signed' => \App\Http\Middleware\ValidateSignature::class,
|
||||
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
|
||||
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
|
||||
'admin' => \App\Http\Middleware\AdminMiddleware::class,
|
||||
'mitra' => \App\Http\Middleware\MitraMiddleware::class,
|
||||
];
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use App\Models\User;
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use RealRashid\SweetAlert\Facades\Alert;
|
||||
|
||||
class AdminMiddleware
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next
|
||||
* @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function handle(Request $request, Closure $next)
|
||||
{
|
||||
if(Auth::user()->role != User::ADMIN){
|
||||
alert()->error('Error',"Maaf Anda tidak memiliki akses sebagai Admin!");
|
||||
return back();
|
||||
}
|
||||
return $next($request);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Auth\Middleware\Authenticate as Middleware;
|
||||
|
||||
class Authenticate extends Middleware
|
||||
{
|
||||
/**
|
||||
* Get the path the user should be redirected to when they are not authenticated.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return string|null
|
||||
*/
|
||||
protected function redirectTo($request)
|
||||
{
|
||||
if (! $request->expectsJson()) {
|
||||
return route('login');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Cookie\Middleware\EncryptCookies as Middleware;
|
||||
|
||||
class EncryptCookies extends Middleware
|
||||
{
|
||||
/**
|
||||
* The names of the cookies that should not be encrypted.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $except = [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use App\Models\User;
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use RealRashid\SweetAlert\Facades\Alert;
|
||||
|
||||
class MitraMiddleware
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next
|
||||
* @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function handle(Request $request, Closure $next)
|
||||
{
|
||||
if(Auth::user()->role != User::MITRA){
|
||||
alert()->error('Error',"Maaf Anda tidak memiliki akses sebagai Mitra!");
|
||||
return back();
|
||||
}
|
||||
return $next($request);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance as Middleware;
|
||||
|
||||
class PreventRequestsDuringMaintenance extends Middleware
|
||||
{
|
||||
/**
|
||||
* The URIs that should be reachable while maintenance mode is enabled.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $except = [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use App\Providers\RouteServiceProvider;
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class RedirectIfAuthenticated
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next
|
||||
* @param string|null ...$guards
|
||||
* @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function handle(Request $request, Closure $next, ...$guards)
|
||||
{
|
||||
$guards = empty($guards) ? [null] : $guards;
|
||||
|
||||
foreach ($guards as $guard) {
|
||||
if (Auth::guard($guard)->check()) {
|
||||
return redirect(RouteServiceProvider::HOME);
|
||||
}
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
}
|
||||
19
mitra-panen-skripsi-main/app/Http/Middleware/TrimStrings.php
Normal file
19
mitra-panen-skripsi-main/app/Http/Middleware/TrimStrings.php
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Foundation\Http\Middleware\TrimStrings as Middleware;
|
||||
|
||||
class TrimStrings extends Middleware
|
||||
{
|
||||
/**
|
||||
* The names of the attributes that should not be trimmed.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $except = [
|
||||
'current_password',
|
||||
'password',
|
||||
'password_confirmation',
|
||||
];
|
||||
}
|
||||
20
mitra-panen-skripsi-main/app/Http/Middleware/TrustHosts.php
Normal file
20
mitra-panen-skripsi-main/app/Http/Middleware/TrustHosts.php
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Http\Middleware\TrustHosts as Middleware;
|
||||
|
||||
class TrustHosts extends Middleware
|
||||
{
|
||||
/**
|
||||
* Get the host patterns that should be trusted.
|
||||
*
|
||||
* @return array<int, string|null>
|
||||
*/
|
||||
public function hosts()
|
||||
{
|
||||
return [
|
||||
$this->allSubdomainsOfApplicationUrl(),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Http\Middleware\TrustProxies as Middleware;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class TrustProxies extends Middleware
|
||||
{
|
||||
/**
|
||||
* The trusted proxies for this application.
|
||||
*
|
||||
* @var array<int, string>|string|null
|
||||
*/
|
||||
protected $proxies;
|
||||
|
||||
/**
|
||||
* The headers that should be used to detect proxies.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $headers =
|
||||
Request::HEADER_X_FORWARDED_FOR |
|
||||
Request::HEADER_X_FORWARDED_HOST |
|
||||
Request::HEADER_X_FORWARDED_PORT |
|
||||
Request::HEADER_X_FORWARDED_PROTO |
|
||||
Request::HEADER_X_FORWARDED_AWS_ELB;
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Routing\Middleware\ValidateSignature as Middleware;
|
||||
|
||||
class ValidateSignature extends Middleware
|
||||
{
|
||||
/**
|
||||
* The names of the query string parameters that should be ignored.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $except = [
|
||||
// 'fbclid',
|
||||
// 'utm_campaign',
|
||||
// 'utm_content',
|
||||
// 'utm_medium',
|
||||
// 'utm_source',
|
||||
// 'utm_term',
|
||||
];
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;
|
||||
|
||||
class VerifyCsrfToken extends Middleware
|
||||
{
|
||||
/**
|
||||
* The URIs that should be excluded from CSRF verification.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $except = [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class CommodityStoreRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'name' => 'required',
|
||||
'latin_name' => 'required',
|
||||
'duration' => ['required', 'numeric'],
|
||||
'cover' => 'required'
|
||||
];
|
||||
}
|
||||
|
||||
public function messages()
|
||||
{
|
||||
return [
|
||||
'name.required' => 'Nama harus diisi.',
|
||||
'latin_name.required' => 'Nama latin harus diisi.',
|
||||
'duration.required' => 'Durasi budidaya harus diisi.',
|
||||
'cover.required' => 'Cover harus diupload.',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class CommodityUpdateRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'name' => 'required',
|
||||
'latin_name' => 'required',
|
||||
'duration' => ['required', 'numeric'],
|
||||
];
|
||||
}
|
||||
|
||||
public function messages()
|
||||
{
|
||||
return [
|
||||
'name.required' => 'Nama harus diisi.',
|
||||
'latin_name.required' => 'Nama latin harus diisi.',
|
||||
'duration.required' => 'Durasi budidaya harus diisi.',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class CostStoreRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'input_date' => 'required',
|
||||
'repeater' => ['required', 'array'],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class HarvestStoreRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'fish_type' => 'required',
|
||||
'sow_date' => 'required',
|
||||
'price_one_seed' => 'required',
|
||||
'seed_amount' => ['required', 'min:1'],
|
||||
'seed_weight' => ['required', 'min:1'],
|
||||
'sr' => ['required', 'min:0', 'max:100'],
|
||||
'fcr' => ['required', 'min:0'],
|
||||
'target_fish_count' => ['required', 'min:1', 'max:100'],
|
||||
'target_price' => 'required',
|
||||
];
|
||||
}
|
||||
|
||||
public function messages()
|
||||
{
|
||||
return [
|
||||
'fish_type.required' => 'Jenis komoditas harus dipilih.',
|
||||
'sow_date.required' => 'Tanggal tebar bibit harus diisi.',
|
||||
'price_one_seed.required' => 'Harga satu ekor bibit harus diisi.',
|
||||
'seed_amount.required' => 'Jumlah bibit harus diisi.',
|
||||
'seed_amount.min' => 'Jumlah bibit minimal 1.',
|
||||
'seed_weight.required' => 'Berat bibit harus diisi',
|
||||
'seed_weight.min' => 'Berat bibit minimal 1 gram.',
|
||||
'sr.required' => 'Survival Rate harus diisi',
|
||||
'sr.min' => 'Survival Rate minimal 0',
|
||||
'sr.max' => 'Survival Rate maksimal 100',
|
||||
'fcr.required' => 'Feed Conversion Ratio harus diisi.',
|
||||
'fcr.min' => 'Feed Conversion Ratio minimal 0',
|
||||
'target_fish_count.required' => 'Target jumlah ikan per kilogram harus diisi.',
|
||||
'target_fish_count.min' => 'Target jumlah ikan per kilogram minimal 1',
|
||||
'target_fish_count.max' => 'Target jumlah ikan per kilogram maksimal 100',
|
||||
'target_price.required' => 'Target harga jual per kilogram harus diisi.'
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class LogStoreRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'feed_name' => 'required',
|
||||
'feed_spent' => ['required', 'min:0'],
|
||||
'fish_died' => ['required', 'min:0'],
|
||||
'weight' => ['required', 'min:0'],
|
||||
];
|
||||
}
|
||||
|
||||
public function messages()
|
||||
{
|
||||
return [
|
||||
'feed_name.required' => 'Jenis makanan harus diisi.',
|
||||
'feed_spent.required' => 'Jumlah pakan yang diberikan harus diisi.',
|
||||
'feed_spent.min' => 'Jumlah pakan minimal harus 0',
|
||||
'fish_died.required' => 'Jumlah ikan mati harus diisi',
|
||||
'fish_died.min' => 'Jumlah ikan mati minimal harus 0.',
|
||||
'weight.required' => 'Berat ikan harus diisi.',
|
||||
'weight.min' => 'Berat ikan minimal harus 0',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class PondStoreRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'amount' => ['required', 'integer', 'min:1'],
|
||||
'address' => 'required',
|
||||
'owner_name' => 'required',
|
||||
'owner_phone' => 'required',
|
||||
];
|
||||
}
|
||||
|
||||
public function messages()
|
||||
{
|
||||
return [
|
||||
'amount.required' => 'Jumlah kolam harus diisi.',
|
||||
'amount.min' => 'Jumlah kolam minimal harus 1',
|
||||
'address.required' => 'Alamat kolam harus diisi',
|
||||
'owner_name.required' => 'Nama pengelola harus diisi.',
|
||||
'owner_phone.required' => 'No Hp pengelola harus diisi.',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class PondUpdateRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'address' => 'required',
|
||||
'owner_name' => 'required',
|
||||
'owner_phone' => 'required',
|
||||
];
|
||||
}
|
||||
|
||||
public function messages()
|
||||
{
|
||||
return [
|
||||
'address.required' => 'Alamat kolam harus diisi',
|
||||
'owner_name.required' => 'Nama pengelola harus diisi.',
|
||||
'owner_phone.required' => 'No Hp pengelola harus diisi.',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use App\Rules\CurrentPassword;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class UpdatePasswordRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return Auth::check();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'current_password' => ['required', 'string', new CurrentPassword()],
|
||||
'password' => ['required', 'string', 'min:8', 'confirmed'],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class UserStoreRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'avatar' => 'required',
|
||||
'name' => 'required',
|
||||
'email' => ['required', 'email', 'unique:users,email'],
|
||||
'phone_number' => ['required', 'unique:users,phone_number'],
|
||||
'role' => 'required',
|
||||
'password' => ['required', 'string', 'min:8', 'confirmed']
|
||||
];
|
||||
}
|
||||
|
||||
public function messages()
|
||||
{
|
||||
return [
|
||||
'avatar.required' => 'Foto profil harus diupload.',
|
||||
'name.required' => 'Nama harus diisi.',
|
||||
'email.required' => 'Email harus diisi.',
|
||||
'email.email' => 'Format email salah.',
|
||||
'email.unique' => 'Email yang Anda masukkan telah terdaftar',
|
||||
'phone_number.required' => 'No Hp harus diisi.',
|
||||
'phone_number.unique' => 'No Hp yang Anda masukkan telah terdaftar',
|
||||
'role.required' => 'Role harus diisi.',
|
||||
'password.required' => 'Password harus diisi.',
|
||||
'password.confirmed' => 'Konfirmasi password tidak sesuai.',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class UserUpdateRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'name' => 'required',
|
||||
'email' => ['required', 'email'],
|
||||
'phone_number' => ['required'],
|
||||
'role' => 'required',
|
||||
];
|
||||
}
|
||||
|
||||
public function messages()
|
||||
{
|
||||
return [
|
||||
'name.required' => 'Nama harus diisi.',
|
||||
'email.required' => 'Email harus diisi.',
|
||||
'email.email' => 'Format email salah.',
|
||||
'phone_number.required' => 'No Hp harus diisi.',
|
||||
'role.required' => 'Role harus diisi.',
|
||||
];
|
||||
}
|
||||
}
|
||||
35
mitra-panen-skripsi-main/app/Imports/FishTypeImport.php
Normal file
35
mitra-panen-skripsi-main/app/Imports/FishTypeImport.php
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
namespace App\Imports;
|
||||
|
||||
use App\Models\FishType;
|
||||
use Maatwebsite\Excel\Concerns\ToModel;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadingRow;
|
||||
|
||||
class FishTypeImport implements ToModel, WithHeadingRow
|
||||
{
|
||||
/**
|
||||
* @param array $row
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Model|null
|
||||
*/
|
||||
public function model(array $row)
|
||||
{
|
||||
return new FishType([
|
||||
'id' => $row['id'],
|
||||
'name' => $row['name'],
|
||||
'slug' => $row['slug'],
|
||||
'latin_name' => $row['latin_name'],
|
||||
'duration' => $row['duration'],
|
||||
'photo' => $row['photo'],
|
||||
'selling_price' => $row['selling_price'],
|
||||
'temperature' => $row['temperature'],
|
||||
'ph' => $row['ph'],
|
||||
'water_height' => $row['water_height'],
|
||||
'water_type' => $row['water_type'],
|
||||
'preparation_description' => $row['preparation_description'],
|
||||
'seeding_description' => $row['seeding_description'],
|
||||
'cutivation_description' => $row['cutivation_description']
|
||||
]);
|
||||
}
|
||||
}
|
||||
35
mitra-panen-skripsi-main/app/Imports/HarvestFishImport.php
Normal file
35
mitra-panen-skripsi-main/app/Imports/HarvestFishImport.php
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
namespace App\Imports;
|
||||
|
||||
use App\Models\HarvestFish;
|
||||
use Carbon\Carbon;
|
||||
use Maatwebsite\Excel\Concerns\ToModel;
|
||||
use Maatwebsite\Excel\Concerns\WithCalculatedFormulas;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadingRow;
|
||||
|
||||
class HarvestFishImport implements ToModel, WithHeadingRow, WithCalculatedFormulas
|
||||
{
|
||||
/**
|
||||
* @param array $row
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Model|null
|
||||
*/
|
||||
public function model(array $row)
|
||||
{
|
||||
return new HarvestFish([
|
||||
'id' => $row['id'],
|
||||
'fish_type_id' => $row['fish_type_id'],
|
||||
'sow_date' => \PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($row['sow_date']),
|
||||
'seed_amount' => $row['seed_amount'],
|
||||
'seed_weight' => $row['seed_weight'],
|
||||
'survival_rate' => $row['survival_rate'],
|
||||
'average_weight' => $row['average_weight'],
|
||||
'fish_amount' => $row['fish_amount'],
|
||||
'pond_volume' => $row['pond_volume'],
|
||||
'total_feed_spent' => $row['total_feed_spent'],
|
||||
'harvest_date' => \PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($row['harvest_date']),
|
||||
'harvest_amount' => $row['harvest_amount'],
|
||||
]);
|
||||
}
|
||||
}
|
||||
26
mitra-panen-skripsi-main/app/Models/Cultivation.php
Normal file
26
mitra-panen-skripsi-main/app/Models/Cultivation.php
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Cultivation extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table='cultivations';
|
||||
|
||||
protected $fillable=[
|
||||
'pond_id',
|
||||
'day',
|
||||
'weight',
|
||||
'feed_spent',
|
||||
'total_feed_spent',
|
||||
'total_fish_weight',
|
||||
];
|
||||
|
||||
public function pond() {
|
||||
return $this->belongsTo(Pond::class, 'pond_id');
|
||||
}
|
||||
}
|
||||
69
mitra-panen-skripsi-main/app/Models/FishType.php
Normal file
69
mitra-panen-skripsi-main/app/Models/FishType.php
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Carbon\CarbonInterface;
|
||||
use Cviebrock\EloquentSluggable\Sluggable;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class FishType extends Model
|
||||
{
|
||||
use HasFactory, Sluggable;
|
||||
|
||||
protected $table='fish_types';
|
||||
|
||||
protected $fillable=[
|
||||
'name',
|
||||
'slug',
|
||||
'latin_name',
|
||||
'duration',
|
||||
'photo',
|
||||
'photo_detail',
|
||||
'fcr',
|
||||
'feed_price',
|
||||
'selling_price',
|
||||
'temperature',
|
||||
'ph',
|
||||
'water_height',
|
||||
'water_type',
|
||||
'preparation_description',
|
||||
'seeding_description',
|
||||
'cutivation_description',
|
||||
'feed_spent',
|
||||
];
|
||||
|
||||
public function sluggable(): array
|
||||
{
|
||||
return [
|
||||
'slug' => [
|
||||
'source' => 'name'
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
public function harvestFish() {
|
||||
return $this->hasMany(HarvestFish::class, 'fish_type_id');
|
||||
}
|
||||
|
||||
public function ponds() {
|
||||
return $this->hasMany(Pond::class, 'fish_id');
|
||||
}
|
||||
|
||||
public function getPhotoImageAttribute()
|
||||
{
|
||||
if ($this->photo) {
|
||||
return asset('storage/' . $this->photo);
|
||||
} else {
|
||||
return asset('assets/images/blank.png');
|
||||
}
|
||||
}
|
||||
|
||||
public function getDurationTimeAttribute()
|
||||
{
|
||||
$date = now()->addDay($this->duration+5);
|
||||
$duration_time = Carbon::now()->locale('id')->diffForHumans($date, CarbonInterface::DIFF_ABSOLUTE);
|
||||
return $duration_time;
|
||||
}
|
||||
}
|
||||
32
mitra-panen-skripsi-main/app/Models/HarvestFish.php
Normal file
32
mitra-panen-skripsi-main/app/Models/HarvestFish.php
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class HarvestFish extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table='harvest_fish';
|
||||
|
||||
protected $fillable=[
|
||||
'fish_type_id',
|
||||
'sow_date',
|
||||
'seed_amount',
|
||||
'seed_weight',
|
||||
'survival_rate',
|
||||
'average_weight',
|
||||
'fish_amount',
|
||||
'pond_volume',
|
||||
'total_feed_spent',
|
||||
'harvest_date',
|
||||
'harvest_amount',
|
||||
];
|
||||
|
||||
public function fish() {
|
||||
return $this->belongsTo(FishType::class, 'fish_type_id');
|
||||
}
|
||||
}
|
||||
69
mitra-panen-skripsi-main/app/Models/Pond.php
Normal file
69
mitra-panen-skripsi-main/app/Models/Pond.php
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Cviebrock\EloquentSluggable\Sluggable;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Pond extends Model
|
||||
{
|
||||
use HasFactory, Sluggable;
|
||||
|
||||
const PROCESS = 1;
|
||||
const HARVEST = 2;
|
||||
const NONACTIVE = 3;
|
||||
|
||||
protected $table='ponds';
|
||||
|
||||
protected $fillable=[
|
||||
'user_id',
|
||||
'fish_id',
|
||||
'name',
|
||||
'slug',
|
||||
'sow_date',
|
||||
'seed_amount',
|
||||
'seed_weight',
|
||||
'survival_rate',
|
||||
'volume_pond',
|
||||
'average_weight',
|
||||
'total_feed_spent',
|
||||
'prediction',
|
||||
'status',
|
||||
];
|
||||
|
||||
public function sluggable(): array
|
||||
{
|
||||
return [
|
||||
'slug' => [
|
||||
'source' => 'name'
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
public function user() {
|
||||
return $this->belongsTo(User::class, 'user_id');
|
||||
}
|
||||
|
||||
public function fish() {
|
||||
return $this->belongsTo(FishType::class, 'fish_id');
|
||||
}
|
||||
|
||||
public function cultivations() {
|
||||
return $this->hasMany(Cultivation::class, 'pond_id');
|
||||
}
|
||||
|
||||
public function getDateSowAttribute()
|
||||
{
|
||||
$date_sow = $this->sow_date ? Carbon::parse($this->sow_date)->locale('id')->isoFormat('D MMMM Y') : Carbon::parse(now())->locale('id')->isoFormat('D MMMM Y');
|
||||
return $date_sow;
|
||||
}
|
||||
|
||||
public function getHarvestDateAttribute()
|
||||
{
|
||||
$add = $this->fish->duration - 1;
|
||||
$harvest_date = Carbon::parse($this->sow_date)->addDays($add)->locale('id')->isoFormat('D MMMM Y');
|
||||
return $harvest_date;
|
||||
}
|
||||
}
|
||||
80
mitra-panen-skripsi-main/app/Models/User.php
Normal file
80
mitra-panen-skripsi-main/app/Models/User.php
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
// use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Laravel\Sanctum\HasApiTokens;
|
||||
|
||||
class User extends Authenticatable
|
||||
{
|
||||
use HasApiTokens, HasFactory, Notifiable;
|
||||
|
||||
const ADMIN = 1;
|
||||
const MITRA = 2;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'email',
|
||||
'password',
|
||||
'role',
|
||||
'phone_number',
|
||||
'address',
|
||||
'avatar'
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be hidden for serialization.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $hidden = [
|
||||
'password',
|
||||
'remember_token',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast.
|
||||
*
|
||||
* @var array<string, string>
|
||||
*/
|
||||
protected $casts = [
|
||||
'email_verified_at' => 'datetime',
|
||||
];
|
||||
|
||||
public function getAvatarImageAttribute()
|
||||
{
|
||||
if ($this->avatar) {
|
||||
return asset('storage/' . $this->avatar);
|
||||
} else {
|
||||
return asset('assets/images/defaultAvatar.png');
|
||||
}
|
||||
}
|
||||
|
||||
public function getJoinedSinceAttribute()
|
||||
{
|
||||
$join_date = $this->created_at ? Carbon::parse($this->created_at)->locale('id')->isoFormat('D MMMM Y') : Carbon::parse(now())->locale('id')->isoFormat('D MMMM Y');
|
||||
return $join_date;
|
||||
}
|
||||
|
||||
public function getRoleNameAttribute()
|
||||
{
|
||||
if($this->role == 1){
|
||||
return 'Admin';
|
||||
} else {
|
||||
return 'Mitra Panen';
|
||||
}
|
||||
}
|
||||
|
||||
public function ponds() {
|
||||
return $this->hasMany(Pond::class, 'user_id');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class AppServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Register any application services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Bootstrap any application services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
// use Illuminate\Support\Facades\Gate;
|
||||
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
|
||||
|
||||
class AuthServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* The model to policy mappings for the application.
|
||||
*
|
||||
* @var array<class-string, class-string>
|
||||
*/
|
||||
protected $policies = [
|
||||
// 'App\Models\Model' => 'App\Policies\ModelPolicy',
|
||||
];
|
||||
|
||||
/**
|
||||
* Register any authentication / authorization services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
$this->registerPolicies();
|
||||
|
||||
//
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Broadcast;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class BroadcastServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Bootstrap any application services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
Broadcast::routes();
|
||||
|
||||
require base_path('routes/channels.php');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Auth\Events\Registered;
|
||||
use Illuminate\Auth\Listeners\SendEmailVerificationNotification;
|
||||
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
|
||||
class EventServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* The event to listener mappings for the application.
|
||||
*
|
||||
* @var array<class-string, array<int, class-string>>
|
||||
*/
|
||||
protected $listen = [
|
||||
Registered::class => [
|
||||
SendEmailVerificationNotification::class,
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* Register any events for your application.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if events and listeners should be automatically discovered.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function shouldDiscoverEvents()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Cache\RateLimiting\Limit;
|
||||
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\RateLimiter;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
class RouteServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* The path to the "home" route for your application.
|
||||
*
|
||||
* Typically, users are redirected here after authentication.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public const HOME = '/home';
|
||||
|
||||
/**
|
||||
* Define your route model bindings, pattern filters, and other route configuration.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
$this->configureRateLimiting();
|
||||
|
||||
$this->routes(function () {
|
||||
Route::middleware('api')
|
||||
->prefix('api')
|
||||
->group(base_path('routes/api.php'));
|
||||
|
||||
Route::middleware('web')
|
||||
->group(base_path('routes/web.php'));
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure the rate limiters for the application.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function configureRateLimiting()
|
||||
{
|
||||
RateLimiter::for('api', function (Request $request) {
|
||||
return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip());
|
||||
});
|
||||
}
|
||||
}
|
||||
42
mitra-panen-skripsi-main/app/Rules/CurrentPassword.php
Normal file
42
mitra-panen-skripsi-main/app/Rules/CurrentPassword.php
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
|
||||
namespace App\Rules;
|
||||
|
||||
use Illuminate\Contracts\Validation\Rule;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
|
||||
class CurrentPassword implements Rule
|
||||
{
|
||||
/**
|
||||
* Create a new rule instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the validation rule passes.
|
||||
*
|
||||
* @param string $attribute
|
||||
* @param mixed $value
|
||||
* @return bool
|
||||
*/
|
||||
public function passes($attribute, $value)
|
||||
{
|
||||
return Hash::check($value, Auth::user()->password);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation error message.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function message()
|
||||
{
|
||||
return 'Current password doesn\'t match';
|
||||
}
|
||||
}
|
||||
14
mitra-panen-skripsi-main/app/Traits/FileStore.php
Normal file
14
mitra-panen-skripsi-main/app/Traits/FileStore.php
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
namespace App\Traits;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
trait FileStore {
|
||||
public function getPathFile($value, $type)
|
||||
{
|
||||
$ext = $value->getClientOriginalExtension();
|
||||
$fileName = basename($value->getClientOriginalName(), '.' . $ext);
|
||||
$name = time() . '_' . Str::slug($fileName) . '.' . $ext;
|
||||
$path = $value->storeAs($type, $name, 'public');
|
||||
return $path;
|
||||
}
|
||||
}
|
||||
18
mitra-panen-skripsi-main/app/Traits/PhoneNumberFormatter.php
Normal file
18
mitra-panen-skripsi-main/app/Traits/PhoneNumberFormatter.php
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
namespace App\Traits;
|
||||
|
||||
trait PhoneNumberFormatter {
|
||||
public function format($phoneNumber)
|
||||
{
|
||||
if ($phoneNumber[0] == "+") {
|
||||
$phoneNumber = str_replace("+", "", $phoneNumber);
|
||||
}
|
||||
if ($phoneNumber[0] == "0") {
|
||||
$phoneNumber = substr($phoneNumber, 1);
|
||||
}
|
||||
if ($phoneNumber[0] == "8") {
|
||||
$phoneNumber = "62" . $phoneNumber;
|
||||
}
|
||||
return $phoneNumber;
|
||||
}
|
||||
}
|
||||
28
mitra-panen-skripsi-main/app/View/Components/Header.php
Normal file
28
mitra-panen-skripsi-main/app/View/Components/Header.php
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
namespace App\View\Components;
|
||||
|
||||
use Illuminate\View\Component;
|
||||
|
||||
class Header extends Component
|
||||
{
|
||||
/**
|
||||
* Create a new component instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View|\Closure|string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
return view('components.header');
|
||||
}
|
||||
}
|
||||
28
mitra-panen-skripsi-main/app/View/Components/Sidebar.php
Normal file
28
mitra-panen-skripsi-main/app/View/Components/Sidebar.php
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
namespace App\View\Components;
|
||||
|
||||
use Illuminate\View\Component;
|
||||
|
||||
class Sidebar extends Component
|
||||
{
|
||||
/**
|
||||
* Create a new component instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View|\Closure|string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
return view('components.sidebar');
|
||||
}
|
||||
}
|
||||
53
mitra-panen-skripsi-main/artisan
Normal file
53
mitra-panen-skripsi-main/artisan
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
define('LARAVEL_START', microtime(true));
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Register The Auto Loader
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Composer provides a convenient, automatically generated class loader
|
||||
| for our application. We just need to utilize it! We'll require it
|
||||
| into the script here so that we do not have to worry about the
|
||||
| loading of any of our classes manually. It's great to relax.
|
||||
|
|
||||
*/
|
||||
|
||||
require __DIR__.'/vendor/autoload.php';
|
||||
|
||||
$app = require_once __DIR__.'/bootstrap/app.php';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Run The Artisan Application
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When we run the console application, the current CLI command will be
|
||||
| executed in this console and the response sent back to a terminal
|
||||
| or another output device for the developers. Here goes nothing!
|
||||
|
|
||||
*/
|
||||
|
||||
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
|
||||
|
||||
$status = $kernel->handle(
|
||||
$input = new Symfony\Component\Console\Input\ArgvInput,
|
||||
new Symfony\Component\Console\Output\ConsoleOutput
|
||||
);
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Shutdown The Application
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Once Artisan has finished running, we will fire off the shutdown events
|
||||
| so that any final work may be done by the application before we shut
|
||||
| down the process. This is the last thing to happen to the request.
|
||||
|
|
||||
*/
|
||||
|
||||
$kernel->terminate($input, $status);
|
||||
|
||||
exit($status);
|
||||
55
mitra-panen-skripsi-main/bootstrap/app.php
Normal file
55
mitra-panen-skripsi-main/bootstrap/app.php
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Create The Application
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The first thing we will do is create a new Laravel application instance
|
||||
| which serves as the "glue" for all the components of Laravel, and is
|
||||
| the IoC container for the system binding all of the various parts.
|
||||
|
|
||||
*/
|
||||
|
||||
$app = new Illuminate\Foundation\Application(
|
||||
$_ENV['APP_BASE_PATH'] ?? dirname(__DIR__)
|
||||
);
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Bind Important Interfaces
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Next, we need to bind some important interfaces into the container so
|
||||
| we will be able to resolve them when needed. The kernels serve the
|
||||
| incoming requests to this application from both the web and CLI.
|
||||
|
|
||||
*/
|
||||
|
||||
$app->singleton(
|
||||
Illuminate\Contracts\Http\Kernel::class,
|
||||
App\Http\Kernel::class
|
||||
);
|
||||
|
||||
$app->singleton(
|
||||
Illuminate\Contracts\Console\Kernel::class,
|
||||
App\Console\Kernel::class
|
||||
);
|
||||
|
||||
$app->singleton(
|
||||
Illuminate\Contracts\Debug\ExceptionHandler::class,
|
||||
App\Exceptions\Handler::class
|
||||
);
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Return The Application
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This script returns the application instance. The instance is given to
|
||||
| the calling script so we can separate the building of the instances
|
||||
| from the actual running of the application and sending responses.
|
||||
|
|
||||
*/
|
||||
|
||||
return $app;
|
||||
2
mitra-panen-skripsi-main/bootstrap/cache/.gitignore
vendored
Normal file
2
mitra-panen-skripsi-main/bootstrap/cache/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
*
|
||||
!.gitignore
|
||||
71
mitra-panen-skripsi-main/composer.json
Normal file
71
mitra-panen-skripsi-main/composer.json
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
{
|
||||
"name": "laravel/laravel",
|
||||
"type": "project",
|
||||
"description": "The Laravel Framework.",
|
||||
"keywords": ["framework", "laravel"],
|
||||
"license": "MIT",
|
||||
"require": {
|
||||
"php": "^8.0.2",
|
||||
"cviebrock/eloquent-sluggable": "9.0",
|
||||
"guzzlehttp/guzzle": "^7.2",
|
||||
"laravel/framework": "^9.19",
|
||||
"laravel/sanctum": "^3.0",
|
||||
"laravel/tinker": "^2.7",
|
||||
"laravel/ui": "^4.2",
|
||||
"maatwebsite/excel": "^3.1",
|
||||
"realrashid/sweet-alert": "^6.0",
|
||||
"yajra/laravel-datatables-oracle": "^10.3"
|
||||
},
|
||||
"require-dev": {
|
||||
"barryvdh/laravel-debugbar": "^3.8",
|
||||
"fakerphp/faker": "^1.9.1",
|
||||
"laravel/pint": "^1.0",
|
||||
"laravel/sail": "^1.0.1",
|
||||
"mockery/mockery": "^1.4.4",
|
||||
"nunomaduro/collision": "^6.1",
|
||||
"phpunit/phpunit": "^9.5.10",
|
||||
"spatie/laravel-ignition": "^1.0"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"App\\": "app/",
|
||||
"Database\\Factories\\": "database/factories/",
|
||||
"Database\\Seeders\\": "database/seeders/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"Tests\\": "tests/"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"post-autoload-dump": [
|
||||
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
|
||||
"@php artisan package:discover --ansi"
|
||||
],
|
||||
"post-update-cmd": [
|
||||
"@php artisan vendor:publish --tag=laravel-assets --ansi --force"
|
||||
],
|
||||
"post-root-package-install": [
|
||||
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
|
||||
],
|
||||
"post-create-project-cmd": [
|
||||
"@php artisan key:generate --ansi"
|
||||
]
|
||||
},
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"dont-discover": []
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"optimize-autoloader": true,
|
||||
"preferred-install": "dist",
|
||||
"sort-packages": true,
|
||||
"allow-plugins": {
|
||||
"pestphp/pest-plugin": true
|
||||
}
|
||||
},
|
||||
"minimum-stability": "stable",
|
||||
"prefer-stable": true
|
||||
}
|
||||
8881
mitra-panen-skripsi-main/composer.lock
generated
Normal file
8881
mitra-panen-skripsi-main/composer.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
222
mitra-panen-skripsi-main/config/app.php
Normal file
222
mitra-panen-skripsi-main/config/app.php
Normal file
|
|
@ -0,0 +1,222 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Facade;
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Name
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This value is the name of your application. This value is used when the
|
||||
| framework needs to place the application's name in a notification or
|
||||
| any other location as required by the application or its packages.
|
||||
|
|
||||
*/
|
||||
|
||||
'name' => env('APP_NAME', 'Laravel'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Environment
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This value determines the "environment" your application is currently
|
||||
| running in. This may determine how you prefer to configure various
|
||||
| services the application utilizes. Set this in your ".env" file.
|
||||
|
|
||||
*/
|
||||
|
||||
'env' => env('APP_ENV', 'production'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Debug Mode
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When your application is in debug mode, detailed error messages with
|
||||
| stack traces will be shown on every error that occurs within your
|
||||
| application. If disabled, a simple generic error page is shown.
|
||||
|
|
||||
*/
|
||||
|
||||
'debug' => (bool) env('APP_DEBUG', false),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application URL
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This URL is used by the console to properly generate URLs when using
|
||||
| the Artisan command line tool. You should set this to the root of
|
||||
| your application so that it is used when running Artisan tasks.
|
||||
|
|
||||
*/
|
||||
|
||||
'url' => env('APP_URL', 'http://localhost'),
|
||||
|
||||
'asset_url' => env('ASSET_URL'),
|
||||
|
||||
'api_python_url' => env('BASE_URL_PYTHON', 'http://127.0.0.1:5000'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Timezone
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify the default timezone for your application, which
|
||||
| will be used by the PHP date and date-time functions. We have gone
|
||||
| ahead and set this to a sensible default for you out of the box.
|
||||
|
|
||||
*/
|
||||
|
||||
'timezone' => 'Asia/Jakarta',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Locale Configuration
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The application locale determines the default locale that will be used
|
||||
| by the translation service provider. You are free to set this value
|
||||
| to any of the locales which will be supported by the application.
|
||||
|
|
||||
*/
|
||||
|
||||
'locale' => 'en',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Fallback Locale
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The fallback locale determines the locale to use when the current one
|
||||
| is not available. You may change the value to correspond to any of
|
||||
| the language folders that are provided through your application.
|
||||
|
|
||||
*/
|
||||
|
||||
'fallback_locale' => 'en',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Faker Locale
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This locale will be used by the Faker PHP library when generating fake
|
||||
| data for your database seeds. For example, this will be used to get
|
||||
| localized telephone numbers, street address information and more.
|
||||
|
|
||||
*/
|
||||
|
||||
'faker_locale' => 'en_US',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Encryption Key
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This key is used by the Illuminate encrypter service and should be set
|
||||
| to a random, 32 character string, otherwise these encrypted strings
|
||||
| will not be safe. Please do this before deploying an application!
|
||||
|
|
||||
*/
|
||||
|
||||
'key' => env('APP_KEY'),
|
||||
|
||||
'cipher' => 'AES-256-CBC',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Maintenance Mode Driver
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| These configuration options determine the driver used to determine and
|
||||
| manage Laravel's "maintenance mode" status. The "cache" driver will
|
||||
| allow maintenance mode to be controlled across multiple machines.
|
||||
|
|
||||
| Supported drivers: "file", "cache"
|
||||
|
|
||||
*/
|
||||
|
||||
'maintenance' => [
|
||||
'driver' => 'file',
|
||||
// 'store' => 'redis',
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Autoloaded Service Providers
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The service providers listed here will be automatically loaded on the
|
||||
| request to your application. Feel free to add your own services to
|
||||
| this array to grant expanded functionality to your applications.
|
||||
|
|
||||
*/
|
||||
|
||||
'providers' => [
|
||||
|
||||
/*
|
||||
* Laravel Framework Service Providers...
|
||||
*/
|
||||
Illuminate\Auth\AuthServiceProvider::class,
|
||||
Illuminate\Broadcasting\BroadcastServiceProvider::class,
|
||||
Illuminate\Bus\BusServiceProvider::class,
|
||||
Illuminate\Cache\CacheServiceProvider::class,
|
||||
Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class,
|
||||
Illuminate\Cookie\CookieServiceProvider::class,
|
||||
Illuminate\Database\DatabaseServiceProvider::class,
|
||||
Illuminate\Encryption\EncryptionServiceProvider::class,
|
||||
Illuminate\Filesystem\FilesystemServiceProvider::class,
|
||||
Illuminate\Foundation\Providers\FoundationServiceProvider::class,
|
||||
Illuminate\Hashing\HashServiceProvider::class,
|
||||
Illuminate\Mail\MailServiceProvider::class,
|
||||
Illuminate\Notifications\NotificationServiceProvider::class,
|
||||
Illuminate\Pagination\PaginationServiceProvider::class,
|
||||
Illuminate\Pipeline\PipelineServiceProvider::class,
|
||||
Illuminate\Queue\QueueServiceProvider::class,
|
||||
Illuminate\Redis\RedisServiceProvider::class,
|
||||
Illuminate\Auth\Passwords\PasswordResetServiceProvider::class,
|
||||
Illuminate\Session\SessionServiceProvider::class,
|
||||
Illuminate\Translation\TranslationServiceProvider::class,
|
||||
Illuminate\Validation\ValidationServiceProvider::class,
|
||||
Illuminate\View\ViewServiceProvider::class,
|
||||
|
||||
/*
|
||||
* Package Service Providers...
|
||||
*/
|
||||
Yajra\DataTables\DataTablesServiceProvider::class,
|
||||
RealRashid\SweetAlert\SweetAlertServiceProvider::class,
|
||||
Maatwebsite\Excel\ExcelServiceProvider::class,
|
||||
|
||||
/*
|
||||
* Application Service Providers...
|
||||
*/
|
||||
App\Providers\AppServiceProvider::class,
|
||||
App\Providers\AuthServiceProvider::class,
|
||||
// App\Providers\BroadcastServiceProvider::class,
|
||||
App\Providers\EventServiceProvider::class,
|
||||
App\Providers\RouteServiceProvider::class,
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Class Aliases
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This array of class aliases will be registered when this application
|
||||
| is started. However, feel free to register as many as you wish as
|
||||
| the aliases are "lazy" loaded so they don't hinder performance.
|
||||
|
|
||||
*/
|
||||
|
||||
'aliases' => Facade::defaultAliases()->merge([
|
||||
// 'ExampleClass' => App\Example\ExampleClass::class,
|
||||
'Alert' => RealRashid\SweetAlert\Facades\Alert::class,
|
||||
'Excel' => Maatwebsite\Excel\Facades\Excel::class,
|
||||
])->toArray(),
|
||||
|
||||
];
|
||||
111
mitra-panen-skripsi-main/config/auth.php
Normal file
111
mitra-panen-skripsi-main/config/auth.php
Normal file
|
|
@ -0,0 +1,111 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Authentication Defaults
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option controls the default authentication "guard" and password
|
||||
| reset options for your application. You may change these defaults
|
||||
| as required, but they're a perfect start for most applications.
|
||||
|
|
||||
*/
|
||||
|
||||
'defaults' => [
|
||||
'guard' => 'web',
|
||||
'passwords' => 'users',
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Authentication Guards
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Next, you may define every authentication guard for your application.
|
||||
| Of course, a great default configuration has been defined for you
|
||||
| here which uses session storage and the Eloquent user provider.
|
||||
|
|
||||
| All authentication drivers have a user provider. This defines how the
|
||||
| users are actually retrieved out of your database or other storage
|
||||
| mechanisms used by this application to persist your user's data.
|
||||
|
|
||||
| Supported: "session"
|
||||
|
|
||||
*/
|
||||
|
||||
'guards' => [
|
||||
'web' => [
|
||||
'driver' => 'session',
|
||||
'provider' => 'users',
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| User Providers
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| All authentication drivers have a user provider. This defines how the
|
||||
| users are actually retrieved out of your database or other storage
|
||||
| mechanisms used by this application to persist your user's data.
|
||||
|
|
||||
| If you have multiple user tables or models you may configure multiple
|
||||
| sources which represent each model / table. These sources may then
|
||||
| be assigned to any extra authentication guards you have defined.
|
||||
|
|
||||
| Supported: "database", "eloquent"
|
||||
|
|
||||
*/
|
||||
|
||||
'providers' => [
|
||||
'users' => [
|
||||
'driver' => 'eloquent',
|
||||
'model' => App\Models\User::class,
|
||||
],
|
||||
|
||||
// 'users' => [
|
||||
// 'driver' => 'database',
|
||||
// 'table' => 'users',
|
||||
// ],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Resetting Passwords
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| You may specify multiple password reset configurations if you have more
|
||||
| than one user table or model in the application and you want to have
|
||||
| separate password reset settings based on the specific user types.
|
||||
|
|
||||
| The expire time is the number of minutes that each reset token will be
|
||||
| considered valid. This security feature keeps tokens short-lived so
|
||||
| they have less time to be guessed. You may change this as needed.
|
||||
|
|
||||
*/
|
||||
|
||||
'passwords' => [
|
||||
'users' => [
|
||||
'provider' => 'users',
|
||||
'table' => 'password_resets',
|
||||
'expire' => 60,
|
||||
'throttle' => 60,
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Password Confirmation Timeout
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may define the amount of seconds before a password confirmation
|
||||
| times out and the user is prompted to re-enter their password via the
|
||||
| confirmation screen. By default, the timeout lasts for three hours.
|
||||
|
|
||||
*/
|
||||
|
||||
'password_timeout' => 10800,
|
||||
|
||||
];
|
||||
70
mitra-panen-skripsi-main/config/broadcasting.php
Normal file
70
mitra-panen-skripsi-main/config/broadcasting.php
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Broadcaster
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option controls the default broadcaster that will be used by the
|
||||
| framework when an event needs to be broadcast. You may set this to
|
||||
| any of the connections defined in the "connections" array below.
|
||||
|
|
||||
| Supported: "pusher", "ably", "redis", "log", "null"
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('BROADCAST_DRIVER', 'null'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Broadcast Connections
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may define all of the broadcast connections that will be used
|
||||
| to broadcast events to other systems or over websockets. Samples of
|
||||
| each available type of connection are provided inside this array.
|
||||
|
|
||||
*/
|
||||
|
||||
'connections' => [
|
||||
|
||||
'pusher' => [
|
||||
'driver' => 'pusher',
|
||||
'key' => env('PUSHER_APP_KEY'),
|
||||
'secret' => env('PUSHER_APP_SECRET'),
|
||||
'app_id' => env('PUSHER_APP_ID'),
|
||||
'options' => [
|
||||
'host' => env('PUSHER_HOST') ?: 'api-'.env('PUSHER_APP_CLUSTER', 'mt1').'.pusher.com',
|
||||
'port' => env('PUSHER_PORT', 443),
|
||||
'scheme' => env('PUSHER_SCHEME', 'https'),
|
||||
'encrypted' => true,
|
||||
'useTLS' => env('PUSHER_SCHEME', 'https') === 'https',
|
||||
],
|
||||
'client_options' => [
|
||||
// Guzzle client options: https://docs.guzzlephp.org/en/stable/request-options.html
|
||||
],
|
||||
],
|
||||
|
||||
'ably' => [
|
||||
'driver' => 'ably',
|
||||
'key' => env('ABLY_KEY'),
|
||||
],
|
||||
|
||||
'redis' => [
|
||||
'driver' => 'redis',
|
||||
'connection' => 'default',
|
||||
],
|
||||
|
||||
'log' => [
|
||||
'driver' => 'log',
|
||||
],
|
||||
|
||||
'null' => [
|
||||
'driver' => 'null',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
110
mitra-panen-skripsi-main/config/cache.php
Normal file
110
mitra-panen-skripsi-main/config/cache.php
Normal file
|
|
@ -0,0 +1,110 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Cache Store
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option controls the default cache connection that gets used while
|
||||
| using this caching library. This connection is used when another is
|
||||
| not explicitly specified when executing a given caching function.
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('CACHE_DRIVER', 'file'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Cache Stores
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may define all of the cache "stores" for your application as
|
||||
| well as their drivers. You may even define multiple stores for the
|
||||
| same cache driver to group types of items stored in your caches.
|
||||
|
|
||||
| Supported drivers: "apc", "array", "database", "file",
|
||||
| "memcached", "redis", "dynamodb", "octane", "null"
|
||||
|
|
||||
*/
|
||||
|
||||
'stores' => [
|
||||
|
||||
'apc' => [
|
||||
'driver' => 'apc',
|
||||
],
|
||||
|
||||
'array' => [
|
||||
'driver' => 'array',
|
||||
'serialize' => false,
|
||||
],
|
||||
|
||||
'database' => [
|
||||
'driver' => 'database',
|
||||
'table' => 'cache',
|
||||
'connection' => null,
|
||||
'lock_connection' => null,
|
||||
],
|
||||
|
||||
'file' => [
|
||||
'driver' => 'file',
|
||||
'path' => storage_path('framework/cache/data'),
|
||||
],
|
||||
|
||||
'memcached' => [
|
||||
'driver' => 'memcached',
|
||||
'persistent_id' => env('MEMCACHED_PERSISTENT_ID'),
|
||||
'sasl' => [
|
||||
env('MEMCACHED_USERNAME'),
|
||||
env('MEMCACHED_PASSWORD'),
|
||||
],
|
||||
'options' => [
|
||||
// Memcached::OPT_CONNECT_TIMEOUT => 2000,
|
||||
],
|
||||
'servers' => [
|
||||
[
|
||||
'host' => env('MEMCACHED_HOST', '127.0.0.1'),
|
||||
'port' => env('MEMCACHED_PORT', 11211),
|
||||
'weight' => 100,
|
||||
],
|
||||
],
|
||||
],
|
||||
|
||||
'redis' => [
|
||||
'driver' => 'redis',
|
||||
'connection' => 'cache',
|
||||
'lock_connection' => 'default',
|
||||
],
|
||||
|
||||
'dynamodb' => [
|
||||
'driver' => 'dynamodb',
|
||||
'key' => env('AWS_ACCESS_KEY_ID'),
|
||||
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
||||
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
|
||||
'table' => env('DYNAMODB_CACHE_TABLE', 'cache'),
|
||||
'endpoint' => env('DYNAMODB_ENDPOINT'),
|
||||
],
|
||||
|
||||
'octane' => [
|
||||
'driver' => 'octane',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Cache Key Prefix
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When utilizing the APC, database, memcached, Redis, or DynamoDB cache
|
||||
| stores there might be other applications using the same cache. For
|
||||
| that reason, you may prefix every cache key to avoid collisions.
|
||||
|
|
||||
*/
|
||||
|
||||
'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache_'),
|
||||
|
||||
];
|
||||
34
mitra-panen-skripsi-main/config/cors.php
Normal file
34
mitra-panen-skripsi-main/config/cors.php
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Cross-Origin Resource Sharing (CORS) Configuration
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may configure your settings for cross-origin resource sharing
|
||||
| or "CORS". This determines what cross-origin operations may execute
|
||||
| in web browsers. You are free to adjust these settings as needed.
|
||||
|
|
||||
| To learn more: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
|
||||
|
|
||||
*/
|
||||
|
||||
'paths' => ['api/*', 'sanctum/csrf-cookie'],
|
||||
|
||||
'allowed_methods' => ['*'],
|
||||
|
||||
'allowed_origins' => ['*'],
|
||||
|
||||
'allowed_origins_patterns' => [],
|
||||
|
||||
'allowed_headers' => ['*'],
|
||||
|
||||
'exposed_headers' => [],
|
||||
|
||||
'max_age' => 0,
|
||||
|
||||
'supports_credentials' => false,
|
||||
|
||||
];
|
||||
151
mitra-panen-skripsi-main/config/database.php
Normal file
151
mitra-panen-skripsi-main/config/database.php
Normal file
|
|
@ -0,0 +1,151 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Database Connection Name
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify which of the database connections below you wish
|
||||
| to use as your default connection for all database work. Of course
|
||||
| you may use many connections at once using the Database library.
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('DB_CONNECTION', 'mysql'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Database Connections
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here are each of the database connections setup for your application.
|
||||
| Of course, examples of configuring each database platform that is
|
||||
| supported by Laravel is shown below to make development simple.
|
||||
|
|
||||
|
|
||||
| All database work in Laravel is done through the PHP PDO facilities
|
||||
| so make sure you have the driver for your particular database of
|
||||
| choice installed on your machine before you begin development.
|
||||
|
|
||||
*/
|
||||
|
||||
'connections' => [
|
||||
|
||||
'sqlite' => [
|
||||
'driver' => 'sqlite',
|
||||
'url' => env('DATABASE_URL'),
|
||||
'database' => env('DB_DATABASE', database_path('database.sqlite')),
|
||||
'prefix' => '',
|
||||
'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
|
||||
],
|
||||
|
||||
'mysql' => [
|
||||
'driver' => 'mysql',
|
||||
'url' => env('DATABASE_URL'),
|
||||
'host' => env('DB_HOST', '127.0.0.1'),
|
||||
'port' => env('DB_PORT', '3306'),
|
||||
'database' => env('DB_DATABASE', 'forge'),
|
||||
'username' => env('DB_USERNAME', 'forge'),
|
||||
'password' => env('DB_PASSWORD', ''),
|
||||
'unix_socket' => env('DB_SOCKET', ''),
|
||||
'charset' => 'utf8mb4',
|
||||
'collation' => 'utf8mb4_unicode_ci',
|
||||
'prefix' => '',
|
||||
'prefix_indexes' => true,
|
||||
'strict' => true,
|
||||
'engine' => null,
|
||||
'options' => extension_loaded('pdo_mysql') ? array_filter([
|
||||
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
|
||||
]) : [],
|
||||
],
|
||||
|
||||
'pgsql' => [
|
||||
'driver' => 'pgsql',
|
||||
'url' => env('DATABASE_URL'),
|
||||
'host' => env('DB_HOST', '127.0.0.1'),
|
||||
'port' => env('DB_PORT', '5432'),
|
||||
'database' => env('DB_DATABASE', 'forge'),
|
||||
'username' => env('DB_USERNAME', 'forge'),
|
||||
'password' => env('DB_PASSWORD', ''),
|
||||
'charset' => 'utf8',
|
||||
'prefix' => '',
|
||||
'prefix_indexes' => true,
|
||||
'search_path' => 'public',
|
||||
'sslmode' => 'prefer',
|
||||
],
|
||||
|
||||
'sqlsrv' => [
|
||||
'driver' => 'sqlsrv',
|
||||
'url' => env('DATABASE_URL'),
|
||||
'host' => env('DB_HOST', 'localhost'),
|
||||
'port' => env('DB_PORT', '1433'),
|
||||
'database' => env('DB_DATABASE', 'forge'),
|
||||
'username' => env('DB_USERNAME', 'forge'),
|
||||
'password' => env('DB_PASSWORD', ''),
|
||||
'charset' => 'utf8',
|
||||
'prefix' => '',
|
||||
'prefix_indexes' => true,
|
||||
// 'encrypt' => env('DB_ENCRYPT', 'yes'),
|
||||
// 'trust_server_certificate' => env('DB_TRUST_SERVER_CERTIFICATE', 'false'),
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Migration Repository Table
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This table keeps track of all the migrations that have already run for
|
||||
| your application. Using this information, we can determine which of
|
||||
| the migrations on disk haven't actually been run in the database.
|
||||
|
|
||||
*/
|
||||
|
||||
'migrations' => 'migrations',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Redis Databases
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Redis is an open source, fast, and advanced key-value store that also
|
||||
| provides a richer body of commands than a typical key-value system
|
||||
| such as APC or Memcached. Laravel makes it easy to dig right in.
|
||||
|
|
||||
*/
|
||||
|
||||
'redis' => [
|
||||
|
||||
'client' => env('REDIS_CLIENT', 'phpredis'),
|
||||
|
||||
'options' => [
|
||||
'cluster' => env('REDIS_CLUSTER', 'redis'),
|
||||
'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'),
|
||||
],
|
||||
|
||||
'default' => [
|
||||
'url' => env('REDIS_URL'),
|
||||
'host' => env('REDIS_HOST', '127.0.0.1'),
|
||||
'username' => env('REDIS_USERNAME'),
|
||||
'password' => env('REDIS_PASSWORD'),
|
||||
'port' => env('REDIS_PORT', '6379'),
|
||||
'database' => env('REDIS_DB', '0'),
|
||||
],
|
||||
|
||||
'cache' => [
|
||||
'url' => env('REDIS_URL'),
|
||||
'host' => env('REDIS_HOST', '127.0.0.1'),
|
||||
'username' => env('REDIS_USERNAME'),
|
||||
'password' => env('REDIS_PASSWORD'),
|
||||
'port' => env('REDIS_PORT', '6379'),
|
||||
'database' => env('REDIS_CACHE_DB', '1'),
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
333
mitra-panen-skripsi-main/config/excel.php
Normal file
333
mitra-panen-skripsi-main/config/excel.php
Normal file
|
|
@ -0,0 +1,333 @@
|
|||
<?php
|
||||
|
||||
use Maatwebsite\Excel\Excel;
|
||||
|
||||
return [
|
||||
'exports' => [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Chunk size
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When using FromQuery, the query is automatically chunked.
|
||||
| Here you can specify how big the chunk should be.
|
||||
|
|
||||
*/
|
||||
'chunk_size' => 1000,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Pre-calculate formulas during export
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
'pre_calculate_formulas' => false,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Enable strict null comparison
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When enabling strict null comparison empty cells ('') will
|
||||
| be added to the sheet.
|
||||
*/
|
||||
'strict_null_comparison' => false,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| CSV Settings
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Configure e.g. delimiter, enclosure and line ending for CSV exports.
|
||||
|
|
||||
*/
|
||||
'csv' => [
|
||||
'delimiter' => ',',
|
||||
'enclosure' => '"',
|
||||
'line_ending' => PHP_EOL,
|
||||
'use_bom' => false,
|
||||
'include_separator_line' => false,
|
||||
'excel_compatibility' => false,
|
||||
'output_encoding' => '',
|
||||
'test_auto_detect' => true,
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Worksheet properties
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Configure e.g. default title, creator, subject,...
|
||||
|
|
||||
*/
|
||||
'properties' => [
|
||||
'creator' => '',
|
||||
'lastModifiedBy' => '',
|
||||
'title' => '',
|
||||
'description' => '',
|
||||
'subject' => '',
|
||||
'keywords' => '',
|
||||
'category' => '',
|
||||
'manager' => '',
|
||||
'company' => '',
|
||||
],
|
||||
],
|
||||
|
||||
'imports' => [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Read Only
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When dealing with imports, you might only be interested in the
|
||||
| data that the sheet exists. By default we ignore all styles,
|
||||
| however if you want to do some logic based on style data
|
||||
| you can enable it by setting read_only to false.
|
||||
|
|
||||
*/
|
||||
'read_only' => true,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Ignore Empty
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When dealing with imports, you might be interested in ignoring
|
||||
| rows that have null values or empty strings. By default rows
|
||||
| containing empty strings or empty values are not ignored but can be
|
||||
| ignored by enabling the setting ignore_empty to true.
|
||||
|
|
||||
*/
|
||||
'ignore_empty' => false,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Heading Row Formatter
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Configure the heading row formatter.
|
||||
| Available options: none|slug|custom
|
||||
|
|
||||
*/
|
||||
'heading_row' => [
|
||||
'formatter' => 'slug',
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| CSV Settings
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Configure e.g. delimiter, enclosure and line ending for CSV imports.
|
||||
|
|
||||
*/
|
||||
'csv' => [
|
||||
'delimiter' => null,
|
||||
'enclosure' => '"',
|
||||
'escape_character' => '\\',
|
||||
'contiguous' => false,
|
||||
'input_encoding' => 'UTF-8',
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Worksheet properties
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Configure e.g. default title, creator, subject,...
|
||||
|
|
||||
*/
|
||||
'properties' => [
|
||||
'creator' => '',
|
||||
'lastModifiedBy' => '',
|
||||
'title' => '',
|
||||
'description' => '',
|
||||
'subject' => '',
|
||||
'keywords' => '',
|
||||
'category' => '',
|
||||
'manager' => '',
|
||||
'company' => '',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Extension detector
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Configure here which writer/reader type should be used when the package
|
||||
| needs to guess the correct type based on the extension alone.
|
||||
|
|
||||
*/
|
||||
'extension_detector' => [
|
||||
'xlsx' => Excel::XLSX,
|
||||
'xlsm' => Excel::XLSX,
|
||||
'xltx' => Excel::XLSX,
|
||||
'xltm' => Excel::XLSX,
|
||||
'xls' => Excel::XLS,
|
||||
'xlt' => Excel::XLS,
|
||||
'ods' => Excel::ODS,
|
||||
'ots' => Excel::ODS,
|
||||
'slk' => Excel::SLK,
|
||||
'xml' => Excel::XML,
|
||||
'gnumeric' => Excel::GNUMERIC,
|
||||
'htm' => Excel::HTML,
|
||||
'html' => Excel::HTML,
|
||||
'csv' => Excel::CSV,
|
||||
'tsv' => Excel::TSV,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| PDF Extension
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Configure here which Pdf driver should be used by default.
|
||||
| Available options: Excel::MPDF | Excel::TCPDF | Excel::DOMPDF
|
||||
|
|
||||
*/
|
||||
'pdf' => Excel::DOMPDF,
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Value Binder
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| PhpSpreadsheet offers a way to hook into the process of a value being
|
||||
| written to a cell. In there some assumptions are made on how the
|
||||
| value should be formatted. If you want to change those defaults,
|
||||
| you can implement your own default value binder.
|
||||
|
|
||||
| Possible value binders:
|
||||
|
|
||||
| [x] Maatwebsite\Excel\DefaultValueBinder::class
|
||||
| [x] PhpOffice\PhpSpreadsheet\Cell\StringValueBinder::class
|
||||
| [x] PhpOffice\PhpSpreadsheet\Cell\AdvancedValueBinder::class
|
||||
|
|
||||
*/
|
||||
'value_binder' => [
|
||||
'default' => Maatwebsite\Excel\DefaultValueBinder::class,
|
||||
],
|
||||
|
||||
'cache' => [
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default cell caching driver
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| By default PhpSpreadsheet keeps all cell values in memory, however when
|
||||
| dealing with large files, this might result into memory issues. If you
|
||||
| want to mitigate that, you can configure a cell caching driver here.
|
||||
| When using the illuminate driver, it will store each value in the
|
||||
| cache store. This can slow down the process, because it needs to
|
||||
| store each value. You can use the "batch" store if you want to
|
||||
| only persist to the store when the memory limit is reached.
|
||||
|
|
||||
| Drivers: memory|illuminate|batch
|
||||
|
|
||||
*/
|
||||
'driver' => 'memory',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Batch memory caching
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When dealing with the "batch" caching driver, it will only
|
||||
| persist to the store when the memory limit is reached.
|
||||
| Here you can tweak the memory limit to your liking.
|
||||
|
|
||||
*/
|
||||
'batch' => [
|
||||
'memory_limit' => 60000,
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Illuminate cache
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When using the "illuminate" caching driver, it will automatically use
|
||||
| your default cache store. However if you prefer to have the cell
|
||||
| cache on a separate store, you can configure the store name here.
|
||||
| You can use any store defined in your cache config. When leaving
|
||||
| at "null" it will use the default store.
|
||||
|
|
||||
*/
|
||||
'illuminate' => [
|
||||
'store' => null,
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Transaction Handler
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| By default the import is wrapped in a transaction. This is useful
|
||||
| for when an import may fail and you want to retry it. With the
|
||||
| transactions, the previous import gets rolled-back.
|
||||
|
|
||||
| You can disable the transaction handler by setting this to null.
|
||||
| Or you can choose a custom made transaction handler here.
|
||||
|
|
||||
| Supported handlers: null|db
|
||||
|
|
||||
*/
|
||||
'transactions' => [
|
||||
'handler' => 'db',
|
||||
'db' => [
|
||||
'connection' => null,
|
||||
],
|
||||
],
|
||||
|
||||
'temporary_files' => [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Local Temporary Path
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When exporting and importing files, we use a temporary file, before
|
||||
| storing reading or downloading. Here you can customize that path.
|
||||
|
|
||||
*/
|
||||
'local_path' => storage_path('framework/cache/laravel-excel'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Remote Temporary Disk
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When dealing with a multi server setup with queues in which you
|
||||
| cannot rely on having a shared local temporary path, you might
|
||||
| want to store the temporary file on a shared disk. During the
|
||||
| queue executing, we'll retrieve the temporary file from that
|
||||
| location instead. When left to null, it will always use
|
||||
| the local path. This setting only has effect when using
|
||||
| in conjunction with queued imports and exports.
|
||||
|
|
||||
*/
|
||||
'remote_disk' => null,
|
||||
'remote_prefix' => null,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Force Resync
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When dealing with a multi server setup as above, it's possible
|
||||
| for the clean up that occurs after entire queue has been run to only
|
||||
| cleanup the server that the last AfterImportJob runs on. The rest of the server
|
||||
| would still have the local temporary file stored on it. In this case your
|
||||
| local storage limits can be exceeded and future imports won't be processed.
|
||||
| To mitigate this you can set this config value to be true, so that after every
|
||||
| queued chunk is processed the local temporary file is deleted on the server that
|
||||
| processed it.
|
||||
|
|
||||
*/
|
||||
'force_resync_remote' => null,
|
||||
],
|
||||
];
|
||||
76
mitra-panen-skripsi-main/config/filesystems.php
Normal file
76
mitra-panen-skripsi-main/config/filesystems.php
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Filesystem Disk
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify the default filesystem disk that should be used
|
||||
| by the framework. The "local" disk, as well as a variety of cloud
|
||||
| based disks are available to your application. Just store away!
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('FILESYSTEM_DISK', 'local'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Filesystem Disks
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may configure as many filesystem "disks" as you wish, and you
|
||||
| may even configure multiple disks of the same driver. Defaults have
|
||||
| been set up for each driver as an example of the required values.
|
||||
|
|
||||
| Supported Drivers: "local", "ftp", "sftp", "s3"
|
||||
|
|
||||
*/
|
||||
|
||||
'disks' => [
|
||||
|
||||
'local' => [
|
||||
'driver' => 'local',
|
||||
'root' => storage_path('app'),
|
||||
'throw' => false,
|
||||
],
|
||||
|
||||
'public' => [
|
||||
'driver' => 'local',
|
||||
'root' => storage_path('app/public'),
|
||||
'url' => env('APP_URL').'/storage',
|
||||
'visibility' => 'public',
|
||||
'throw' => false,
|
||||
],
|
||||
|
||||
's3' => [
|
||||
'driver' => 's3',
|
||||
'key' => env('AWS_ACCESS_KEY_ID'),
|
||||
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
||||
'region' => env('AWS_DEFAULT_REGION'),
|
||||
'bucket' => env('AWS_BUCKET'),
|
||||
'url' => env('AWS_URL'),
|
||||
'endpoint' => env('AWS_ENDPOINT'),
|
||||
'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false),
|
||||
'throw' => false,
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Symbolic Links
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may configure the symbolic links that will be created when the
|
||||
| `storage:link` Artisan command is executed. The array keys should be
|
||||
| the locations of the links and the values should be their targets.
|
||||
|
|
||||
*/
|
||||
|
||||
'links' => [
|
||||
public_path('storage') => storage_path('app/public'),
|
||||
],
|
||||
|
||||
];
|
||||
52
mitra-panen-skripsi-main/config/hashing.php
Normal file
52
mitra-panen-skripsi-main/config/hashing.php
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Hash Driver
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option controls the default hash driver that will be used to hash
|
||||
| passwords for your application. By default, the bcrypt algorithm is
|
||||
| used; however, you remain free to modify this option if you wish.
|
||||
|
|
||||
| Supported: "bcrypt", "argon", "argon2id"
|
||||
|
|
||||
*/
|
||||
|
||||
'driver' => 'bcrypt',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Bcrypt Options
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify the configuration options that should be used when
|
||||
| passwords are hashed using the Bcrypt algorithm. This will allow you
|
||||
| to control the amount of time it takes to hash the given password.
|
||||
|
|
||||
*/
|
||||
|
||||
'bcrypt' => [
|
||||
'rounds' => env('BCRYPT_ROUNDS', 10),
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Argon Options
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify the configuration options that should be used when
|
||||
| passwords are hashed using the Argon algorithm. These will allow you
|
||||
| to control the amount of time it takes to hash the given password.
|
||||
|
|
||||
*/
|
||||
|
||||
'argon' => [
|
||||
'memory' => 65536,
|
||||
'threads' => 1,
|
||||
'time' => 4,
|
||||
],
|
||||
|
||||
];
|
||||
122
mitra-panen-skripsi-main/config/logging.php
Normal file
122
mitra-panen-skripsi-main/config/logging.php
Normal file
|
|
@ -0,0 +1,122 @@
|
|||
<?php
|
||||
|
||||
use Monolog\Handler\NullHandler;
|
||||
use Monolog\Handler\StreamHandler;
|
||||
use Monolog\Handler\SyslogUdpHandler;
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Log Channel
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option defines the default log channel that gets used when writing
|
||||
| messages to the logs. The name specified in this option should match
|
||||
| one of the channels defined in the "channels" configuration array.
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('LOG_CHANNEL', 'stack'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Deprecations Log Channel
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option controls the log channel that should be used to log warnings
|
||||
| regarding deprecated PHP and library features. This allows you to get
|
||||
| your application ready for upcoming major versions of dependencies.
|
||||
|
|
||||
*/
|
||||
|
||||
'deprecations' => [
|
||||
'channel' => env('LOG_DEPRECATIONS_CHANNEL', 'null'),
|
||||
'trace' => false,
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Log Channels
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may configure the log channels for your application. Out of
|
||||
| the box, Laravel uses the Monolog PHP logging library. This gives
|
||||
| you a variety of powerful log handlers / formatters to utilize.
|
||||
|
|
||||
| Available Drivers: "single", "daily", "slack", "syslog",
|
||||
| "errorlog", "monolog",
|
||||
| "custom", "stack"
|
||||
|
|
||||
*/
|
||||
|
||||
'channels' => [
|
||||
'stack' => [
|
||||
'driver' => 'stack',
|
||||
'channels' => ['single'],
|
||||
'ignore_exceptions' => false,
|
||||
],
|
||||
|
||||
'single' => [
|
||||
'driver' => 'single',
|
||||
'path' => storage_path('logs/laravel.log'),
|
||||
'level' => env('LOG_LEVEL', 'debug'),
|
||||
],
|
||||
|
||||
'daily' => [
|
||||
'driver' => 'daily',
|
||||
'path' => storage_path('logs/laravel.log'),
|
||||
'level' => env('LOG_LEVEL', 'debug'),
|
||||
'days' => 14,
|
||||
],
|
||||
|
||||
'slack' => [
|
||||
'driver' => 'slack',
|
||||
'url' => env('LOG_SLACK_WEBHOOK_URL'),
|
||||
'username' => 'Laravel Log',
|
||||
'emoji' => ':boom:',
|
||||
'level' => env('LOG_LEVEL', 'critical'),
|
||||
],
|
||||
|
||||
'papertrail' => [
|
||||
'driver' => 'monolog',
|
||||
'level' => env('LOG_LEVEL', 'debug'),
|
||||
'handler' => env('LOG_PAPERTRAIL_HANDLER', SyslogUdpHandler::class),
|
||||
'handler_with' => [
|
||||
'host' => env('PAPERTRAIL_URL'),
|
||||
'port' => env('PAPERTRAIL_PORT'),
|
||||
'connectionString' => 'tls://'.env('PAPERTRAIL_URL').':'.env('PAPERTRAIL_PORT'),
|
||||
],
|
||||
],
|
||||
|
||||
'stderr' => [
|
||||
'driver' => 'monolog',
|
||||
'level' => env('LOG_LEVEL', 'debug'),
|
||||
'handler' => StreamHandler::class,
|
||||
'formatter' => env('LOG_STDERR_FORMATTER'),
|
||||
'with' => [
|
||||
'stream' => 'php://stderr',
|
||||
],
|
||||
],
|
||||
|
||||
'syslog' => [
|
||||
'driver' => 'syslog',
|
||||
'level' => env('LOG_LEVEL', 'debug'),
|
||||
],
|
||||
|
||||
'errorlog' => [
|
||||
'driver' => 'errorlog',
|
||||
'level' => env('LOG_LEVEL', 'debug'),
|
||||
],
|
||||
|
||||
'null' => [
|
||||
'driver' => 'monolog',
|
||||
'handler' => NullHandler::class,
|
||||
],
|
||||
|
||||
'emergency' => [
|
||||
'path' => storage_path('logs/laravel.log'),
|
||||
],
|
||||
],
|
||||
|
||||
];
|
||||
118
mitra-panen-skripsi-main/config/mail.php
Normal file
118
mitra-panen-skripsi-main/config/mail.php
Normal file
|
|
@ -0,0 +1,118 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Mailer
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option controls the default mailer that is used to send any email
|
||||
| messages sent by your application. Alternative mailers may be setup
|
||||
| and used as needed; however, this mailer will be used by default.
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('MAIL_MAILER', 'smtp'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Mailer Configurations
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may configure all of the mailers used by your application plus
|
||||
| their respective settings. Several examples have been configured for
|
||||
| you and you are free to add your own as your application requires.
|
||||
|
|
||||
| Laravel supports a variety of mail "transport" drivers to be used while
|
||||
| sending an e-mail. You will specify which one you are using for your
|
||||
| mailers below. You are free to add additional mailers as required.
|
||||
|
|
||||
| Supported: "smtp", "sendmail", "mailgun", "ses",
|
||||
| "postmark", "log", "array", "failover"
|
||||
|
|
||||
*/
|
||||
|
||||
'mailers' => [
|
||||
'smtp' => [
|
||||
'transport' => 'smtp',
|
||||
'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
|
||||
'port' => env('MAIL_PORT', 587),
|
||||
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
|
||||
'username' => env('MAIL_USERNAME'),
|
||||
'password' => env('MAIL_PASSWORD'),
|
||||
'timeout' => null,
|
||||
'local_domain' => env('MAIL_EHLO_DOMAIN'),
|
||||
],
|
||||
|
||||
'ses' => [
|
||||
'transport' => 'ses',
|
||||
],
|
||||
|
||||
'mailgun' => [
|
||||
'transport' => 'mailgun',
|
||||
],
|
||||
|
||||
'postmark' => [
|
||||
'transport' => 'postmark',
|
||||
],
|
||||
|
||||
'sendmail' => [
|
||||
'transport' => 'sendmail',
|
||||
'path' => env('MAIL_SENDMAIL_PATH', '/usr/sbin/sendmail -bs -i'),
|
||||
],
|
||||
|
||||
'log' => [
|
||||
'transport' => 'log',
|
||||
'channel' => env('MAIL_LOG_CHANNEL'),
|
||||
],
|
||||
|
||||
'array' => [
|
||||
'transport' => 'array',
|
||||
],
|
||||
|
||||
'failover' => [
|
||||
'transport' => 'failover',
|
||||
'mailers' => [
|
||||
'smtp',
|
||||
'log',
|
||||
],
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Global "From" Address
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| You may wish for all e-mails sent by your application to be sent from
|
||||
| the same address. Here, you may specify a name and address that is
|
||||
| used globally for all e-mails that are sent by your application.
|
||||
|
|
||||
*/
|
||||
|
||||
'from' => [
|
||||
'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
|
||||
'name' => env('MAIL_FROM_NAME', 'Example'),
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Markdown Mail Settings
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| If you are using Markdown based email rendering, you may configure your
|
||||
| theme and component paths here, allowing you to customize the design
|
||||
| of the emails. Or, you may simply stick with the Laravel defaults!
|
||||
|
|
||||
*/
|
||||
|
||||
'markdown' => [
|
||||
'theme' => 'default',
|
||||
|
||||
'paths' => [
|
||||
resource_path('views/vendor/mail'),
|
||||
],
|
||||
],
|
||||
|
||||
];
|
||||
93
mitra-panen-skripsi-main/config/queue.php
Normal file
93
mitra-panen-skripsi-main/config/queue.php
Normal file
|
|
@ -0,0 +1,93 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Queue Connection Name
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Laravel's queue API supports an assortment of back-ends via a single
|
||||
| API, giving you convenient access to each back-end using the same
|
||||
| syntax for every one. Here you may define a default connection.
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('QUEUE_CONNECTION', 'sync'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Queue Connections
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may configure the connection information for each server that
|
||||
| is used by your application. A default configuration has been added
|
||||
| for each back-end shipped with Laravel. You are free to add more.
|
||||
|
|
||||
| Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null"
|
||||
|
|
||||
*/
|
||||
|
||||
'connections' => [
|
||||
|
||||
'sync' => [
|
||||
'driver' => 'sync',
|
||||
],
|
||||
|
||||
'database' => [
|
||||
'driver' => 'database',
|
||||
'table' => 'jobs',
|
||||
'queue' => 'default',
|
||||
'retry_after' => 90,
|
||||
'after_commit' => false,
|
||||
],
|
||||
|
||||
'beanstalkd' => [
|
||||
'driver' => 'beanstalkd',
|
||||
'host' => 'localhost',
|
||||
'queue' => 'default',
|
||||
'retry_after' => 90,
|
||||
'block_for' => 0,
|
||||
'after_commit' => false,
|
||||
],
|
||||
|
||||
'sqs' => [
|
||||
'driver' => 'sqs',
|
||||
'key' => env('AWS_ACCESS_KEY_ID'),
|
||||
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
||||
'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'),
|
||||
'queue' => env('SQS_QUEUE', 'default'),
|
||||
'suffix' => env('SQS_SUFFIX'),
|
||||
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
|
||||
'after_commit' => false,
|
||||
],
|
||||
|
||||
'redis' => [
|
||||
'driver' => 'redis',
|
||||
'connection' => 'default',
|
||||
'queue' => env('REDIS_QUEUE', 'default'),
|
||||
'retry_after' => 90,
|
||||
'block_for' => null,
|
||||
'after_commit' => false,
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Failed Queue Jobs
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| These options configure the behavior of failed queue job logging so you
|
||||
| can control which database and table are used to store the jobs that
|
||||
| have failed. You may change them to any database / table you wish.
|
||||
|
|
||||
*/
|
||||
|
||||
'failed' => [
|
||||
'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'),
|
||||
'database' => env('DB_CONNECTION', 'mysql'),
|
||||
'table' => 'failed_jobs',
|
||||
],
|
||||
|
||||
];
|
||||
67
mitra-panen-skripsi-main/config/sanctum.php
Normal file
67
mitra-panen-skripsi-main/config/sanctum.php
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
<?php
|
||||
|
||||
use Laravel\Sanctum\Sanctum;
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Stateful Domains
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Requests from the following domains / hosts will receive stateful API
|
||||
| authentication cookies. Typically, these should include your local
|
||||
| and production domains which access your API via a frontend SPA.
|
||||
|
|
||||
*/
|
||||
|
||||
'stateful' => explode(',', env('SANCTUM_STATEFUL_DOMAINS', sprintf(
|
||||
'%s%s',
|
||||
'localhost,localhost:3000,127.0.0.1,127.0.0.1:8000,::1',
|
||||
Sanctum::currentApplicationUrlWithPort()
|
||||
))),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Sanctum Guards
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This array contains the authentication guards that will be checked when
|
||||
| Sanctum is trying to authenticate a request. If none of these guards
|
||||
| are able to authenticate the request, Sanctum will use the bearer
|
||||
| token that's present on an incoming request for authentication.
|
||||
|
|
||||
*/
|
||||
|
||||
'guard' => ['web'],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Expiration Minutes
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This value controls the number of minutes until an issued token will be
|
||||
| considered expired. If this value is null, personal access tokens do
|
||||
| not expire. This won't tweak the lifetime of first-party sessions.
|
||||
|
|
||||
*/
|
||||
|
||||
'expiration' => null,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Sanctum Middleware
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When authenticating your first-party SPA with Sanctum you may need to
|
||||
| customize some of the middleware Sanctum uses while processing the
|
||||
| request. You may change the middleware listed below as required.
|
||||
|
|
||||
*/
|
||||
|
||||
'middleware' => [
|
||||
'verify_csrf_token' => App\Http\Middleware\VerifyCsrfToken::class,
|
||||
'encrypt_cookies' => App\Http\Middleware\EncryptCookies::class,
|
||||
],
|
||||
|
||||
];
|
||||
34
mitra-panen-skripsi-main/config/services.php
Normal file
34
mitra-panen-skripsi-main/config/services.php
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Third Party Services
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This file is for storing the credentials for third party services such
|
||||
| as Mailgun, Postmark, AWS and more. This file provides the de facto
|
||||
| location for this type of information, allowing packages to have
|
||||
| a conventional file to locate the various service credentials.
|
||||
|
|
||||
*/
|
||||
|
||||
'mailgun' => [
|
||||
'domain' => env('MAILGUN_DOMAIN'),
|
||||
'secret' => env('MAILGUN_SECRET'),
|
||||
'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'),
|
||||
'scheme' => 'https',
|
||||
],
|
||||
|
||||
'postmark' => [
|
||||
'token' => env('POSTMARK_TOKEN'),
|
||||
],
|
||||
|
||||
'ses' => [
|
||||
'key' => env('AWS_ACCESS_KEY_ID'),
|
||||
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
||||
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
|
||||
],
|
||||
|
||||
];
|
||||
201
mitra-panen-skripsi-main/config/session.php
Normal file
201
mitra-panen-skripsi-main/config/session.php
Normal file
|
|
@ -0,0 +1,201 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Session Driver
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option controls the default session "driver" that will be used on
|
||||
| requests. By default, we will use the lightweight native driver but
|
||||
| you may specify any of the other wonderful drivers provided here.
|
||||
|
|
||||
| Supported: "file", "cookie", "database", "apc",
|
||||
| "memcached", "redis", "dynamodb", "array"
|
||||
|
|
||||
*/
|
||||
|
||||
'driver' => env('SESSION_DRIVER', 'file'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Lifetime
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify the number of minutes that you wish the session
|
||||
| to be allowed to remain idle before it expires. If you want them
|
||||
| to immediately expire on the browser closing, set that option.
|
||||
|
|
||||
*/
|
||||
|
||||
'lifetime' => env('SESSION_LIFETIME', 120),
|
||||
|
||||
'expire_on_close' => false,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Encryption
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option allows you to easily specify that all of your session data
|
||||
| should be encrypted before it is stored. All encryption will be run
|
||||
| automatically by Laravel and you can use the Session like normal.
|
||||
|
|
||||
*/
|
||||
|
||||
'encrypt' => false,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session File Location
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When using the native session driver, we need a location where session
|
||||
| files may be stored. A default has been set for you but a different
|
||||
| location may be specified. This is only needed for file sessions.
|
||||
|
|
||||
*/
|
||||
|
||||
'files' => storage_path('framework/sessions'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Database Connection
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When using the "database" or "redis" session drivers, you may specify a
|
||||
| connection that should be used to manage these sessions. This should
|
||||
| correspond to a connection in your database configuration options.
|
||||
|
|
||||
*/
|
||||
|
||||
'connection' => env('SESSION_CONNECTION'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Database Table
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When using the "database" session driver, you may specify the table we
|
||||
| should use to manage the sessions. Of course, a sensible default is
|
||||
| provided for you; however, you are free to change this as needed.
|
||||
|
|
||||
*/
|
||||
|
||||
'table' => 'sessions',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Cache Store
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| While using one of the framework's cache driven session backends you may
|
||||
| list a cache store that should be used for these sessions. This value
|
||||
| must match with one of the application's configured cache "stores".
|
||||
|
|
||||
| Affects: "apc", "dynamodb", "memcached", "redis"
|
||||
|
|
||||
*/
|
||||
|
||||
'store' => env('SESSION_STORE'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Sweeping Lottery
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Some session drivers must manually sweep their storage location to get
|
||||
| rid of old sessions from storage. Here are the chances that it will
|
||||
| happen on a given request. By default, the odds are 2 out of 100.
|
||||
|
|
||||
*/
|
||||
|
||||
'lottery' => [2, 100],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Cookie Name
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may change the name of the cookie used to identify a session
|
||||
| instance by ID. The name specified here will get used every time a
|
||||
| new session cookie is created by the framework for every driver.
|
||||
|
|
||||
*/
|
||||
|
||||
'cookie' => env(
|
||||
'SESSION_COOKIE',
|
||||
Str::slug(env('APP_NAME', 'laravel'), '_').'_session'
|
||||
),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Cookie Path
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The session cookie path determines the path for which the cookie will
|
||||
| be regarded as available. Typically, this will be the root path of
|
||||
| your application but you are free to change this when necessary.
|
||||
|
|
||||
*/
|
||||
|
||||
'path' => '/',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Cookie Domain
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may change the domain of the cookie used to identify a session
|
||||
| in your application. This will determine which domains the cookie is
|
||||
| available to in your application. A sensible default has been set.
|
||||
|
|
||||
*/
|
||||
|
||||
'domain' => env('SESSION_DOMAIN'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| HTTPS Only Cookies
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| By setting this option to true, session cookies will only be sent back
|
||||
| to the server if the browser has a HTTPS connection. This will keep
|
||||
| the cookie from being sent to you when it can't be done securely.
|
||||
|
|
||||
*/
|
||||
|
||||
'secure' => env('SESSION_SECURE_COOKIE'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| HTTP Access Only
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Setting this value to true will prevent JavaScript from accessing the
|
||||
| value of the cookie and the cookie will only be accessible through
|
||||
| the HTTP protocol. You are free to modify this option if needed.
|
||||
|
|
||||
*/
|
||||
|
||||
'http_only' => true,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Same-Site Cookies
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option determines how your cookies behave when cross-site requests
|
||||
| take place, and can be used to mitigate CSRF attacks. By default, we
|
||||
| will set this value to "lax" since this is a secure default value.
|
||||
|
|
||||
| Supported: "lax", "strict", "none", null
|
||||
|
|
||||
*/
|
||||
|
||||
'same_site' => 'lax',
|
||||
|
||||
];
|
||||
212
mitra-panen-skripsi-main/config/sweetalert.php
Normal file
212
mitra-panen-skripsi-main/config/sweetalert.php
Normal file
|
|
@ -0,0 +1,212 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| CDN LINK
|
||||
|--------------------------------------------------------------------------
|
||||
| By default SweetAlert2 use its local sweetalert.all.js
|
||||
| file.
|
||||
| However, you can use its cdn if you want.
|
||||
|
|
||||
*/
|
||||
|
||||
'cdn' => env('SWEET_ALERT_CDN'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Always load the sweetalert.all.js
|
||||
|--------------------------------------------------------------------------
|
||||
| There might be situations where you will always want the sweet alert
|
||||
| js package to be there for you. (for eg. you might use it heavily to
|
||||
| show notifications or you might want to use the native js) then this
|
||||
| might be handy.
|
||||
|
|
||||
*/
|
||||
|
||||
'alwaysLoadJS' => env('SWEET_ALERT_ALWAYS_LOAD_JS', false),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Never load the sweetalert.all.js
|
||||
|--------------------------------------------------------------------------
|
||||
| If you want to handle the sweet alert js package by yourself
|
||||
| (for eg. you might want to use laravel mix) then this can be
|
||||
| handy.
|
||||
| If you set always load js to true & never load js to false,
|
||||
| it's going to prioritize the never load js.
|
||||
|
|
||||
| alwaysLoadJs = true & neverLoadJs = true => js will not be loaded
|
||||
| alwaysLoadJs = true & neverLoadJs = false => js will be loaded
|
||||
| alwaysLoadJs = false & neverLoadJs = false => js will be loaded when
|
||||
| you set alert/toast by using the facade/helper functions.
|
||||
*/
|
||||
|
||||
'neverLoadJS' => env('SWEET_ALERT_NEVER_LOAD_JS', false),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| AutoClose Timer
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This is for the all Modal windows.
|
||||
| For specific modal just use the autoClose() helper method.
|
||||
|
|
||||
*/
|
||||
|
||||
'timer' => env('SWEET_ALERT_TIMER', 5000),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Width
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Modal window width, including paddings (box-sizing: border-box).
|
||||
| Can be in px or %.
|
||||
| The default width is 32rem.
|
||||
| This is for the all Modal windows.
|
||||
| for particular modal just use the width() helper method.
|
||||
*/
|
||||
|
||||
'width' => env('SWEET_ALERT_WIDTH', '32rem'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Height Auto
|
||||
|--------------------------------------------------------------------------
|
||||
| By default, SweetAlert2 sets html's and body's CSS height to auto !important.
|
||||
| If this behavior isn't compatible with your project's layout,
|
||||
| set heightAuto to false.
|
||||
|
|
||||
*/
|
||||
|
||||
'height_auto' => env('SWEET_ALERT_HEIGHT_AUTO', true),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Padding
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Modal window padding.
|
||||
| Can be in px or %.
|
||||
| The default padding is 1.25rem.
|
||||
| This is for the all Modal windows.
|
||||
| for particular modal just use the padding() helper method.
|
||||
*/
|
||||
|
||||
'padding' => env('SWEET_ALERT_PADDING', '1.25rem'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Animation
|
||||
|--------------------------------------------------------------------------
|
||||
| Custom animation with [Animate.css](https://daneden.github.io/animate.css/)
|
||||
| If set to false, modal CSS animation will be use default ones.
|
||||
| For specific modal just use the animation() helper method.
|
||||
|
|
||||
*/
|
||||
|
||||
'animation' => [
|
||||
'enable' => env('SWEET_ALERT_ANIMATION_ENABLE', false),
|
||||
],
|
||||
|
||||
'animatecss' => env('SWEET_ALERT_ANIMATECSS', 'https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| ShowConfirmButton
|
||||
|--------------------------------------------------------------------------
|
||||
| If set to false, a "Confirm"-button will not be shown.
|
||||
| It can be useful when you're using custom HTML description.
|
||||
| This is for the all Modal windows.
|
||||
| For specific modal just use the showConfirmButton() helper method.
|
||||
|
|
||||
*/
|
||||
|
||||
'show_confirm_button' => env('SWEET_ALERT_CONFIRM_BUTTON', true),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| ShowCloseButton
|
||||
|--------------------------------------------------------------------------
|
||||
| If set to true, a "Close"-button will be shown,
|
||||
| which the user can click on to dismiss the modal.
|
||||
| This is for the all Modal windows.
|
||||
| For specific modal just use the showCloseButton() helper method.
|
||||
|
|
||||
*/
|
||||
|
||||
'show_close_button' => env('SWEET_ALERT_CLOSE_BUTTON', false),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Toast position
|
||||
|--------------------------------------------------------------------------
|
||||
| Modal window or toast position, can be 'top',
|
||||
| 'top-start', 'top-end', 'center', 'center-start',
|
||||
| 'center-end', 'bottom', 'bottom-start', or 'bottom-end'.
|
||||
| For specific modal just use the position() helper method.
|
||||
|
|
||||
*/
|
||||
|
||||
'toast_position' => env('SWEET_ALERT_TOAST_POSITION', 'top-end'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Progress Bar
|
||||
|--------------------------------------------------------------------------
|
||||
| If set to true, a progress bar at the bottom of a popup will be shown.
|
||||
| It can be useful with toasts.
|
||||
|
|
||||
*/
|
||||
|
||||
'timer_progress_bar' => env('SWEET_ALERT_TIMER_PROGRESS_BAR', false),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Middleware
|
||||
|--------------------------------------------------------------------------
|
||||
| Modal window or toast, config for the Middleware
|
||||
|
|
||||
*/
|
||||
|
||||
'middleware' => [
|
||||
|
||||
'autoClose' => env('SWEET_ALERT_MIDDLEWARE_AUTO_CLOSE', false),
|
||||
|
||||
'toast_position' => env('SWEET_ALERT_MIDDLEWARE_TOAST_POSITION', 'top-end'),
|
||||
|
||||
'toast_close_button' => env('SWEET_ALERT_MIDDLEWARE_TOAST_CLOSE_BUTTON', true),
|
||||
|
||||
'timer' => env('SWEET_ALERT_MIDDLEWARE_ALERT_CLOSE_TIME', 6000),
|
||||
|
||||
'auto_display_error_messages' => env('SWEET_ALERT_AUTO_DISPLAY_ERROR_MESSAGES', false),
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Custom Class
|
||||
|--------------------------------------------------------------------------
|
||||
| A custom CSS class for the modal:
|
||||
|
|
||||
*/
|
||||
|
||||
'customClass' => [
|
||||
|
||||
'container' => env('SWEET_ALERT_CONTAINER_CLASS'),
|
||||
'popup' => env('SWEET_ALERT_POPUP_CLASS'),
|
||||
'header' => env('SWEET_ALERT_HEADER_CLASS'),
|
||||
'title' => env('SWEET_ALERT_TITLE_CLASS'),
|
||||
'closeButton' => env('SWEET_ALERT_CLOSE_BUTTON_CLASS'),
|
||||
'icon' => env('SWEET_ALERT_ICON_CLASS'),
|
||||
'image' => env('SWEET_ALERT_IMAGE_CLASS'),
|
||||
'content' => env('SWEET_ALERT_CONTENT_CLASS'),
|
||||
'input' => env('SWEET_ALERT_INPUT_CLASS'),
|
||||
'actions' => env('SWEET_ALERT_ACTIONS_CLASS'),
|
||||
'confirmButton' => env('SWEET_ALERT_CONFIRM_BUTTON_CLASS'),
|
||||
'cancelButton' => env('SWEET_ALERT_CANCEL_BUTTON_CLASS'),
|
||||
'footer' => env('SWEET_ALERT_FOOTER_CLASS'),
|
||||
],
|
||||
|
||||
];
|
||||
36
mitra-panen-skripsi-main/config/view.php
Normal file
36
mitra-panen-skripsi-main/config/view.php
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| View Storage Paths
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Most templating systems load templates from disk. Here you may specify
|
||||
| an array of paths that should be checked for your views. Of course
|
||||
| the usual Laravel view path has already been registered for you.
|
||||
|
|
||||
*/
|
||||
|
||||
'paths' => [
|
||||
resource_path('views'),
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Compiled View Path
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option determines where all the compiled Blade templates will be
|
||||
| stored for your application. Typically, this is within the storage
|
||||
| directory. However, as usual, you are free to change this value.
|
||||
|
|
||||
*/
|
||||
|
||||
'compiled' => env(
|
||||
'VIEW_COMPILED_PATH',
|
||||
realpath(storage_path('framework/views'))
|
||||
),
|
||||
|
||||
];
|
||||
1
mitra-panen-skripsi-main/database/.gitignore
vendored
Normal file
1
mitra-panen-skripsi-main/database/.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
*.sqlite*
|
||||
40
mitra-panen-skripsi-main/database/factories/UserFactory.php
Normal file
40
mitra-panen-skripsi-main/database/factories/UserFactory.php
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\User>
|
||||
*/
|
||||
class UserFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
'name' => fake()->name(),
|
||||
'email' => fake()->unique()->safeEmail(),
|
||||
'email_verified_at' => now(),
|
||||
'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password
|
||||
'remember_token' => Str::random(10),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicate that the model's email address should be unverified.
|
||||
*
|
||||
* @return static
|
||||
*/
|
||||
public function unverified()
|
||||
{
|
||||
return $this->state(fn (array $attributes) => [
|
||||
'email_verified_at' => null,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('users', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->string('email')->unique();
|
||||
$table->string('phone_number')->unique();
|
||||
$table->integer('role')->comment('1: admin, 2: mitra panen');
|
||||
$table->text('address')->nullable();
|
||||
$table->string('avatar')->nullable();
|
||||
$table->string('password');
|
||||
$table->rememberToken();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('users');
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('password_resets', function (Blueprint $table) {
|
||||
$table->string('email')->index();
|
||||
$table->string('token');
|
||||
$table->timestamp('created_at')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('password_resets');
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('failed_jobs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('uuid')->unique();
|
||||
$table->text('connection');
|
||||
$table->text('queue');
|
||||
$table->longText('payload');
|
||||
$table->longText('exception');
|
||||
$table->timestamp('failed_at')->useCurrent();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('failed_jobs');
|
||||
}
|
||||
};
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user