コード例 #1
0
ファイル: FileController.php プロジェクト: schel4ok/steklo
 public function pesok()
 {
     $category = Category::where('sef', '=', 'catalogs')->first();
     $path = explode("?", substr($_SERVER['REQUEST_URI'], 1));
     $link = Link::where('url', $path[0])->first();
     // удалить первый слеш из URI и вернуть строку до первого вхождения знака ?
     // иначе на второй и следующей странице пагинации переменная $link будет содержать всякий хлам
     // типа ?page=4 и естесственно в БД такой ссылки не найдется
     $img = File::allFiles(public_path() . '/img/risunki/pesok');
     // pagination нашел тута  http://psampaz.github.io/custom-data-pagination-with-laravel-5/
     //Get current page form url e.g. &page=6
     $currentPage = LengthAwarePaginator::resolveCurrentPage();
     if (is_null($currentPage)) {
         $currentPage = 1;
     }
     //Create a new Laravel collection from the array data
     $collection = new Collection($img);
     //Define how many items we want to be visible in each page
     $perPage = 20;
     //Slice the collection to get the items to display in current page
     $currentPageImgResults = $collection->slice(($currentPage - 1) * $perPage, $perPage)->all();
     //Create our paginator and pass it to the view
     $paginatedImgResults = new LengthAwarePaginator($currentPageImgResults, count($collection), $perPage);
     $paginatedImgResults->setPath('peskostrujnie-risunki');
     return view('links.pesok')->withCategory($category)->withLink($link)->withImg($paginatedImgResults)->withPath($path);
 }
コード例 #2
0
ファイル: FolioController.php プロジェクト: thepopix/palaweb
 /**
  * Display a listing of the resource.
  *
  * @param $id
  * @return Response
  */
 public function detail($id)
 {
     $sPage = 'detail';
     $folio = Folio::FindOrFail($id);
     $link = Link::where('id_folio', $id)->get();
     $ids = Folio::count();
     return view('pages.detail', compact('sPage', 'folio', 'link', 'ids'));
 }
コード例 #3
0
ファイル: LinkController.php プロジェクト: jay4497/j4cms
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function getIndex()
 {
     $links = Link::sort()->get();
     if (\Request::has('key')) {
         $key = \Request::input('key');
         $links = Link::where('title', 'like', '%' . $key . '%')->sort()->get();
     }
     return view('admin.link.index', compact('links'));
 }
コード例 #4
0
ファイル: LinkController.php プロジェクト: rit-sse/api
 /**
  * Resolve a given go link into a redirect response.
  *
  * @Get("/go/{go_link}")
  * @return response
  */
 public function resolveLink($goLink)
 {
     $link = Link::where('go_link', $goLink)->first();
     if (is_null($link)) {
         return response()->view('missing_link', ['link' => $goLink], Response::HTTP_NOT_FOUND);
     } else {
         return redirect($link->expanded_link);
     }
 }
コード例 #5
0
 /**
  * Show the form for creating a new resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function create($lid)
 {
     $directCount = Link::where('sp_link_id', $lid)->count();
     $ten = new Ten();
     $ten->link_id = $lid;
     $ten->min_direct = $directCount;
     $ten->save();
     $cardline = new Cardline();
     $cardline->link_id = $lid;
     $ten->cardpoints()->save($cardline);
 }
コード例 #6
0
ファイル: CampainController.php プロジェクト: patualeja/TESIS
 public function destroy($id)
 {
     $campain = Campain::find($id);
     $links = Link::where('campain_id', '=', $id)->get();
     if (count($links) > 0) {
         foreach ($links as $link) {
             $link->delete();
         }
     }
     $campain->delete();
     return redirect('campain/');
 }
コード例 #7
0
 public function apiRegister(Request $request)
 {
     $validator = $this->registrar->validator($request->all());
     if ($validator->fails()) {
         $this->throwValidationException($request, $validator);
     }
     $this->auth->login($this->registrar->create($request->all()));
     $api_token = Str::random(60);
     User::where('id', $this->auth->user()->id)->update(['api_token' => $api_token]);
     $links = Link::where('user_id', $this->auth->user()->id)->with('user')->orderBy('created_at', 'desc')->get();
     return response()->json(['status' => 'success', 'user' => $this->auth->user(), 'links' => $links, 'api_token' => $api_token]);
 }
コード例 #8
0
 /**
  * 
  * @return type
  */
 public function getUrls()
 {
     $keyword = Request::input('keyword');
     if ($keyword == '') {
         return Response::json(array('success' => false, 'error' => 'Please enter a keyword'), 400);
     }
     $keyword = Keyword::where('value', '=', $keyword)->first();
     if ($keyword == '') {
         return Response::json(array('success' => false, 'error' => 'No urls found for the keyword'), 400);
     }
     $urls = Link::where('keyword_id', '=', $keyword->id)->paginate(10);
     if (Request::ajax()) {
         return Response::json(View::make('partials.url-list', array('urls' => $urls))->render());
     }
 }
コード例 #9
0
 public function index()
 {
     $churches = Link::where('type_id', 1)->get();
     $weeklyAnnouncements = Link::where('type_id', 2)->get();
     $blendingCenter = Link::where('type_id', 3)->get();
     $addressBooks = Link::where('type_id', 4)->get();
     $gospelRoom = Link::where('type_id', 5)->get();
     $lsm = Link::where('type_id', 6)->get();
     $fttCenter = Link::where('type_id', 7)->get();
     $lifeEducation = Link::where('type_id', 8)->get();
     $mttCenter = Link::where('type_id', 9)->get();
     $truth = Link::where('type_id', 10)->get();
     $emanna = Link::where('type_id', 11)->get();
     $churchHistory = Link::where('type_id', 12)->get();
     $japaneseSites = Link::where('type_id', 13)->get();
     $englishSites = Link::where('type_id', 14)->get();
     // $entries = FileEntry::latest()->take(10)->get();
     return view('welcome.index', compact('churches', 'weeklyAnnouncements', 'blendingCenter', 'addressBooks', 'gospelRoom', 'lsm', 'fttCenter', 'lifeEducation', 'mttCenter', 'truth', 'emanna', 'churchHistory', 'japaneseSites', 'englishSites'));
     // return $blendingCenter;
 }
コード例 #10
0
 public function index(Request $request)
 {
     $serial = $request->get('serial');
     $serial_id = strtolower($serial['serial_id']);
     $count_rand = 2;
     $rand = [];
     $result = [];
     $all = Link::where(['serial_id' => $serial_id]);
     $just = $all->where(['serial_id' => $serial_id])->get()->toArray();
     if (count($just)) {
         $count_rand = $count_rand <= count($just) ? $count_rand : count($just);
         $rand = $count_rand ? array_rand($just, $count_rand) : [];
         // array_rand может возвращать только число (не в масссиве)
         if (is_array($rand) && count($rand)) {
             foreach ($rand as $key => $value) {
                 $result[] = $just[$value];
             }
         } elseif (is_integer($rand)) {
             $result[] = $just[$rand];
         }
     }
     return response()->json($result);
 }
コード例 #11
0
ファイル: LoginController.php プロジェクト: patualeja/TESIS
 public function destroy($id)
 {
     $user = User::find($id);
     $companies = Company::where('user_id', '=', $id)->get();
     if (count($companies) > 0) {
         foreach ($companies as $company) {
             $campains = Campain::where('company_id', '=', $company->id)->get();
             if (count($campains) > 0) {
                 foreach ($campains as $campain) {
                     $links = Link::where('campain_id', '=', $campain->id)->get();
                     if (count($links) > 0) {
                         foreach ($links as $link) {
                             $link->delete();
                         }
                     }
                     $campain->delete();
                 }
             }
         }
         $company->delete();
     }
     $user->delete();
     return redirect('login/');
 }
コード例 #12
0
 private function storeLink(Request $request, $serial_id)
 {
     $link = strtolower($request->get('lastlink'));
     $title = !empty($request->get('titlelink')) ? strtolower($request->get('titlelink')) : null;
     $season = strtolower($request->get('season'));
     $serie = strtolower($request->get('serie'));
     $user_id = $request->user()->id;
     if (!empty($link) && !empty($serial_id)) {
         $Link = Link::where(['serial_id' => $serial_id, 'url' => $link])->get();
         // Если такой ссылки нет в базе даных
         if (!$Link->count()) {
             $NewLink = new Link();
             $NewLink->user_id = $user_id;
             $NewLink->serial_id = $serial_id;
             $NewLink->url = $link;
             $NewLink->season = $season;
             $NewLink->serie = $serie;
             $NewLink->title = $title;
             $NewLink->save();
         }
     } else {
         return response(['message' => 'Не обнаружена ссылка и/или ид сериала'], 422)->header('Content-Type', 'application/json');
     }
 }
コード例 #13
0
 public function links($course_id = 1)
 {
     $link = Link::where('course_id', $course_id)->get();
     $all_course = Course::all();
     $this->data['course_id'] = $course_id;
     $this->data['all_course'] = $all_course;
     $this->data['links'] = $link;
     $this->data['loop'] = count($link);
     return view('student.links', $this->data);
 }
コード例 #14
0
 public function get_all_links()
 {
     $links = Link::where('user_id', Auth::user()->id)->with('user')->orderBy('created_at', 'desc')->get();
     return $links;
 }
コード例 #15
0
ファイル: AuthController.php プロジェクト: jiujiubaba/laravel
 public function register()
 {
     $code = Request::input('code');
     $link = Link::where('code')->first();
     $data['code'] = $code;
     return view('auth.register', $data);
     return 'register';
 }
コード例 #16
0
ファイル: LinksRepository.php プロジェクト: mlanin/go
 /**
  * Scope to search link by it's Uri
  *
  * @param  string $uri
  * @return Link
  */
 public function link($uri)
 {
     return Link::where('url', $uri)->firstOrFail();
 }
コード例 #17
0
ファイル: LinkController.php プロジェクト: ivmelo/linksaver
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     // Get all links ordered by creation date descending and paginate.
     $links = Link::where('user_id', '=', Auth::user()->id)->orderBy('created_at', 'desc')->paginate(15);
     return view('links.index', compact('links'));
 }
コード例 #18
0
 public function forUser(User $user)
 {
     return Link::where('user_id', $user->id)->orderBy('created_at', 'asc')->get();
 }
コード例 #19
0
 /**
  * Show the application dashboard to the user.
  *
  * @return Response
  */
 public function index()
 {
     $links = Link::where('user_id', Auth::user()->id)->get();
     return view('link.index', compact('links'));
 }
コード例 #20
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $link = Link::where('link_name', $id)->where('user_id', Auth::user()->id)->first();
     $link->delete();
     return Redirect::to('/gtl');
 }
コード例 #21
0
ファイル: LinkController.php プロジェクト: jiujiubaba/laravel
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $user = Auth::user();
     $link = Link::where('user_id', $user->id)->where('id', $id)->first();
     if (!$link) {
         return failure('无效操作');
     }
     $link->delete();
     return success('删除成功');
 }