Пример #1
0
 public function getTangNi()
 {
     if (Session::get('logined') == true) {
         $mang = $_GET;
         $monks = Monk::where(function ($a) use($mang) {
             if ($_GET != null) {
                 if ($_GET['temple'] != null) {
                     $a->where('last_temple', '=', $mang['temple']);
                 }
                 if ($_GET['position'] != null) {
                     $a->where('position', '=', $mang['position']);
                 }
                 if ($_GET['key'] != null && $_GET['type'] != null) {
                     $a->where($mang['type'], 'like', '%' . $mang['key'] . '%');
                 }
             }
         })->paginate(10);
         return View::make("frontend/monk/index")->with('monks', $monks);
     } else {
         return View::make("frontend/users/login");
     }
 }
Пример #2
0
@if(Session::get('logined') == true)
    <?php 
$data = Monk::find($_GET['id']);
?>
    <div>
        <div style="float: left">
            <img src="{{asset('uploads/thumbs/'.$data->image)}}">
        </div>
        <div style="float: left;margin-left: 20px;width: 400px">
            <table class="table">
                <tbody>
                <tr>
                    <td>Pháp Danh: </td>
                    <td>{{$data->phap_danh}}</td>
                </tr>            <tr>
                    <td>Thế Danh: </td>
                    <td>{{$data->the_danh}}</td>
                </tr>            <tr>
                    <td>Sinh Năm: </td>
                    <td>{{$data->birthday}}</td>
                </tr>
                <tr>
                    <td colspan="2">Thường trú: {{$data->adress}}</td>
                </tr>
                </tbody>
            </table>
        </div>
    </div>
@else
<?php 
Redirect::to('/');
Пример #3
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     // delete
     $monk = Monk::find($id);
     $monk->delete();
     Logfile::addData('Xóa', 'Tăng Ni', $monk->id, $monk->phap_danh);
     if (file_exists('uploads/' . $monk->image)) {
         unlink('uploads/' . $monk->image);
     }
     // redirect
     Session::flash('message', ' Đã bị xóa!');
     return Redirect::to('monks');
 }
Пример #4
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     // delete
     //        $aa = Monk::Where('position','=',3)->get();
     //        var_dump(count($aa));
     //        var_dump(count(Monk::Where('position','=',$id)->get()));
     if (count(Monk::Where('position', '=', $id)->get()) > 0) {
         Session::flash('message', 'Không thể xóa vì có Tăng Ni thuộc Position này!');
         return Redirect::to('positions');
     } else {
         $monk = Position::find($id);
         $monk->delete();
         Logfile::addData('Xóa', 'Ngiệp sư', $monk->id, $monk->name);
         Session::flash('message', 'positions da  bị xóa!');
         return Redirect::to('positions');
     }
 }