本文整理汇总了PHP中Request::segment方法的典型用法代码示例。如果您正苦于以下问题:PHP Request::segment方法的具体用法?PHP Request::segment怎么用?PHP Request::segment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Request
的用法示例。
在下文中一共展示了Request::segment方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: NhapDiem
public function NhapDiem()
{
$macb = \Auth::user()->taikhoan;
//Lấy năm học và học kỳ hiện tại
$nam = DB::table('nien_khoa')->distinct()->orderBy('nam', 'desc')->value('nam');
$hk = DB::table('nien_khoa')->distinct()->orderBy('hocky', 'desc')->where('nam', $nam)->value('hocky');
$mank = DB::table('nien_khoa as nk')->join('nhom_hocphan as hp', 'nk.mank', '=', 'hp.mank')->where('nk.nam', $nam)->where('nk.hocky', $hk)->value('nk.mank');
//Lấy ds nhóm học phần mà GV đang phụ trách giảng dạy
$dshp = DB::table('nhom_hocphan as hp')->select('hp.manhomhp', 'hp.tennhomhp')->join('nien_khoa as nk', 'hp.mank', '=', 'nk.mank')->where('nk.mank', $mank)->where('hp.macb', $macb)->get();
$tieuchi = DB::table('tieu_chi_danh_gia as tc')->select('tc.matc', 'tc.heso', 'tc.noidungtc')->join('quy_dinh as qd', 'tc.matc', '=', 'qd.matc')->where('qd.macb', $macb)->where('qd.mank', $mank)->get();
//Lấy mã hp trên url khi chọn liệt kê
$mahp = \Request::segment(3);
if ($mahp == null || $mahp == 0) {
$dsNhomth = DB::table('chia_nhom as chn')->distinct()->select('chn.manhomthuchien')->join('nhom_hocphan as hp', 'chn.manhomhp', '=', 'hp.manhomhp')->where('hp.macb', $macb)->lists('chn.manhomthuchien');
} else {
if ($mahp != null || $mahp != 0) {
$dsNhomth = DB::table('chia_nhom as chn')->distinct()->select('chn.manhomthuchien')->join('nhom_hocphan as hp', 'chn.manhomhp', '=', 'hp.manhomhp')->where('chn.manhomhp', $mahp)->where('hp.macb', $macb)->lists('chn.manhomthuchien');
}
}
$dssv = DB::table('sinh_vien as sv')->orderBy('chn.manhomthuchien', 'asc')->join('chia_nhom as chn', 'sv.mssv', '=', 'chn.mssv')->whereIn('chn.manhomthuchien', $dsNhomth)->where('chn.manhomthuchien', '<>', "")->get();
$tendt = DB::table('chia_nhom as chn')->distinct()->select('dt.tendt', 'chn.manhomthuchien')->join('ra_de_tai as radt', 'chn.manhomthuchien', '=', 'radt.manhomthuchien')->join('de_tai as dt', 'radt.madt', '=', 'dt.madt')->whereIn('chn.manhomthuchien', $dsNhomth)->get();
//Lấy 1 mảng mssv của các nhóm thực hiện
$masv = DB::table('sinh_vien as sv')->select('chn.mssv')->join('chia_nhom as chn', 'sv.mssv', '=', 'chn.mssv')->whereIn('chn.manhomthuchien', $dsNhomth)->lists('chn.mssv');
//Lấy điểm của mỗi sv trong mảng mssv trên
$dsdiem = DB::table('chitiet_diem as diem')->select('chn.mssv', 'diem.matc', 'diem.diem')->orderBy('diem.matc', 'asc')->join('chia_nhom as chn', 'chn.mssv', '=', 'diem.mssv')->whereIn('chn.mssv', $masv)->get();
$tongdiem = DB::table('chitiet_diem as diem')->distinct()->select('chn.mssv', DB::raw('sum(diem.diem) as tongdiem'))->rightjoin('chia_nhom as chn', '.diem.mssv', '=', 'chn.mssv')->orderBy('chn.mssv', 'asc')->whereIn('diem.mssv', $masv)->groupBy('chn.mssv')->get();
$nhanxet = DB::table('chia_nhom')->select('mssv', 'nhanxet')->orderBy('mssv', 'asc')->whereIn('mssv', $masv)->get();
return view('giangvien.nhap-diem')->with('tieuchi', $tieuchi)->with('dssv', $dssv)->with('dsdiem', $dsdiem)->with('dshp', $dshp)->with('nam', $nam)->with('hk', $hk)->with('tendt', $tendt)->with('tongdiem', $tongdiem)->with('nhanxet', $nhanxet)->with('mahp', $mahp)->with('macb', $macb);
}
示例2: getView
/**
* Simply display a view by the slug
* @param string $slug
* @return View
*/
public function getView($slug = null)
{
if (!$slug) {
$slug = \Request::segment(1);
}
return $this->view('theme::' . $slug, array('slug' => $slug));
}
示例3: __call
public function __call($name, $args)
{
$name = Request::segment(1);
$class = "Endpoints\\{$name}";
$endpoint = new $class();
return $endpoint->call(Request::segment($name));
}
示例4: filter
public function filter()
{
if (!isset($this->user) || !$this->user || $this->user == parent::ANONYMOUS_USER) {
return Response::json(['error' => true, 'error_description' => 'Permission denied'], 401);
}
if (!$this->user->can('item_delete')) {
return Response::json(['error' => true, 'error_description' => 'Permission denied'], 401);
}
//$company_id = Request::segment(3);
$company_id = Input::get('company_id');
$id = Request::segment(3);
$company = Company::with('items')->find($company_id);
if (!$company) {
return Response::json(['error' => true, 'error_description' => 'Company not found'], 400);
}
$find = 0;
foreach ($company->items as $item) {
if ($item->id == $id) {
$find = 1;
}
}
if (!$find) {
return Response::json(['error' => true, 'error_description' => 'Permission denied'], 401);
}
}
示例5: rules
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
if (Request::segment(6) == 'create') {
$this->rules['photo'] .= '|required';
}
return $this->rules;
}
示例6: rules
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
if (Request::segment(3) == 'create') {
$this->rules['thumbnail'] .= '|required';
}
return $this->rules;
}
示例7: post
public function post($language, $id)
{
// Définition de la langue :
if (!$this->setupLanguage($language)) {
App::abort(404);
}
// Récupération de l'id de la news à afficher :
$id = explode("-", $id);
if (!isset($id[0]) or empty($id[0])) {
App::abort(404);
}
// Variables :
// News (dans un try catch pour gérer les erreurs) :
try {
$languages = Language::where('_url', '=', $language)->firstOrFail();
$page = Pages::where('_language', $languages->_id)->where("_name", "=", "news")->get()->first();
$new = News::whereRaw('_langue = ' . $languages->_id . ' and _id=' . $id[0])->firstOrFail();
} catch (Exception $e) {
App::abort(404);
}
$data = array("situation" => array("title" => $page->_title, "description" => $page->_description), "position" => array($page->_title => URL::to(Request::segment(1) . '/news/'), $new->_title => ""));
// Renvoi de la vue avec la news :
$page = $this->layout->content = View::make('pages.news.post', array("data" => $data, "page" => $page, "new" => $new));
return Response::make($page);
}
示例8: commonName
public static function commonName($name = NULL)
{
if ($name == NULL) {
$name = Request::segment(2);
}
if ($name == '') {
return 'Product';
}
if ($name == 'manager') {
return 'Admin';
}
if ($name == 'price') {
return 'Price';
}
if ($name == 'category') {
return 'Category';
}
if ($name == 'product') {
return 'Product';
}
if ($name == 'user') {
return 'User';
}
if ($name == 'feedback') {
return 'Feedback';
}
}
示例9: ChiaNhomNL
public function ChiaNhomNL()
{
$macb = \Auth::user()->taikhoan;
//Nếu selectbox có giá trị manhp thì lấy manhp
//Lấy học kỳ niên khóa sau cùng của 1 cán bộ
$namcb = DB::table('nien_khoa as nk')->orderBy('nam', 'desc')->join('nhom_hocphan as hp', 'nk.mank', '=', 'hp.mank')->where('hp.macb', $macb)->value('nk.nam');
$hkcb = DB::table('nien_khoa as nk')->orderBy('nam', 'desc')->join('nhom_hocphan as hp', 'nk.mank', '=', 'hp.mank')->where('hp.macb', $macb)->value('nk.hocky');
//Lấy giá trị một đoạn của chuỗi url
$var = \Request::segment(3);
if ($var == null) {
//Lấy 1 mã nhóm HP nhỏ nhất của năm hiện tại mà cán bộ phụ trách
$mahp = DB::table('nhom_hocphan as hp')->join('nien_khoa as nk', 'hp.mank', '=', 'nk.mank')->where('hp.macb', $macb)->where('nk.nam', $namcb)->where('nk.hocky', $hkcb)->orderBy('hp.manhomhp', 'asc')->value('hp.manhomhp');
} else {
$mahp = $var;
}
$dsmahp = DB::table('nhom_hocphan as hp')->select('hp.manhomhp', 'hp.tennhomhp')->join('giang_vien as gv', 'hp.macb', '=', 'gv.macb')->where('hp.macb', $macb)->get();
//Lấy những sinh viên chưa có nhóm thực hiện niên luận
$dstensv = DB::table('chia_nhom as chn')->distinct()->select('chn.mssv', 'sv.hoten', 'chn.nhomtruong')->join('sinh_vien as sv', 'chn.mssv', '=', 'sv.mssv')->where('chn.manhomhp', '=', $mahp)->where('chn.manhomthuchien', '=', "")->get();
//Lấy ds nhóm của học kỳ niên khóa hiện tại mà cán bộ đang dạy
$dsNhom = DB::table('sinh_vien as sv')->distinct()->select('chn.manhomthuchien', 'sv.mssv', 'sv.hoten', 'chn.nhomtruong')->orderby('chn.manhomthuchien', 'asc')->join('chia_nhom as chn', 'sv.mssv', '=', 'chn.mssv')->join('nhom_hocphan as hp', 'chn.manhomhp', '=', 'hp.manhomhp')->join('nien_khoa as nk', 'hp.mank', '=', 'nk.mank')->where('chn.manhomthuchien', '<>', "")->where('hp.manhomhp', $mahp)->where('nk.nam', $namcb)->where('nk.hocky', $hkcb)->get();
//Lấy tên đề tài của các nhóm trong hoc kỳ niên khóa của cán bộ đang dạy
$detainhom = DB::table('de_tai as dt')->distinct()->orderBy('chn.manhomthuchien', 'asc')->select('dt.tendt', 'dt.taptindinhkem', 'chn.manhomthuchien', 'hp.tennhomhp')->join('ra_de_tai as radt', 'dt.madt', '=', 'radt.madt')->join('chia_nhom as chn', 'radt.manhomthuchien', '=', 'chn.manhomthuchien')->join('nhom_hocphan as hp', 'chn.manhomhp', '=', 'hp.manhomhp')->join('nien_khoa as nk', 'hp.mank', '=', 'nk.mank')->where('dt.macb', $macb)->where('nk.nam', $namcb)->where('nk.hocky', $hkcb)->where('chn.manhomthuchien', '<>', "")->get();
//Lấy mã đề tài trong bảng ra_de_tai
$madt = DB::table('ra_de_tai')->select('madt')->lists('madt');
//Lấy madt, tendt của 1 cán bộ mà chưa có nhóm nào thực hiện, ở bất cứ năm học, học kỳ nào
$dsdetai = DB::table('de_tai')->distinct()->select('madt', 'tendt', 'taptindinhkem')->where('macb', $macb)->whereNotIn('madt', $madt)->get();
$manth = $this->manth_tutang();
return view('giangvien.chia-nhom-nien-luan')->with('dstensv', $dstensv)->with('dsmahp', $dsmahp)->with('dsdetai', $dsdetai)->with('dsNhom', $dsNhom)->with('detainhom', $detainhom)->with('namcb', $namcb)->with('hkcb', $hkcb)->with('macb', $macb)->with('manth', $manth)->with('mahp', $mahp);
}
示例10: configureLocale
/**
* Detect and set application localization environment (language).
* NOTE: Don't foreget to ADD/SET/UPDATE the locales array in app/config/app.php!
*
*/
private function configureLocale()
{
$mLocale = Config::get('app.locale');
if (!Session::has('locale')) {
$mFromCookie = Cookie::get('locale', null);
if ($mFromCookie != null && in_array($mFromCookie, Config::get('app.locales'))) {
$mLocale = $mFromCookie;
} else {
$mFromURI = Request::segment(1);
if ($mFromURI != null && in_array($mFromURI, Config::get('app.locales'))) {
$mLocale = $mFromURI;
} else {
$mFromBrowser = substr(Request::server('http_accept_language'), 0, 2);
if ($mFromBrowser != null && in_array($mFromBrowser, Config::get('app.locales'))) {
$mLocale = $mFromBrowser;
}
}
}
Session::put('locale', $mLocale);
Cookie::forever('locale', $mLocale);
} else {
$mLocale = Session::get('locale');
}
App::setLocale($mLocale);
}
示例11: __construct
public function __construct()
{
$this->userdata = $this->checkUserdata();
// apply authorization filter
$this->beforeFilter(function () {
if (!$this->userdata && Request::segment(1) !== 'login') {
return Redirect::to('/login');
}
});
// templates for app errors
App::missing(function ($exception) {
return Response::view('errors.404_cms', array(), 404);
});
App::error(function (Exception $exception, $code) {
Log::error($exception);
if ($code == 403) {
return Response::view('/errors/error_403', array(), 403);
}
});
// shared assets
Orchestra\Asset::add("bootstrap-css", "assets/css/bootstrap.min.css");
Orchestra\Asset::add("bootstrap-theme", "assets/css/bootstrap-theme.min.css");
Orchestra\Asset::add("font-awesome", "assets/css/font-awesome.min.css");
Orchestra\Asset::add("cms-css", "assets/css/cms.css");
Orchestra\Asset::add("jquery", "assets/js/jquery.js");
Orchestra\Asset::add("bootstrap-js", "assets/js/bootstrap.min.js");
Orchestra\Asset::add("handlers-js", "assets/js/handlers.js");
// shared views
View::share("active_menu_id", 1);
View::share("userdata", $this->userdata);
// configuration
Config::set("view.pagination", "common/pagination");
}
示例12: breadcrumbs
/**
* Returns breadcrumbs made up by URI segments
*
* @return string
*/
public static function breadcrumbs()
{
$breadcrumbs = [];
$crumbs = Request::segments();
if (count($crumbs) < 2) {
return;
}
$url = "";
end($crumbs);
$last_key = key($crumbs);
foreach ($crumbs as $key => $crumb) {
$url .= '/' . $crumb;
$crumb = ucwords($crumb);
if ($key != $last_key) {
$crumb = '<span typeof="v:Breadcrumb">' . link_to($url, $crumb, ['rel' => 'v:url', 'property' => 'v:title']) . '</span>';
} else {
if (Request::segment(1) === 'snippets') {
$crumb = "";
} else {
$crumb = '<span class="current">' . $crumb . '</span>';
}
}
array_push($breadcrumbs, $crumb);
}
$return = '<div class="clearfix">';
$return .= '<div class="breadcrumbs" xmlns:v="http://rdf.data-vocabulary.org/#">';
$return .= '<div class="container">';
$return .= implode('<i class="fa fa-chevron-right"></i>', $breadcrumbs);
$return .= '</div>';
$return .= '</div>';
$return .= '</div>';
return $return;
}
示例13: show_item
public function show_item($slug)
{
$data['title'] = 'Fréttir';
$s1 = \Request::segment(1);
$type = 'news';
switch ($s1) {
case 'frettir':
$type = 'news';
break;
case 'namskeid':
$type = 'seminar';
break;
case 'greinar':
$type = 'article';
break;
case 'hugleidingar':
$type = 'thought';
break;
default:
break;
}
$_f = \App\Page::where('slug', 'frettir')->first();
$crumbs[] = ['id' => $_f->id, 'title' => $_f->title, 'path' => $_f->path];
$_p = \App\News::where('slug', $slug)->first();
$crumbs[] = ['id' => $_p->id, 'title' => $_p->title, 'path' => 'frettir/' . $_p->slug];
$data['page'] = $_p;
$data['banner'] = $data['page']->banner;
$data['crumbs'] = $crumbs;
return view('frontend.page')->with($data);
}
示例14: getIndex
/**
* Display a listing of the resource.
*
* @return Response
*/
public function getIndex()
{
if (Request::segment(2) == 'search') {
$input = Session::get('search') && !Input::get('search_category') ? Session::get('search') : Input::only(array('search_category', 'search_keyword'));
switch ($input['search_category']) {
case '0':
return Redirect::to('gateway');
break;
case 'owner':
$gateways = Gateway::whereHas('user', function ($q) {
$q->where('username', 'LIKE', '%' . Input::get('search_keyword') . '%');
})->get();
break;
default:
if (Auth::user()->status == 2) {
$gateways = Gateway::where($input['search_category'], 'LIKE', '%' . $input['search_keyword'] . '%')->get();
} else {
$gateways = Gateway::where('user_id', Auth::user()->id)->where($input['search_category'], 'LIKE', '%' . $input['search_keyword'] . '%')->get();
}
break;
}
Session::set('search', $input);
} else {
Session::remove('search');
$input = array('search_category' => '', 'search_keyword' => '');
$gateways = Auth::user()->status == 2 ? Gateway::all() : Gateway::where('user_id', Auth::user()->id)->get();
}
return View::make('gateway.index')->with('gateways', $gateways)->with('selected', $input);
}
示例15: index
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
//
$type = ucfirst(\Request::segment(2));
$contents = Content::where('type', $type)->get();
return view('admin.content.index')->with(['contents' => $contents]);
}