laravel ajax curd 검색 로그 인 판단 기능 구현
어떤 영어$는 중국어 로 대체 할 수 없습니다.
로그 인 데 이 터 는 목록 전시 와 섞 여 있 습 니 다.절대 저 와 같은 실 수 를 하지 마 세 요.
<form action="insert" method="post" enctype="multipart/form-data">
@csrf
<div style="width: 600px;height: auto;margin: 20px auto 0;">
<table>
<tr>
<td>
:
</td>
<td>
<input type="text" class="form-control" name="user">
</td>
</tr>
<tr>
<td>
:
</td>
<td>
<input type="text" class="form-control" name="name">
</td>
</tr>
<tr>
<td>
:
</td>
<td>
<input type="password" class="form-control" name="password">
</td>
</tr>
<tr>
<td>
</td>
<td>
<input type="password" class="form-control" name="password2">
</td>
</tr>
<tr>
<td>
</td>
<td>
<select name="i_id" class="form-control">
@foreach($arr as $v)
<option value="{{$v->id}}">{{$v->identity}}</option>
@endforeach
</select>
</td>
</tr>
<tr>
<td>
</td>
<td>
<select name="status" class="form-control">
<option value="0"> </option>
<option value="1"> </option>
</select>
</td>
</tr>
<tr>
<td>
</td>
<td>
<input type="text" class="form-control" name="tel">
</td>
</tr>
<tr>
<td>
IP 1
</td>
<td>
<input type="text" class="form-control" name="ip1">
</td>
</tr>
<tr>
<td>
IP 2
</td>
<td>
<input type="text" class="form-control" name="ip2">
</td>
</tr>
<tr>
<td>
</td>
<td>
<input type="file" name="img">
</td>
</tr>
<tr>
<td></td>
<td>
<button type="submit" class="btn btn-primary"> </button>
<button class="btn btn-primary">
<a href="show" rel="external nofollow" rel="external nofollow" style="color: white;text-decoration: none"> </a>
</button>
</td>
</tr>
</table>
</div>
</form>
그리고 추 가 된 컨트롤 러.
public function insert(Request $request){
$validatedData = $request->validate([
‘user' => ‘required',
‘name' => ‘required',
‘password' => ‘required',
‘i_id' => ‘required',
‘status' => ‘required',
‘tel' => ‘required',
‘ip1' => ‘required',
‘img' => ‘required',
]);
$data[‘user'] = $request[‘user'];
$data[‘name'] = $request[‘name'];
$data[‘password'] = $request[‘password'];
$data[‘i_id'] = $request[‘i_id'];
$data[‘status'] = $request[‘status'];
$data[‘tel'] = $request[‘tel'];
$data[‘ip1'] = $request[‘ip1'];
$data[‘ip2'] = $request[‘ip2'];
u r l = ′ h t t p : / / w w w . d 19. c o m / ′ ; ¥ p a t h = url = 'http://www.d19.com/'; ¥path =url=
′
http://www.d19.com/
′
;¥path=url.$request->file(‘img')->store(‘img');
$data[‘img'] = p a t h ; ¥ s s = L i s t m o d e l : : u − i n s e r t ( path; ¥ss = Listmodel::u-insert(path;¥ss=Listmodel::u−insert(data);
if ($ss){
echo "<script>alert(' ');window.location.href='show'</script> ";
}else{
echo "<script>alert(' , ');window.location.href='create'</script> ";
}
}
다음은 전시 페이지 입 니 다.전시 페이지 는 ajax 무 리 셋 삭제 추가 점프,수정 점프,대량 삭제,검색 페이지 를 포함 합 니 다.로그 인 상 태 를 기록 해 야 하기 때문에 로그 인 종료 버튼 도 있 습 니 다.물론 페이지 도 있 습 니 다.저 희 는 body 를 직접 놓 습 니 다.
<form action="">
<input type="text" name="user">
<button class="btn btn-primary"> </button>
<button class="btn btn-primary"><a href="clearn" rel="external nofollow" style="color: #ffffff;text-decoration: none"> </a></button>
</form>
<button id="batch" class="btn btn-primary">
</button>
<button class="btn btn-primary">
<a href="create" rel="external nofollow" style="text-decoration: none;color: white"> </a>
</button>
<table class="table">
<thead class="thead-dark">
<tr>
<th scope="col">
<span id="getall" style="cursor: pointer"> </span>/
<span id="noall" style="cursor: pointer"> </span>/
<span id="no" style="cursor: pointer"> </span>
</th>
<th scope="col">
</th>
<th scope="col">
</th>
<th scope="col">
</th>
<th scope="col">
</th>
<th scope="col">
</th>
<th scope="col">
</th>
<th scope="col">
ip 1
</th>
<th scope="col">
ip 2
</th>
<th scope="col">
</th>
<th scope="col">
</th>
</tr>
</thead>
@foreach( $arr as $v)
<tr>
<td>
<input type="checkbox" name="check" class="zi" checkid="{{$v->id}}">
</td>
<td>
{{$v->id}}
</td>
<td>
{{$v->user}}
</td>
<td>
{{$v->name}}
</td>
<td>
{{$v->i_id}}
</td>
<td>
@if($v->status == 0)
@elseif($v->status == 1)
@endif
</td>
<td>
{{$v->tel}}
</td>
<td>
{{$v->ip1}}
</td>
<td>
{{$v->ip2}}
</td>
<td>
<img src="{{$v->img}}" style="width: 30px;height: 30px;">
</td>
<td>
<button class="btn btn-danger dele2" d_id="{{$v->id}}"> </button>
<a href="update_show?id={{$v->id}}" rel="external nofollow" > </a>
</td>
</tr>
@endforeach
</table>
@if ($errors->any())
<div class="alert alert-danger">
<ul>
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif
{{$arr->appends(['user'=>$user])->links()}}
</div>
다음은 jquery 가 새로 고침 없 이 삭제,대량,그리고 우리 가 사용 할 때 온라인 jquery 나 파일 을 참조 해 야 합 니 다.코드 전시 에 문제 가 있어 서 바로 올 리 겠 습 니 다.
다음은 수정 작업 수정 입 니 다.
@csrf
<div style="width: 600px;height: auto;margin: 20px auto 0;">
<table>
<tr>
<td>
:
</td>
<td>
<input type="text" class="form-control" name="user" value="{{$arr['user']}}">
</td>
</tr>
<tr>
<td>
:
</td>
<td>
<input type="text" class="form-control" name="name" value="{{$arr['name']}}">
</td>
</tr>
<tr>
<td>
:
</td>
<td>
<input type="password" class="form-control" name="password" value="{{$arr['password']}}">
</td>
</tr>
<tr>
<td>
</td>
<td>
<input type="password" class="form-control" name="password2" value="{{$arr['password']}}">
</td>
</tr>
<tr>
<td>
</td>
<td>
<select name="i_id" class="form-control">
@if($arr['i_id'] == 1)
<option value="{{$arr['i_id']}}" selected> </option>
<option value="{{$arr['i_id']}}"> </option>
<option value="{{$arr['i_id']}}"> </option>
<option value="{{$arr['i_id']}}"> </option>
<option value="{{$arr['i_id']}}"> </option>
@elseif($arr['i_id'] == 2)
<option value="{{$arr['i_id']}}"> </option>
<option value="{{$arr['i_id']}}" selected> </option>
<option value="{{$arr['i_id']}}"> </option>
<option value="{{$arr['i_id']}}"> </option>
<option value="{{$arr['i_id']}}"> </option>
@elseif($arr['i_id'] == 3)
<option value="{{$arr['i_id']}}"> </option>
<option value="{{$arr['i_id']}}"> </option>
<option value="{{$arr['i_id']}}" selected> </option>
<option value="{{$arr['i_id']}}"> </option>
<option value="{{$arr['i_id']}}"> </option>
@elseif($arr['i_id'] == 4)
<option value="{{$arr['i_id']}}"> </option>
<option value="{{$arr['i_id']}}"> </option>
<option value="{{$arr['i_id']}}"> </option>
<option value="{{$arr['i_id']}}" selected> </option>
<option value="{{$arr['i_id']}}"> </option>
@elseif($arr['i_id'] == 5)
<option value="{{$arr['i_id']}}"> </option>
<option value="{{$arr['i_id']}}"> </option>
<option value="{{$arr['i_id']}}"> </option>
<option value="{{$arr['i_id']}}"> </option>
<option value="{{$arr['i_id']}}" selected> </option>
@else
@endif
</select>
</td>
</tr>
<tr>
<td>
</td>
<td>
<select name="status" class="form-control">
@if($arr['status'] == 0)
<option value="{{$arr['status']}}" selected> </option>
<option value="{{$arr['status']}}"> </option>
@elseif($arr['status'] == 1)
<option value="{{$arr['status']}}"> </option>
<option value="{{$arr['status']}}" selected> </option>
@endif
</select>
</td>
</tr>
<tr>
<td>
</td>
<td>
<input type="text" class="form-control" name="tel" value="{{$arr['tel']}}">
</td>
</tr>
<tr>
<td>
IP 1
</td>
<td>
<input type="text" class="form-control" name="ip1" value="{{$arr['ip1']}}">
</td>
</tr>
<tr>
<td>
IP 2
</td>
<td>
<input type="text" class="form-control" name="ip2" value="{{$arr['ip2']}}">
</td>
</tr>
<tr>
<td>
</td>
<td>
<input type="file" name="img">
</td>
</tr>
<tr>
<td></td>
<td>
<button type="submit" class="btn btn-primary"> </button>
<button class="btn btn-primary">
<a href="show" rel="external nofollow" rel="external nofollow" style="text-decoration: none;color: white"> </a>
</button>
</td>
</tr>
</table>
<input type="hidden" value="{{$arr['id']}}" name="id">
</div>
다음은 저희 가 기대 하 는 컨트롤 러 입 니 다.1.한 줄 의 새로 고침 없 음 삭제
2.대량 무 갱신 삭제
3.컨트롤 러 수정
4.수 정 된 보기
5.로그 인 컨트롤 러-저 희 는 세 션 기록 을 사용 하여 무 작위 로그 인 을 방지 합 니 다.
6.보기 컨트롤 러 C 를 보 여 줍 니 다.session 이 존재 하 는 지 판단 해 야 보 여 줍 니 다.
7.session 삭제-웹 페이지 가 자동 으로 종료 되 지 않 기 때문에 로그 인 을 종료 하 는 단 추 를 추가 하여 session 을 제거 합 니 다.
8.폼 의 보 기 를 추가 합 니 다.-우리 의 드 롭 다운 은 순환 이 필요 하기 때문에 데이터 베 이 스 를 가 져 왔 습 니 다.
9.폼 을 추가 하 는 컨트롤 러―우 리 는 vaidate 를 사용 하여 파일 업로드 에 필요 한 프론트 데스크 톱 지원 파일 형식 을 검증 했다.
자,잠시 그 정도 밖 에 없어 요.저 는 그냥 반찬 새 예요.아 는 것 이 많 지 않 아 요.큰 소 들 이 많이 가르쳐 주 셨 으 면 좋 겠 어 요.
여기 서 laravel ajax curd 검색 로그 인 판단 기능 의 실현 에 관 한 글 을 소개 합 니 다.더 많은 관련 laravel ajax curd 검색 로그 인 내용 은 우리 의 이전 글 을 검색 하거나 아래 의 관련 글 을 계속 찾 아 보 세 요.앞으로 많은 응원 바 랍 니 다!
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
Laravel - 변환된 유효성 검사 규칙으로 API 요청 제공동적 콘텐츠를 위해 API를 통해 Laravel CMS에 연결하는 모바일 앱(또는 웹사이트) 구축을 고려하십시오. 이제 앱은 CMS에서 번역된 콘텐츠를 받을 것으로 예상되는 다국어 앱이 될 수 있습니다. 일반적으로 ...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.