#laravel4
Explore tagged Tumblr posts
Photo
Code Igniter is a commanding PHP framework. If we consider web applications with advanced features, Code Igniter is one of the efficient PHP Frameworks.
#php#php7#web#developing#wordpress#laravel4#laravel5#laraveldeveloper#codeigniter#codeigniterindonesia#javascripts#programming
0 notes
Photo
Laravel 5.5 tutorial how to use response part 16 laravel - laravel4 - laravel 5 - how to insert update delete using laravel - how to insert update delete using ajax with laravel - how to use crud in laravel - how to use crud in laravel with jquery - javascript - json - ajax - how to use laravel4.1 - how to use laravel4.2 - how to use laravel 5 - how to use laravel 5.1 - how to use laravel 5.2 source
0 notes
Link
0 notes
Text
Code Bright | Desarrollo de aplicaciones web con la versión 4 del framework Laravel para principiantes
Bienvenido de nuevo a Laravel.
Hace un año, Dayle escribió un libro sobre el framework de PHP. Comenzó como una colección de tutoriales en su blog y eventualmente se convirtió en libro. No me esperaba que fuera tan popular. Code Happy ha vendido casi 3000 copias, y es considerado uno de los recursos más útiles para aprender sobre Laravel.
Code Bright es el sucesor espiritual de Code Happy. El framework ha crecido mucho en el pasado año y ha cambiado lo suficiente como para necesitar otro título. Con Code Bright Dayle espera mejorar Code Happy todo lo posible. Su meta es, una vez más, crear la mejor experiencia de aprendizaje para el framework. Oh, y seguir siendo gracioso. Eso es muy importante para él.
Code Bright contiene una experiencia de aprendizaje completa para todas las características del framework. El estilo de escritura hará que sea cercano a los novatos, y una maravillosa referencia para programadores experimentados también.
Pueden comprarlo en Leanup (el texto ah sido extraído de este sitio) o pueden descargarlo desde mi Dropbox.
0 notes
Text
Laravel 4 basic routing reference
Please note that this is not tutorial. I'm treating this article as quick reference for myself.
Creating routes in Laravel is quite easy, just open app/routes.php and start writting in here is quick reference on the ways to get started, it's by no means comprehensive guide to Laravel routing, but just quick reference for myself. If you want full blown guide into routing please check Laravel docs.
Ok so let's get started:
The simplest route possible will be:
Route::get('/', function(){ return "hello world!"; });
The first parameter is where one would define route in this case it's the root of the app, if the app is hosted under example.com domain it would be accessed by http://www.example.com/, the second parameter in this case is closure which processes route and returns string `hello world!`.
To pass parameter to route one would use following syntax in the first Route::get argument: '/foo/{bar}', to pass optional parameter one could pass '/foo/{bar?}' to work with arguments you need to pass them to closure like this function($bar), if the parameter is optional you can define default parameter like this function($bar = "baz"). So the final route will look like this:
Route::get('/foo/{bar?}', function($bar = "baz") { return "hello {$baz}"; });
There is one more thing regarding passing parameters to route one can supply regex for route parameter matching:
Route::get('/foo/{bar}', function($bar){})->where('bar', '[A-Za-z]+'); //multiple param pattern matching is done by chaining where(): Route::get()->where('p1', 'pattern')->where('p2', 'pattern');
you can also give alias to controller using following syntax:
Route::get('/', ['as'=>'home',function]);
One can also attach routes to controllers in the following manner:
// attach to non-namespaced controller method: Route::get('/foo', 'barController@baz'); // attach to namespaced controller method: Route::get('/foo', 'my\namespace'barController@baz'); // attach controller to route also add alias: Route::get('/foo', ['as' => 'bar', 'uses' => 'fooController@baz']);
There is much more to cover regarding routing such as filtering returning views etc. But as I said I'm treating this article as quick reminder to myself. I will continue covering laravel basics. As I will get more grasp on them.
0 notes
Text
Laravel4初期値設定クラス(Seeder)を作成
マイグレーションしたUsersテーブルへの初期データを投入してみる。
1.seedクラスを作成
DatabaseSeederを継承して作成する
class UserSeeder extends DatabaseSeeder { public function run() { $users = [ [ 'username' => 'xxxx', 'password' => Hash::make('xxxx'), 'email' => '[email protected]' ] ]; foreach($users as $user) { User::create($user); } } }
2.app/seeds/DatabaseSeeder.phpに実行するseedクラスを追記
class DatabaseSeeder extends Seeder { /** * Run the database seeds. * * @return void */ public function run() { Eloquent::unguard(); //実行するseedクラスを指定する $this->call("UserSeeder"); } }
3.seedクラスを実行
php artisan db:seed
成功すれば以下のメッセージでる
Seeded: UserSeeder
これでOK
これは結構便利だなー。
0 notes
Text
Laravel 4: POST リクエストを処理する
Laravel 4: HTTP サーバーを立ち上げる
Laravel 4: コントローラーからビューに変数を渡す
Laravel 4: POST リクエストを処理する
素�� PHP のコードとの���較のために $_POST、$_FILES をコメントとして、併記した。まずは HTTP リクエストが Content-Type の値が application/x-www-form-urlencoded である場合。
// routes.php Route::post('/', function() { // return $_POST['foo']; return Input::get('foo', 'default'); }); // client.php $url = 'http://localhost:3000/'; $body = "foo=bar"; $opts['http'] = [ 'method' => 'POST', 'protocol_version'=>'1.1', 'header' => "Content-Type: application/x-www-form-urlencoded\r\n", 'content' => $body ]; $context = stream_context_create($opts); $ret = file_get_contents($url, false, $context); var_dump('bar' === $ret);
次は Content-Type の値が multipart/form-data の場合をやってみよう。
// routes.php Route::post('/', function() { // return file_get_contents($_FILES['userfile']['tmp_name']); $path = Input::file('userfile')->getRealPath(); return file_get_contents($path); }); // client.php $url = 'http://localhost:3000/'; $boundary = '----'.microtime(true); $content = '--'.$boundary."\r\n". 'Content-Disposition: form-data; name="userfile"; filename="test.txt"'."\r\n". 'Content-Type: text/plain'."\r\n\r\n". "hello world\r\n". '--'.$boundary.'--'."\r\n"; $opts['http'] = [ 'method' => 'POST', 'protocol_version'=>'1.1', 'header' => "Host: localhost:3000\r\n". "Connection: close\r\n". "Content-Type: multipart/form-data; boundary={$boundary}", 'content' => $content ]; $context = stream_context_create($opts); $ret = file_get_contents($url, false, $context); var_dump('hello world' === $ret);
最後に Content-Type の値が application/json である場合。
// routes.php Route::post('/', function() { // return file_get_contents('php://input'); return Input::all(); }); // client.php $url = 'http://localhost:3000/'; $options = JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT | JSON_PRETTY_PRINT; $content = json_encode(['key' => 'value'], $options); $opts['http'] = [ 'method' =>'POST', 'header' => 'Content-type: application/json', 'content' => $content ]; $context = stream_context_create($opts); $ret = file_get_contents($url, false, $context); $ret = json_decode($ret, true); var_dump('value' === $ret['key']);
2 notes
·
View notes
Text
Laravel Installation in 30 seconds Flat - Mac OS
Found this on codem0nk3y - publishing it here so that I can find it easily next time.
We've got a new installer in the form of a PHP archive(.phar). Once installed, you can fire up a new Laravel project simply by running laravel new foo in a terminal window. That is, of course, assuming you've moved it somewhere inside your path and renamed it to remove the .phar extension.
When I used the new installer to create a fresh Laravel project just now, I had an *entire* project ready to go in less than 30 seconds(!) and I'm on a relatively slow connection. Gone are the days of putting the kettle on after creating a new project with composer.
So, save yourself some time before your next new Laravel project, and prepare yourself now. Try this out for size:
wget http://laravel.com/laravel.phar && chmod +x laravel.phar && mv laravel.phar /usr/local/bin/laravel
This will fetch the new installer, add the execute bit so you can actually use it, then moves it to/usr/local/bin which should be in your PATH. If it's not, either add it so it is, or put it somewhere else that is - doesn't matter either way. Of course, there's always the manual option if you're that way inclined.
When you've installed the installer, run laravel --version to make sure it works. It does? Awesome! Now create a project and, as it'll tell you when done, build something amazing!
0 notes
Link
What happens when you need to created nested resources? For example, you may have a resource for a post, but how might ...
Nested resources in Laravel 4. Use dot when defining your resource routes.
0 notes
Text
Laravel 4 Environment Detection
So my most favorite MVC framework Laravel 4 is one of the most amazing and elegant frameworks to work with for developing web applications quickly. However, one of the biggest issues that I didn't like in the update from Laravel 3 to Laravel 4 was the way that Environment detection was done.
Laravel comes with the great ability to load different config files based on what environment the application is being run from (yes, I ended that sentence with a preposition). However, in Laravel 4, the default mechanism is based on the actual machine name of the server. The default environment detection uses the native php gethostname() to get the... well... hostname. This is all well and good until you have a situation where you're running a development and QA server on the same box. In that case, they would both have the same machine name.
The default way of configuring a set of environment is to pass an associative array of environment names matched against their corresponding machine names. Here is an example of the default configuration that would be configured in the `bootstrap/start.php:
$env = $app->detectEnvironment( array( 'local' => array('your-machine-name'), 'dev' => array('my-dev-machine-name'), 'qa' => array('my-qa-machine-name'), 'stage' => array('my-stage-machine-name'), 'production' => array('my-production-machine-name'), ) );
Well, the good news is that instead of passing in an array of environments, you can pass in an anonymous function that returns the environment name. Here you can use whatever method you want to determine which server you're on. In the example below, I've adapted from a similar method I've used within Wordpress to detect environments and load the proper config files. I'm using the $_SERVER['SERVER_NAME'] global to determine the name of the server and then returning the environment based on that information:
$env = $app->detectEnvironment(function () { $environments = array( 'local' => array('local.mydomain.com', 'local.'), 'dev' => 'dev.mydomain.com', 'qa' => 'qa.mydomain.com', 'review' => 'review.mydomain.com', 'production' => array('mydomain.com', 'dev.mydomain.com'), ); $server_name = !empty($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : 'local.mydomain.com'; foreach ( $environments AS $key => $env ) { if ( is_array( $env ) ) { foreach ( $env as $option ) { if ( stristr( $server_name, $option ) ) { return $key; } } } else { if ( strstr( $server_name, $env ) ) { return $key; } } } // default to production return 'production'; });
This is a great way of detecting environments if the applications happen to live on the same machine name.
0 notes
Link
Authentication is required for virtually any type of web application.
0 notes
Photo
admin panel laravel – how to create admin panel laravel 5.2 laravel - laravel4 - laravel 5 - how to insert update delete using laravel - how to insert update delete using ajax with laravel - how to use crud in laravel - how to use crud in laravel with jquery - javascript - json - ajax - how to use laravel4.1 - how to use laravel4.2 - how to use laravel 5 - how to use laravel 5.1 - how to use laravel 5.2 source
#...#admin panel in laravel#admin panel laravel#ajax#crud#delete#how#in#insert#javascript#jQuery#json#laravel#laravel4#to#update#use#using#with
0 notes
Link
SPA (Single Page Applications) are web applications commonly developed in HTML, JavaScript and CSS. The user loads the initial page then all the needed resources are loaded dynamically via XHR and inserted into the DOM without reloading the page.
Developing SPA application can be extremely exciting, but we should always stay focused on securing all the app’s possible leaks.
Managing user authentication via RIA (Rich Interface Applications) is similar to standard web Client Server Application. Usually, in Standard web apps the authentications is fully managed by the used framework (Laravel Auth, Spring Security …) and it’s pretty simple:
After a valid user authentication, the server sends a secret token that is stored server side in the Server Session or the DataBase, and client side in the cookies.
Each time the client (browser) asks for a resource, it sends the secret token in the header.
The server compares the token with the one it has, if it’s valid, it responds and sends back a new token that will be used for the next request.
If there is a problem with the token the user is redirected to the Login form.
RIA apps uses XHR requests to retrieve data from the server via REST services, it can’t manage authentication exceptions, because the tokens verification are made server side. In our case we will be developing a REST API that should use the Framework Authentication features and manage Authentication issues (disconnects, session expiry, hacks, etc …) and redirect the user to the login form.
0 notes
Photo
ลงได้แว้วว - เริ่มต้นเขียน PHP ด้วย Laravel 4 ตอนที่ 1: การลง Laravel 4
View Post
0 notes
Photo
Laravel 5.4 – Student Mangement System Chart Part 34 – Admin Panel Part 34 laravel - laravel4 - laravel 5 - how to insert update delete using laravel - how to insert update delete using ajax with laravel - how to use crud in laravel - how to use crud in laravel with jquery - javascript - json - ajax - how to use laravel4.1 - how to use laravel4.2 - how to use laravel 5 - how to use laravel 5.1 - how to use laravel 5.2 source
3 notes
·
View notes
Photo
Laravel 5 CRUD stored procedure mysql laravel - laravel4 - laravel 5 - how to insert update delete using laravel - how to insert update delete using ajax with laravel - how to use crud in laravel - how to use crud in laravel with jquery - javascript - json - ajax - how to use laravel4.1 - how to use laravel4.2 - how to use laravel 5 - how to use laravel 5.1 - how to use laravel 5.2 php admin panel vue js ap.net source
1 note
·
View note