Здравствуйте помогите с проблемой. В общем разрабатываю приложение на Laravel+Vue.js, работаю в PhpStorm, данные могу записывать в базу данных, удалять, перезаписывать. Но когда разместил на хостинге, не могу записать данные в базу данных, выдаёт ошибку
"No query results for model"
Вот мой Controller:
class Journal_organizationController extends Controller
{
public function __invoke(Journal_organizationRequest $request)
{
$data = $request->validated();
Journal_organization:: create ($data);
return response([]);
}
}
public function rules(): array
{
return [
'id' => '',
'organizations' => '',
'number_dogovor' => '',
'title' => '',
'predmet' => '',
'address_actual' => '',
'branch' => '',
'executor' => '',
'name_citys' => '',
'name_regions' => '',
'name_districts' => '',
'note' => '',
'journal_date_id' => '',
];
}
Вот мой Request:
public function rules(): array
{
return [
'id' => '',
'organizations' => '',
'number_dogovor' => '',
'title' => '',
'predmet' => '',
'address_actual' => '',
'branch' => '',
'executor' => '',
'name_citys' => '',
'name_regions' => '',
'name_districts' => '',
'note' => '',
'journal_date_id' => '',
];
}
Вот моя Model:
class Journal_organization extends Model
{
use HasFactory;
protected $guarded = false;
protected $table = 'journal_organizations';
}
Это Мой Api:
Route::post('/joc/', [Journal_organizationController::class, '__invoke']);
Вот мой component:
data() {
return {
id: null,
organizations: null,
number_dogovor: null,
title: null,
predmet: null,
address_actual: null,
branch: null,
executor: null,
selectedcity_list: null,
lists_region_id: null,
name_regions: null,
lists_district_id: null,
name_districts: null,
note: null,
journal_date_id: null,
date: null,
predmets: []
}
},
watch: {
organizations(val) {
if (val)
this.getDogovor(val);
},
selectedcity_list(val) {
if (val)
this.getcity(val);
},
lists_region_id(val) {
if (val)
this.getregion(val);
},
lists_district_id(val) {
if (val)
this.getdistrict(val);
}
},
mounted() {
this.getPredmets();
this.getPoluhenie();
},
//Этот метод запускается при нажатии на кнопку добавить
methods: {
Add() {
axios.post('/api/journals/joc/', {
id: this.id,
organizations: this.organizations,
number_dogovor: this.number_dogovor,
title: this.title,
predmet: this.predmet,
address_actual: this.address_actual,
branch: this.branch,
executor: this.executor,
name_citys: this.name_citys,
name_regions: this.name_regions,
name_districts: this.name_districts,
note: this.note,
journal_date_id: this.journal_date_id
})
.then(res => {
this.id = null
this.organizations = null
this.number_dogovor = null
this.title = null
this.predmet = null
this.address_actual = null
this.branch = null
this.executor = null
this.name_citys = null
this.lists_region_id = null
this.selectedcity_list = null
this.name_regions = null
this.lists_district_id = null
this.name_districts = null
this.note = null
this.$nextTick(e => {
this.$refs['spisok-journal_organizations-componenet'].getpoluhenie()
})
})
},
dateFormat(currentDate) {
let date = new Date(currentDate);
if (!currentDate)
return '';
return ("0" + date.getDate()).slice(-2) + '.' + ("0" + (date.getMonth() + 1)).slice(-2) + '.' + date.getFullYear();
},
getPoluhenie() {
axios.get('/api/journals/' + this.$route.params.id)
.then(res => {
// console.log(res.data.data.id);
this.journal_date_id = res.data.data.id
this.date = res.data.data.date
})
},
getDogovor(id) {
axios.get('/api/dogovora/otdel_dogovorov/get_dogovor',{
params: {id}
}).then((response) => {
this.number_dogovor = response.data.number_dogovor;
this.predmet = response.data.id_predmet;
this.title = response.data.title;
console.log(response.data);
})
},
getPredmets() {
axios.get('/api/dogovora/otdel_dogovorov/get_dogovors', {
params: {
page: 1,
}
}).then((response) => {
this.predmets = response.data.predmets;
})
},
getcity(id) {
axios.get('/api/city_listsr',{
params: {id}
}).then((response) => {
this.lists_region_id = response.data.data[0].lists_region_id
this.name_citys = response.data.data[0].name_citys
})
},
getregion(id) {
axios.get('/api/region_listsr',{
params: {id}
}).then((response) => {
this.name_regions = response.data.data[0].name_regions
this.lists_district_id = response.data.data[0].lists_district_id
})
},
getdistrict(id) {
axios.get('/api/district_listsr',{
params: {id}
}).then((response) => {
this.name_districts = response.data.data[0].name_districts
})
},
}
}
</script>
<style lang="scss">
</style>
а удалять или перезаписывать могу. Что делать ума не приложу