Jump to content
Killersites Forums

Laravel


Recommended Posts

Hello There.. i so confuse how to install laravel.. i have download the laravel, and also the composer.. after i red some article in the internet, they said that before we install the laravel, we have to enable the php_opensll first.. But i can't find it in php.ini.. And i have no file ext in xampp/php/ext.. What should i do?

Link to post
Share on other sites

What article are you following on installing Laravel? I don't remember having to do anything special, as long as you are running a recent version of WAMP/XAMPP/MAMP, I believe you should be fine.

 

I believe this is roughly what I followed: http://code.tutsplus.com/tutorials/how-to-setup-laravel-4--net-28614 with a reference to http://laravel.com/docs/installation

Link to post
Share on other sites

What article are you following on installing Laravel? I don't remember having to do anything special, as long as you are running a recent version of WAMP/XAMPP/MAMP, I believe you should be fine.

 

I believe this is roughly what I followed: http://code.tutsplus.com/tutorials/how-to-setup-laravel-4--net-28614 with a reference to http://laravel.com/docs/installation

 

http://www.wikihow.com/Install-Laravel-Framework-in-Windows

 

I'm following that article.. Btw, i have overcame the problem.. :D Thanks Ben..

 

Btw, i have red an article in http://laravel.com/docs, that after the installation, we learn about routing. So, i red this http://laravel.com/docs/routing.. It teachs about get, post, etc.. But i don't quite understand about that. Every time we want to post something, we have to go to routes.php ?

Edited by longki
Link to post
Share on other sites

Btw, i have red an article in http://laravel.com/docs, that after the installation, we learn about routing. So, i red this http://laravel.com/docs/routing.. It teachs about get, post, etc.. But i don't quite understand about that. Every time we want to post something, we have to go to routes.php ?

Yes and no. If you want to create specific URLs within your application, you need to have a way of telling Laravel what action you want to happen when someone visits that URL. So yes, you need to have a route set up, to tell Laravel that when someone visits "X" URL, it needs to load "X" controller. The controller will then determine what to do and what to show the visitor. So yes, you will be likely creating a route every time you create a new page or piece of functionality... but the majority of the "work" will be done by the controller or view, not by the route file.

 

These articles might be useful for you to get an overview of Laravel and some basics of understanding how things work together:

 

CRUD: (using a database to create, remove, update and delete records)

http://scotch.io/tutorials/simple-laravel-crud-with-resource-controllers

 

Building an Instagram type application:

part 1: http://code.tutsplus.com/tutorials/building-web-applications-from-scratch-with-laravel--net-25517

part 2: http://code.tutsplus.com/tutorials/build-web-apps-from-scratch-with-laravel-the-eloquent-orm--net-25631

part 3: http://code.tutsplus.com/tutorials/build-web-apps-from-scratch-with-laravel-filters-validations-and-files--net-26058

Source code: https://github.com/nikkobautista/laravel-tutorial

Link to post
Share on other sites

Yes and no. If you want to create specific URLs within your application, you need to have a way of telling Laravel what action you want to happen when someone visits that URL. So yes, you need to have a route set up, to tell Laravel that when someone visits "X" URL, it needs to load "X" controller. The controller will then determine what to do and what to show the visitor. So yes, you will be likely creating a route every time you create a new page or piece of functionality... but the majority of the "work" will be done by the controller or view, not by the route file.

 

These articles might be useful for you to get an overview of Laravel and some basics of understanding how things work together:

 

CRUD: (using a database to create, remove, update and delete records)

http://scotch.io/tutorials/simple-laravel-crud-with-resource-controllers

 

Building an Instagram type application:

part 1: http://code.tutsplus.com/tutorials/building-web-applications-from-scratch-with-laravel--net-25517

part 2: http://code.tutsplus.com/tutorials/build-web-apps-from-scratch-with-laravel-the-eloquent-orm--net-25631

part 3: http://code.tutsplus.com/tutorials/build-web-apps-from-scratch-with-laravel-filters-validations-and-files--net-26058

Source code: https://github.com/nikkobautista/laravel-tutorial

 

Thanks Ben.. :)

 

What about this ? http://www.palusport.com/public/

 

That is my website.. and i want to use laravel framework.. but i got the error message "Mcrypt PHP extension required. " what should i do?

Link to post
Share on other sites

I want to ask something again.. I used to build website with these two files, index.php, and function.php .. i wonder, how laravel do it?

in index.php, i just include function.php, and call the function get_header from function.php.. does laravel do like that as well? because, i think it's completely redundant if i have to write header for each page, whereas each pages has the same header..

index.php

function.php

Edited by longki
Link to post
Share on other sites

I read an article about laravel, and get stuck in this section.

 

Environment Configuration

 

this is the article statement :

 

Next, we need to instruct the framework how to determine which environment it is running

in. The default environment is always production. However, you may setup other environments

within the bootstrap/start.php file at the root of your installation. In this file you will find an

$app->detectEnvironment call. The array passed to this method is used to determine the current

environment. You may add other environments and machine names to the array as needed.

 

1 <?php

2

3 $env = $app->detectEnvironment(array(

4

5 'local' => array('your-machine-name'),

6

7 ));

 

You may also pass a Closure to the detectEnvironment method, allowing you to implement your

own environment detection:

 

1 $env = $app->detectEnvironment(function()

2 {

3 return $_SERVER['MY_LARAVEL_ENV'];

4 });

You may access the current application environment via the environment method:

Accessing The Current Application Environment

 

1 $environment = App::environment();

I don't quite understand, what the functions for ?

Link to post
Share on other sites

As far as I understand it, that code allows you to automatically determine where the site is running, and what environment it is running in. For example, you may be running it in several places -- perhaps locally on your computer, on a hosted development site, or live online for anyone to view -- an in each case, you're likely to have a different database setup, and perhaps certain code (logging, for example) would run only under your development environment. The environment variable allows automatic switching between environments based on the host name, and you can then use

 

App::environment()

 

to determine which environment you're running under and thus perform specific actions.

 

See http://laravel.com/docs/configuration#environment-configuration for more, or do a Google search for "laravel environment".

  • Upvote 1
Link to post
Share on other sites

Hello Ben, sorry for bothering you many times :(

 

i have 1 question here..

 

1. I have red about Filter in Laravel guide in http://palusport.com/l4.pdf (in page 20).. I don't quite understand about this code :

 

Route::get('user', array('before' => 'old', function()

{

return 'You are over 200 years old!';

}));

 

that I don't understand, what is the use of "Before" (There is After Function also) ? for example, i run this on my browser : http://localhost/public/index.php/user, it will be redirected to home.. i Know that, because inside filter.php, i found this :

 

Route::filter('old', function()

{

if(Input::get('age') < 200)

{

return Redirect::to('home');

}

});

 

But I don't know How it works ? -_- i didn't see the 'age' Variable was sent ?

Link to post
Share on other sites

Filters allow you to run code either before or after a route (so yes, you can have both "before" and "after". Before tends to be useful if you need to do some sort of authentication checking or validation -- perhaps you want to make sure a user is logged in before they view that particular page. "After" might be used for code cleanup -- it's likely something that you won't use. In the code above, it is calling the "old" filter before the route runs.

 

The get('age') section refers to a GET variable in the URL, so try accessing the site using something like this:

 

yoururl.com/user/?age=50 (should redirect)

 

or

 

yoururl.com/user/?age=201 (shouldn't redirect)

 

I believe that should work, since age is set.

Link to post
Share on other sites

If I can offer a suggestion to you though...

 

-- If you are going to be reading the user manual, and assuming you have access to the internet, I'd suggest you be reading the official docs instead: http://laravel.com/docs.'>http://laravel.com/docs. What you are reading now is a version of the documentation (last updated mid last year), copied and pasted, but at least if you go to http://laravel.com/docs you know you'll be reading the most up to date information. I wouldn't suggest reading a PDF version unless you are on the go and don't have internet access.

 

-- Secondly, I'd suggest you skip the official documentation for now, and find a relatively simple introductory tutorial to Laravel that will give you an idea of the overall structure and how things work together before reading the documentation. There's likely to be a lot of things in the documentation that you won't use very often and will just add unnecessary complexity and confusion. Perhaps start with a "getting started" type tutorial, and come back to the full documentation when you are a little more familiar with the way it works?

 

You might consider something like this: http://scotch.io/tutorials/simple-laravel-crud-with-resource-controllers which will give you an overview of a lot of common functionality: working with routes, models, controllers, views, the database, etc.

Link to post
Share on other sites

What's confusing about the chart? It shows the actions handled by the controller, describing the server method used (GET, POST, DELETE), the path used, the primary action when that path is accessed, and the route name. It is there to help describe the functionality that you will be building.

 

As for CSS, take a look at http://www.tannerhearne.com/link-to-css-file-laravel-using-html-class/. You can also hard-code the link to the CSS file, like the link to the Boostrap CSS file in http://scotch.io/tutorials/simple-laravel-crud-with-resource-controllers. CSS files should go in the "public" folder -- either directly in that folder, or within a subfolder within the "public" folder.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...