blade

Laravel index route issue when using for a subsection in another fw (external public dir)

点点圈 提交于 2019-12-11 16:56:06
问题 I'm using a Laravel app with an external public directory, e.g. root/Laravel , and root/html/public . I need this app to load from a require on a php file ( root/html/this-section.php ) that already has another framework loading it, hence that other fw has its own head, and body tag. This app will load between the header and footer of that file. When I set up the routes, i notice that both of the following routes work, but i get different results. Route::get('/', 'HomeController@index');

Laravel 3 blade template is not working

别等时光非礼了梦想. 提交于 2019-12-11 15:13:45
问题 I'm learning Laravel 3, but Blade template is not working. My code seems correct, but all it displays is @layout('master') . Pages source also contains this text only. application\views\home\index.blade.php contents: @layout('master') @section('main') {{ $greeting }} @endsection application\views\master.blade.php contents: <!doctype html> <html> <head> <meta charset="utf-8"> <title>Hello world!</title> </head> <body> <div id="container"> @yield('main') </div> </body> </html> and in routes.php

How do I use includes in a laravel blade macro?

若如初见. 提交于 2019-12-11 14:48:59
问题 I am designing a back end for a site in Laravel 4. It will have a number of data entry forms, some of which will be broken up into tabbed pages. For an individual view it looks like this: <ul> <li id='menu0' class='menu active'>Main</li> <li id='menu1' class='menu'>Secondary</li> <li id='menu2' class='menu'>Advanced</li> </ul> <div id='tab0' class='tab active'> @include('_mainfields') </div> <div id='tab1' class='tab'> @include('_secondfields') </div> <div id='tab2' class='tab'> @include('

Laravel 5.1 - Nested Loop - Blade Templating

喜你入骨 提交于 2019-12-11 10:43:53
问题 I have this on View : .. ... <div class="section group"> @foreach ($product as $item) <div class="grid_1_of_4 images_1_of_4"> <h4><a href="#">{!! $item->name !!}</a></h4> <div class="price-details"> <div class="price-number"> <p><span class="price">$ {!! $item->price !!} </span></p> </div> <div class="add-cart"> <h4><a href="#">More Info</a></h4> </div> <div class="clear"></div> </div> </div> @endforeach </div> ... .. And this on Controller : .. ... public function index(){ $product = product

PHP - Use database in MVC view layer (Laravel Blade)

自古美人都是妖i 提交于 2019-12-11 08:58:27
问题 Is it generally a good idea to interact with database in view layer in MVC frameworks? I'm using Laravel 4. I want to show some data from database at top of all website's pages. I have a main.blade.php and: @include("inc.header") If I should, how can I connect to database from inc/header.php in right way? I don't want make multiple connections one here at header.php and one in my pages controllers. I'm more familiar with PDO than Laravel's database methods and ORMs. Any advice is appreciated!

Laravel - @yield() not allowed in if

偶尔善良 提交于 2019-12-11 07:43:30
问题 In my title I've been using @yield('title') for a while to create a dynamic title for every different page. I'd like to take it one step further and do something like this: @if(@yield('title') == 'post') <h1> This is the post page </h1> @endif But if I try that I get the error: "The "yield" expression can only be used inside a function" I've searched around and found things like Section::yield('title') but they all didn't work. How can I use the value of @yield('title') in an if statement? I

My page takes 3-5 whole minutes to load, how can I possibly reduce it?

我与影子孤独终老i 提交于 2019-12-11 07:06:45
问题 I'm currently working on this project and the main page takes nearly 5 whole minutes to load. I've been trying to reduce the runtime, but I'm still new to programming and I'm not too familiar with pthreads, but I was told pthreads wouldn't work with this. Can someone help me figure out how to run this code faster and stop Chrome from killing the processor? Also I know my PHP code is a bit messy, was planning on cleaning it up later, but the little bits of PHP code are around lines 0, 270, 420

Laravel 5.2 - Metatag canonical Url

£可爱£侵袭症+ 提交于 2019-12-11 06:28:57
问题 i'm tryng to integrate metatags in my layout laravel, app.layouts <title>SiRegala.it - @yield('title')</title> <meta name="description" content="@yield('description')"/> <link rel="canonical" href="@yield('canonical')"/> view @section('title') Homepage @stop @section('canonical') <?php echoURL::current(); ?> @stop i'm tryng to get current url of my view, but actually i get this error: Class 'echoURL' not found How can i get Current URL ? maybe with blade? i tryed to search some solution with

Laravel 5 get data other table

痞子三分冷 提交于 2019-12-11 06:10:18
问题 I have the next stucture: table menus(id, title, type, parent_id, page_id) and pages(id, alias title,content) Model Menu class Menu extends Model { public function parent() { return $this->belongsTo('App\Menu', 'parent_id'); } public function children() { return $this->hasMany('App\Menu', 'parent_id'); } public function page() { return $this->belongsTo('App\Page', 'page_id'); } } I want get the next result: -Item 1 (show name menu table) -Item 2 -Subitem 1 and alias (show name **menu** table

Vue 2.0 Invalid expression error when increasing the length of a binding expression in a v-for directive

橙三吉。 提交于 2019-12-11 06:08:52
问题 I was playing around a little bit with Vue.js (v.2.0.1). I created a very simple api using Laravel 5.3 in the backend: In my routes file Route::get('/', function () { $tasks = Task::where('id', '<', 11)->get(); return view('welcome', [ 'tasks' => $tasks, }); The tasks table consists of 10 entries with the following structure table ------------------------------------------------- - id //a number - body // a fake short paragraph - timestamps // created_at, updated_at, etc.... In my js files ,