public function show($promo)
 {
     $pageTitle = $promo->name;
     $package = $promo;
     \JavaScript::put(['promo' => $promo]);
     return view('public.deals.show', compact('pageTitle'));
 }
 public function jsVars()
 {
     # Bind a variable called 'foo'
     JavaScript::put(['foo' => 'bar']);
     # Bind a variable called 'bar'
     JavaScript::put(['email' => Auth::user()->email]);
     return View::make('demo_jsVars');
 }
Пример #3
0
 public function view()
 {
     $userRepo = App::make('Gruik\\Repo\\User\\UserInterface');
     $user = Sentry::getUser();
     $user->preferences = $userRepo->getPreferencesForUser($user->id);
     JavaScript::put(['user' => $user]);
     return View::make('auth.settings')->with('user', $user);
 }
Пример #4
0
 public function view($id)
 {
     $postRepo = App::make('Gruik\\Repo\\Post\\PostInterface');
     JavaScript::put(['disqus_username' => Config::get('gruik.disqus_username'), 'post' => $postRepo->byId($id)]);
     $post = $postRepo->byId($id);
     $diff = Carbon::now()->diffInMinutes(Carbon::parse($post->updated_at));
     $post->updated_at_human = Carbon::now()->subMinutes($diff)->diffForHumans();
     return View::make('front.view')->with('user', Sentry::getUser())->with('author', $post->user)->with('post', $post);
 }
Пример #5
0
 public function __construct()
 {
     /* *
      *-------------------------------------------------------
      *
      *-------------------------------------------------------
      */
     \JavaScript::put(['minDate' => '2016/03/04']);
 }
 /**
  * Register a Tungsten bootstrapped app for a given view
  *
  * @param  \View $main_view  Main view to nest into
  * @param  string $nest_as   Key to embed this view into the template
  * @param  string $template  Mustache template to render using
  * @param  string $data      Initial data to render with
  * @param  string $view      Name of the main View constructor registered in factory.js
  * @param  string $model     Name of the main Model constructor registered in factory.js
  */
 public static function register($main_view, $nest_as, $template, $data, $view, $model)
 {
     // Create unique ID for the element
     $id = 'App' . ++self::$counter;
     // Add bootstrap data to JS namespace
     \JavaScript::put([$id => ['view' => $view, 'model' => $model, 'template' => $template, 'data' => $data]]);
     // Nest a tungsten_wrapper view into the given key with the proper data
     $main_view->nest($nest_as, 'tungsten_wrapper', ['id' => $id, 'template_view' => $template, 'data' => $data]);
 }
 public function __construct()
 {
     /* *
      *-------------------------------------------------------
      * Datepicker Default Date (custom.js file)
      *-------------------------------------------------------
      */
     \JavaScript::put(['minDate' => '2016/03/04']);
 }
Пример #8
0
 /**
  * Constructor is fired two events Controller_Init_Pre and CalledController_Init_Pre
  */
 public function __construct()
 {
     $this->view = view();
     $this->controller = get_called_class();
     $args = ['subject' => $this];
     notify(__CLASS__ . '_Init_Post', $args);
     notify($this->controller . '_Init_Post', $args);
     \JavaScript::put(['baseurl' => url(''), 'locale' => app()->getLocale(), 'i18n' => trans('javascript')]);
 }
Пример #9
0
 public function shop($id)
 {
     $page_title = "Shop";
     $barangs = Barang::where('kategori_id', $id)->where('published', 1)->paginate(20);
     $categories = Category::with('barang')->get();
     $aroma = DB::table('parfum')->select('id', 'nama')->orderBy('nama', 'ASC')->get();
     $bId = [1, 2, 3, 4, 83, 16, 17, 18, 9, 10, 11];
     $unpublished = [36, 15, 16];
     JavaScript::put(['aromas' => $aroma]);
     return View::make('store.shop', compact('barangs', 'categories', 'page_title', 'id', 'aroma', 'bId', 'unpublished'));
 }
Пример #10
0
 /**
  * Composer for creating a new course
  *
  * @param View $view
  */
 public function compose(View $view)
 {
     $empty_link = new Link(['link' => "", 'name' => ""]);
     $empty_link->id = 0;
     \JavaScript::put(['links' => 0]);
     $view->with('empty_link', $empty_link);
     $view->with('categories', \Category::listCategories());
     $view->with('images', []);
     $view->with('videos', []);
     $view->with('ebooks', []);
     $view->with('links', []);
     $view->with('body', "");
 }
Пример #11
0
 /**
  * Composer for updating a course
  * @param View $view
  */
 public function compose(View $view)
 {
     $course = $view->getData()['course'];
     $empty_link = new Link(['link' => "", 'name' => ""]);
     $empty_link->id = 0;
     $links = \Link::getAllLinks($course);
     $length = count($links) > 0 ? $links[count($links) - 1]->id + 1 : 1;
     \JavaScript::put(['links' => $length]);
     $view->with('empty_link', $empty_link);
     $view->with('images', \Image::listImages($course));
     $view->with('videos', \Video::listVideos($course));
     $view->with('ebooks', \Ebook::listEbooks($course));
     $view->with('links', $links);
     $view->with('body', \Resource::getCourseBody($course));
 }
Пример #12
0
 public function explore()
 {
     $userRepo = App::make('Gruik\\Repo\\User\\UserInterface');
     $postRepo = App::make('Gruik\\Repo\\Post\\PostInterface');
     $tagRepo = App::make('Gruik\\Repo\\Tag\\TagInterface');
     $limit = Input::get('limit', 15);
     $posts = $postRepo->allPublicQuery()->with('tags')->with(['user' => function ($q) {
         $q->select('id', 'username');
     }])->orderBy('created_at', 'DESC')->paginate($limit);
     $posts->each(function ($post) {
         $diff = Carbon::now()->diffInMinutes(Carbon::parse($post->created_at));
         $post->created_at_human = Carbon::now()->subMinutes($diff)->diffForHumans();
     });
     JavaScript::put(['posts' => $posts->toArray()]);
     return View::make('front.explore')->with('posts', $posts)->with('user', Sentry::getUser());
 }
Пример #13
0
 /**
  * Composer for showing a course
  * @param View $view
  */
 public function compose(View $view)
 {
     $course = $view->getData()['course'];
     $view->with('course_categories', \Category::getCourseCategories($course));
     $view->with('images', \Image::listImagesWithCleanPath($course));
     $view->with('videos', \Video::listVideosWithCleanPath($course));
     $view->with('ebooks', \Ebook::listEbooksWithCleanPath($course));
     $view->with('links', \Link::listLinksWithNames($course));
     $view->with('created_at', \MyCarbon::format($course->created_at->diffForHumans()));
     $view->with('course_user', $course->user);
     $view->with('count_likes', \Course::countLikes($course));
     $view->with('count_dislikes', \Course::countDislikes($course));
     if (Auth::check()) {
         \JavaScript::put(['star_index' => \Course::getLikeRating($course, Auth::user())]);
     }
 }
Пример #14
0
 public function search()
 {
     $currentUser = Sentry::getUser();
     $userId = $currentUser ? $currentUser->id : null;
     $searchService = new SearchService();
     $term = trim(Input::get('q', ''));
     $type = Input::get('type', 'owner');
     $sortBy = Input::get('s', 'created_at,desc');
     if (!$term) {
         return View::make('front.search')->with('term', $term)->with('user', Sentry::getUser());
     }
     if (!$currentUser && $type == 'owner') {
         return Redirect::route('search', ['q' => Input::get('q'), 'type' => 'public']);
     }
     $countOwnerPosts = $searchService->searchPostsOwnerQuery($userId, $term)->count();
     $countPublicPosts = $searchService->searchPostsPublicQuery($userId, $term)->count();
     $countUsers = $searchService->searchUsersQuery($term)->count();
     switch ($type) {
         case 'public':
             $result = $searchService->searchPostsPublicQuery($userId, $term, $sortBy)->paginate(15);
             break;
         case 'users':
             $result = $searchService->searchUsersQuery($term, $sortBy)->leftJoin('posts', 'posts.user_id', '=', 'users.id')->addSelect(DB::raw('COUNT(posts.id) as public_posts'))->groupBy('users.id')->paginate(15);
             $result->getCollection()->map(function ($user) {
                 $user->avatar = Gravatar::src($user->email, 45);
                 $diff = Carbon::now()->diffInMinutes(Carbon::parse($user->created_at));
                 $user->created_at = Carbon::now()->subMinutes($diff)->diffForHumans();
                 unset($user->email);
             });
             break;
         case 'owner':
         default:
             $result = $searchService->searchPostsOwnerQuery($userId, $term, $sortBy)->paginate(15);
             break;
     }
     if ($type == 'public' || $type == 'owner') {
         $result->getCollection()->map(function ($post) {
             $diff = Carbon::now()->diffInMinutes(Carbon::parse($post->created_at));
             $post->created_at_human = Carbon::now()->subMinutes($diff)->diffForHumans();
         });
     }
     JavaScript::put(['result' => $result->toArray(), 'sortBy' => $sortBy]);
     $pagination = $result->appends(['q' => Input::get('q'), 'type' => Input::get('type'), 's' => Input::get('s'), 'o' => Input::get('o')])->links();
     return View::make('front.search')->with('term', $term)->with('user', Sentry::getUser())->with('countOwnerPosts', $countOwnerPosts)->with('countPublicPosts', $countPublicPosts)->with('countUsers', $countUsers)->with('pagination', $pagination)->with('result', $result);
 }
Пример #15
0
 public function profile($username)
 {
     $visited_user = User::where('username', $username)->first();
     if (!$visited_user) {
         return Redirect::to('/');
     }
     $userRepo = App::make('Gruik\\Repo\\User\\UserInterface');
     $postRepo = App::make('Gruik\\Repo\\Post\\PostInterface');
     $tagRepo = App::make('Gruik\\Repo\\Tag\\TagInterface');
     $limit = Input::get('limit', 10);
     $posts = $postRepo->byUserIdQuery($visited_user->id)->where('private', false)->with('tags')->orderBy('created_at', 'desc')->paginate($limit);
     $posts->each(function ($post) {
         $diff = Carbon::now()->diffInMinutes(Carbon::parse($post->created_at));
         $post->created_at_human = Carbon::now()->subMinutes($diff)->diffForHumans();
     });
     $diff = Carbon::now()->diffInMinutes(Carbon::parse($visited_user->last_login));
     $last_login = Carbon::now()->subMinutes($diff)->diffForHumans();
     JavaScript::put(['user' => $userRepo->toPublicArray($visited_user), 'posts' => $posts->toArray(), 'last_login' => $last_login, 'total_tags' => $tagRepo->publicByUserId($visited_user->id)->count(), 'total_days' => Carbon::now()->diffInDays(Carbon::parse($visited_user->created_at))]);
     return View::make('front.user_profile')->with('user', Sentry::getUser())->with('posts', $posts)->with('visited_user', $visited_user)->with('username', $username);
 }
Пример #16
0
Route::group(['prefix' => 'mantenedor'], function () {
    Route::get('pelicula', function () {
        return view('pelicula.lista');
    });
    Route::get('pelicula/crear', function () {
        JavaScript::put(['productoras' => \App\Models\Productora::all(['id', 'nombre']), 'actores' => \App\Models\Actor::all(['id', 'nombre'])]);
        return view('pelicula.crear');
    });
    Route::get('pelicula/{peliculaID}/editar', function ($peliculaID) {
        $pelicula = \App\Models\Pelicula::with('actores')->find($peliculaID);
        JavaScript::put(['pelicula' => $pelicula, 'productoras' => \App\Models\Productora::all(['id', 'nombre']), 'actores' => \App\Models\Actor::all(['id', 'nombre'])]);
        return view('pelicula.editar');
    });
    Route::get('pelicula/{peliculaID}/eliminar', function ($peliculaID) {
        $pelicula = \App\Models\Pelicula::with('actores')->find($peliculaID);
        JavaScript::put(['pelicula' => $pelicula, 'productoras' => \App\Models\Productora::all(['id', 'nombre']), 'actores' => \App\Models\Actor::all(['id', 'nombre'])]);
        return view('pelicula.eliminar');
    });
});
Route::get('img/{imgName}', 'Imagen\\ImagenController@show');
// Authentication routes...
Route::get('auth/login', 'Auth\\AuthController@getLogin');
Route::post('auth/login', ['as' => 'auth/login', 'uses' => 'Auth\\AuthController@postLogin']);
Route::get('auth/logout', ['as' => 'auth/logout', 'uses' => 'Auth\\AuthController@getLogout']);
// Registration routes...
Route::get('auth/register', 'Auth\\AuthController@getRegister');
Route::post('auth/register', ['as' => 'auth/register', 'uses' => 'Auth\\AuthController@postRegister']);
Route::group(['prefix' => 'api'], function () {
    Route::get('pelicula', 'Pelicula\\PeliculaController@index');
    Route::post('pelicula', 'Pelicula\\PeliculaController@store');
    Route::post('pelicula/{peliculaID}', 'Pelicula\\PeliculaController@update');
Пример #17
0
 public function index()
 {
     \JavaScript::put(['total' => ShoppingCart::total()]);
     return view('public.cart.index');
 }
Пример #18
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     \JavaScript::put(['ALGOLIA_API_ID' => env('ALGOLIA_API_ID'), 'ALGOLIA_API_KEY' => env('ALGOLIA_API_KEY'), 'ALOGOLIA_INDEX' => env('ALOGOLIA_INDEX')]);
     $snippets = Snippet::all()->sortByDesc('created_at');
     return view('snippet.index', compact('snippets'));
 }
 public function package($package)
 {
     $pageTitle = sprintf('%s - %s', $package->name, $package->subtitle);
     \JavaScript::put(['package' => $package, 'relatedPackages' => $this->package->related($package->id)]);
     return view('public.packages.package', compact('pageTitle', 'package'));
 }
Пример #20
0
 public function index()
 {
     $albums = $this->album->all();
     \JavaScript::put(['gallery' => ['albums' => $albums]]);
     return view('gallery::backend.index', compact('albums'));
 }
 public function show($package)
 {
     \JavaScript::put(['currentPackage' => $package, 'package_id' => $package->id]);
     return view('admin.packages.show', compact('package'));
 }
Пример #22
0
 public function home()
 {
     setDefaultCurrency();
     \JavaScript::put(['packages' => $this->package->take(9)]);
     return view('public.home');
 }
     * the $siteOptions variable.
     *
     */
    $options = Option::get(['name', 'value']);
    foreach ($options as $option) {
        $o[$option->name] = $option->value;
    }
    View::share('siteOptions', $o);
    /**
     * Attach a PHP array to the window to allow JavaScript to use.
     * The "URL" provider is used rather than the Laravel helper paths
     * to ensure the paths are consistent across Windows and Unix platforms.
     *
     * @see https://github.com/laracasts/PHP-Vars-To-Js-Transformer
     */
    JavaScript::put(['app_path' => URL::to('/') . '/', 'roles' => Role::get(['id', 'friendly_name']), 'services' => Service::get(['id', 'friendly_name'])]);
});
App::after(function ($request, $response) {
    //
});
/*
|--------------------------------------------------------------------------
| Access Filter
|--------------------------------------------------------------------------
|
*/
Route::filter('access', function () {
    if (!Access::validate(Request::segment(1))) {
        return App::abort(403, 'You do not have the required access for this page');
    }
});
 public function getChartReports()
 {
     \JavaScript::put(['foo' => 'bar', 'user' => \App\User::first(), 'age' => 29]);
     return view('statistics.charts');
 }
 public function index()
 {
     JavaScript::put(['bannerImages' => Object::where('type', MissionControlType::Image)->get(), 'dataViews' => DataView::all()->toArray()]);
     return view('missionControl.dataviews.index');
 }
Пример #26
0
 public function index()
 {
     $recentseven = DB::table('photo')->orderBy('updated_at', 'desc')->take(7)->get();
     JavaScript::put(['foo' => 'bar', 'user' => 'me', 'age' => 29]);
     return View::make('index')->with('recentseven', $recentseven);
 }
Пример #27
0
 public static function populateJsGlobalTtvTypeClearTextTrue()
 {
     $result = Schema::hasTable('testing_selenium_variables');
     if ($result) {
         $result = \DB::table('testing_selenium_variables')->select('ttvTypeClearText')->where('id', 1)->first();
         if ($result) {
             // if the test failed, we would have a testing_selenium_variables record; ttvTypeClearText needs to = 1.
             if ($result->ttvTypeClearText === 1) {
                 // jeffery way's package for moving php variables to the .js space.
                 // see https://github.com/laracasts/PHP-Vars-To-Js-Transformer.
                 // also see javascript.php in the config dir for view and .js namespace used.
                 \JavaScript::put(['ttvTypeClearText' => true]);
                 return true;
             }
         }
     }
     return false;
 }
Пример #28
0
 public function home()
 {
     \JavaScript::put(['signedIn' => Auth::check() ? true : false, 'user' => ['info' => Auth::check() ? Auth::user() : [], 'likes' => Auth::check() ? Auth::user()->likes : []]]);
     return view('public.home');
 }