Пример #1
0
| kernel and includes session state, CSRF protection, and more.
|
*/
Route::group(['middleware' => ['web', 'fw-block-bl']], function () {
    /**
     * Landing Page
     */
    Route::get('/', ['as' => 'welcome', function () {
        $news = App\News::whereType(0)->latest()->first();
        $event = App\Event::latest()->first();
        $codewars = App\CodeWarQuestion::latest()->limit(3)->get();
        $questions = App\Question::wherePublic(1)->approved()->latest()->limit(3)->get();
        $aluminis = App\Alumini::where('speech', '!=', 'null')->get()->random(2);
        $users = App\User::whereBanned(0)->latest()->limit(3)->get();
        $picture = App\Photo::whereGallery(1)->get()->random();
        $technews = App\News::whereType(1)->latest()->first();
        $qotd = App\Quote::getQotd();
        $shouts = App\Shout::limit(15)->latest()->get();
        $shouts = $shouts->sortBy('created_at');
        $urls = ['http://numbersapi.com/random/', 'http://numbersapi.com/random/year/', 'http://numbersapi.com/random/date'];
        try {
            $didyouknow = file_get_contents($urls[array_rand($urls)]);
        } catch (Exception $e) {
            $didyouknow = "This website is hosted on a VPS with 1GB of RAM and is developed using PHP as backend, MySQL & Redis for database storage, and Sockets for real time events.";
        }
        $data = ['news' => $news, 'event' => $event, 'aluminis' => $aluminis, 'codewars' => $codewars, 'questions' => $questions, 'users' => $users, 'picture' => $picture, 'technews' => $technews, 'qotd' => $qotd, 'shouts' => $shouts, 'didyouknow' => $didyouknow];
        return view('welcome', $data);
    }]);
    /**
     * Coming Soon Page
     */
Пример #2
0
 public static function published($limit = 5, $type = 'news')
 {
     $n = new \App\News();
     return $n->where('type', $type)->where('published_at', '<', Carbon::now())->orderBy('published_at', 'DESC')->orderBy('order')->limit($limit)->get();
 }
Пример #3
0
<?php

$nd = Carbon\Carbon::today()->addMonth();
$incomingEvents = App\Event::where('private', 0)->where('active', 1)->where('date', '>=', DB::raw('NOW()'))->where('date', '<=', $nd)->orderBy('date', 'ASC')->get();
$lastNews = App\News::where('active', 1)->where('published_at', '<=', DB::raw('NOW()'))->orderBy('published_at', 'DESC')->limit(5)->get();
?>

<!DOCTYPE html>
<html>
<head>
	<title>DjMaker | @section('title') Accueil @show </title>
	<link rel="stylesheet" type="text/css" href="{{ url('vendor/css/bootstrap.css') }}" />
	{{-- <link rel="stylesheet/less" type="text/css" href="{{ url('vendor/css/style.less') }}" /> --}}
    <meta name="csrf-token" content="{{ csrf_token() }}" />
	<link rel="stylesheet" type="text/css" href="{{ url('vendor/css/less.css') }}">
	<link rel="stylesheet" type="text/css" href="{{ url('vendor/css/css.css') }}">
	<link rel="stylesheet" type="text/css" href="{{ url('vendor/css/hover.min.css') }}">
	<link rel="stylesheet" type="text/css" href="{{ url('vendor/js/jquery-ui/jquery-ui.min.css') }}">
	<link rel="stylesheet" type="text/css" href="{{ url('vendor/js/timepicker/stylesheets/wickedpicker.css') }}">
	<link href="{{ 	URL::asset('vendor/js/file-input/css/fileinput.min.css') }}" media="all" rel="stylesheet" type="text/css" />
	<script src="{{ URL::asset('vendor/js/less.js') }}"></script>
	<script src="{{ URL::asset('vendor/js/jquery.js') }}"></script>
	<script src="{{ URL::asset('vendor/js/bootstrap.min.js') }}"></script>
</head>
<body>

<header>
	<div class="banner" id="banner">
		<a href="{{ url('/') }}">
			<h1>DjMaker</h1>
		</a>
Пример #4
0
 /**
  * Create a news article
  *
  * @param  Request  $request
  * @return Response
  */
 public function createNews(Request $request)
 {
     $user = User::find(Auth::user()->id);
     if ($user->webadmin == 1) {
         $validator = Validator::make($request->all(), ['title' => 'required|string', 'type' => 'required|string', 'content' => 'required']);
         if ($validator->fails()) {
             return $validator->errors()->all();
         } else {
             $article = new \App\News();
             $article->author = Auth::user()->name;
             $article->date = time();
             $article->title = $request->input('title');
             $article->type = $request->input('type');
             $article->content = $request->input('content');
             $article->save();
             return response()->json(['success' => 'success'], 200);
         }
     } else {
         return response()->json(['error' => 'invalid_credentials'], 401);
     }
 }
Пример #5
0
<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
Route::get('/', function () {
    $news = App\News::orderBy('date', 'desc')->take(10)->get();
    return view('index', ['news' => $news]);
});
Route::resource('characters', 'CharacterController');
Route::resource('class', 'ClassController');
Route::controllers(['auth' => 'Auth\\AuthController', 'password' => 'Auth\\PasswordController']);
Пример #6
0
<?php

$router->bind('news', function ($slug) {
    return App\News::whereSlug($slug)->firstOrFail();
});
$router->bind('cat', function ($cat) {
    $kat_id = App\Kategori::where('nama_kategori', $cat)->firstOrFail()->id;
    return $kat_id;
});
Route::controllers(['auth' => 'Auth\\AuthController', 'password' => 'Auth\\PasswordController']);
get('/search', ['as' => 'search', 'uses' => 'HomeController@search']);
get('/admin', ['as' => 'admin', 'uses' => 'AdminController@index']);
get('/admin/login', ['as' => 'admin_login', 'uses' => 'AdminController@login']);
get('/admin/posts', ['as' => 'admin_posts', 'uses' => 'AdminController@posts']);
get('/admin/posts/create', ['as' => 'admin_create', 'uses' => 'AdminController@create']);
get('/admin/posts/{news}/edit', ['as' => 'admin_edit', 'uses' => 'AdminController@edit']);
get('/admin/posts/{news}/delete', ['as' => 'admin_delete', 'uses' => 'AdminController@delete']);
get('/admin/posts/{news}/destroy', ['as' => 'admin_destroy', 'uses' => 'AdminController@destroy']);
post('/admin/post', ['as' => 'admin_store', 'uses' => 'AdminController@store']);
patch('/{news}', ['as' => 'admin_update', 'uses' => 'AdminController@update']);
get('/search', ['as' => 'search', 'uses' => 'HomeController@search']);
get('home', ['as' => 'home', 'uses' => 'HomeController@index']);
get('/category/{cat}', 'HomeController@category');
get('/', ['as' => 'root', 'uses' => 'HomeController@index']);
get('/{news}', ['as' => 'news_path', 'uses' => 'HomeController@show']);
post('/comment', ['as' => 'storeComment', 'uses' => 'HomeController@storeComment']);
//$router->bind('songs', function($slug)
//{
//	return App\Song::where('slug' , $slug)->first();
//});
//$router->resource('songs','SongsController');
Пример #7
0
<?php

$news = App\News::published()->orderBy('published_at', 'desc')->limit(5)->get(['id', 'published_at', 'title', 'slug']);
?>

<div class="panel panel-default panel-news">
    <div class="panel-heading">
        <p align="center"><a title="Tout voir" href="{{ url('news')}}"><b>Dernières news</b></a></p>
          @if(Auth::check() && Auth::user()->level_id > 2)
         <a class="glyphicon glyphicon-plus" title="Ajouter une news" href="{{ url('admin/news/create') }}"></a>
          @endif
    </div>
        <ul class="list-group">
          @forelse( $news as $n)
          <li class="list-group-item news-item">
              <div class="news-infos"><p><span>{{ $n->published_at->format('j M Y') }}</span></p></div> 
              <!-- <span class="trait"></span> -->
              <div class="content"><p><a title="{{ $n->title }}" href="{{ url('news/view/'.$n->slug)}}">{{ strlen($n->title) > 40 ? substr($n->title, 0, 40).'...' :  $n->title }}</a></p></div>
              <span class="glyphicon glyphicon-menu-right"></span>
          </li>
          @empty
            <li class="list-group-item"><p>Pas de news pour le moment.</p></li>                  
          @endforelse
{{--      @if(Auth::check() && Auth::user()->level->level >= 1)
            <li class="list-group-item"></li>
          @endif --}}
        </ul>


    {{-- 2e VERSION --}}
    {{-- <table class="table">
Пример #8
0
    $stores = App\Gallery::where('tag', 'store_item')->get();
    return view('pages.stores', compact('slides', 'stores'))->render();
});
Route::get('/contacto', function () {
    return view('pages.contacto')->render();
});
Route::post('/contacto', function (Request $request) {
    $input = Input::all();
    Mail::send('emails.contacto', $input, function ($m) use($input) {
        $m->to('*****@*****.**')->subject('Consulta desde OC SPORT Website');
    });
    return redirect('/contacto/enviado')->with($input);
});
Route::get('/contacto/enviado', function () {
    return view('pages.contacto-thanks')->render();
});
Route::post('/subscribir', function (Request $request) {
    $datos = Input::all();
    $item = App\Subscription::create($datos);
    $item->save();
    return view('pages.subscription-thanks', $datos);
});
Route::get('/news', function () {
    $destacadas = App\News::where('pin', true)->take(2)->get();
    $news = App\News::paginate(6);
    return view('pages.news', ['destacadas' => $destacadas, 'news' => $news])->render();
});
Route::get('/news/{slug}', function ($slug) {
    $post = App\News::with('gallery')->where('slug', $slug)->first();
    return view('pages.news-single', ['post' => $post])->render();
});