Search
 
SCRIPT & CODE EXAMPLE
 

PHP

laravel tricks and tips

Route::get('logout', function()
{
    Auth::logout();
     
    return Redirect::home();
});
//@sujay
Comment

laravel tricks and tips

Route::get('orders', function()
{
    return View::make('orders.index')
        ->with('orders', Order::all());
});
//@sujay
Comment

laravel tricks and tips

Article::find($article_id)->increment('read_count');
Article::find($article_id)->increment('read_count', 10); // +10
Product::find($produce_id)->decrement('stock'); // -1
//@sujay
Comment

laravel tricks and tips

//$user = User::find($id);
//if (!$user) { abort (404); }
//=> do this
$user = User::findOrFail($id);
//@sujay
Comment

laravel tricks and tips

{{ Form::model($order) }}
    <div>
        {{ Form::label('title', 'Title:') }}
        {{ Form::text('title') }}
    </div>
 
    <div>
        {{ Form::label('description', 'Description:') }}
        {{ Form::textarea('description') }}
    </div>
{{ Form::close() }}
//@sujay
Comment

laravel tricks and tips

$user = [
    'email' => 'email',
    'password' => 'password'
];
 
if (Auth::attempt($user))
{
    // user is now logged in!
    // Access user object with Auth::user()
}
//@sujay
Comment

laravel tips

$q->where(function ($query) {
    $query->where('gender', 'Male')
        ->where('age', '>=', 18);
})->orWhere(function($query) {
    $query->where('gender', 'Female')
        ->where('age', '>=', 65);
})

Comment

PREVIOUS NEXT
Code Example
Php :: validation sellphone laravel 
Php :: 500 Internal Server Error mamp rest api PDO 
Php :: eloquent complex queries 
Php :: Expression #1 of ORDER BY contains aggregate function and applies to the result of a non-aggregated query laravel 
Php :: automatice prevent default the form in php 
Php :: laravel login register api 
Php :: echo $path not showing composer 
Php :: header redirect php 
Php :: install wget downloader php 
Php :: SSL certificate problem: certificate has expired php 
Php :: show all custom taxonomy term & title with filter hook 
Php :: eager load relationships on an existing model in route laravel 
Php :: Same Taxonomy Add Multiple Post Type 
Php :: php update json file 
Php :: change php platform of composer 
Php :: How can I share limits across multiple fields gravity forms? 
Php :: fetch email from url contact form 7 
Php :: how to change directory in command processor 
Php :: how to update xampp php version 
Php :: how to check if page is opened by bot 
Php :: chr (PHP 4, PHP 5, PHP 7, PHP 8) chr — Generate a single-byte string from a number 
Php :: PHP strcspn — Find length of initial segment not matching mask 
Php :: OroCRM Custom Bundle is loaded? 
Php :: loop IlluminateSupportCollection Object ( [items:protected] = 
Php :: laravel artisan command run in route 
Php :: provide filter condition in autocomplet field in drupal form using property 
Php :: mysqldump is not recognized as an internal or external command laravel 
Php :: setup wp cron from external / cpanel cron service 
Php :: add code return block phpstorm 
Php :: ajax php example 
ADD CONTENT
Topic
Content
Source link
Name
6+5 =