Sie sind auf Seite 1von 2

LARAVEL

##### Video tutorials - https://laracasts.com/series/laravel-5-fundamentals


##### Create new project - http://blog.osteel.me/posts/2015/04/23/how-to-start-a-
new-laravel5-project-with-homestead-quick-reference.html

0)New aplication
gitbash -> cd homestead
vagrant up —-provision - da restartuje ngix
composer create-project laravel/laravel new-site

But here are the instructions anyway:

Download xdebug-2.4.0.tgz
Unpack the downloaded file with tar -xvzf xdebug-2.4.0.tgz
Run: cd xdebug-2.4.0

Run: phpize (See the FAQ if you don't have phpize.

As part of its output it should show:

Configuring for:
...
Zend Module Api No: 20151012
Zend Extension Api No: 320151012

If it does not, you are using the wrong phpize. Please follow this FAQ entry
and skip the next step.
Run: ./configure
Run: make
Run: cp modules/xdebug.so /usr/lib/php/20151012
Update /etc/php/7.0/fpm/php.ini and change the line
zend_extension = /usr/lib/php/20151012/xdebug.so
Restart the webserver
[08.06.2016. 08.34.45] Nemanja Sokolovic: [xdebug]
zend_extension = /usr/lib/php/20151012/xdebug.so

xdebug.remote_connect_back = 1
xdebug.remote_port = 9000
xdebug.remote_handler = dbgp
xdebug.remote_mode = req
xdebug.remote_enable = 1
xdebug.idekey = phpstorm
[08.06.2016. 08.34.51] Nemanja Sokolovic: /etc/php/7.0/fpm/php.ini

*)Configuration
-In config folder
-Accessing

1)Folder structure
app - core code aplikacije
app/Http/Controllers - kontroleri
resources/views - view('welcome') = resources/views('welcome.blade.php')

2)Passing data to views


return view('pages.about')->with('name', $name); ---> u view: $name ({{ $name }}
ili {!! without escaping data, npr color promenice boju !!})
return view('pages.about', $data)
$first
$last
return view('pages.about', compact('first', 'last'))

3)Creating controller
kroz comand line - php artisan make:controller PagesController (--plain samo
osnovno)

4)Blade
in app:
|@yield('content')
|@yield('footer')
@extends('app') -> app.blade.php
@section('content')
...
@stop
@section('footer')
<script ...
@stop
<?php moze da se pise u blade
@if @else @endif
@unless if !, @foreach, @foreelse

5)Environments and Configurations


.env - environment configuration
| APP_ENV - production/local
config - konfiguracioni fajlovi
|database.php/'mysql' - moze da se postavi password, ali bolje je u .env

6)Migrations
database/migrations
kao u zend
Blueprint
php artisan migrate (rollback... php artisan da vidis sta sve postoji )
php artisan (help) make:migration
php artisan make:migration add_excerpt_to_articles_table --table="articles" - nova
migracija npr za dodavanje nove kolone ($table->text('excerpt'))
za drop potreban je dodatni package

7)Eloquent
povezan je sa entitetom iz baze i nasledjuje Model
php artisan make:model Article
php artisan tinker

Das könnte Ihnen auch gefallen