TiBian

Member Since 3 Years Ago

Experience Points 99,130
Experience Level 20

870 experience to go until the next level!

In case you were wondering, you earn Laracasts experience when you:

  • Complete a lesson — 100pts
  • Create a forum thread — 50pts
  • Reply to a thread — 10pts
  • Leave a reply that is liked — 50pts
  • Receive a "Best Reply" award — 500pts
Lessons Completed 1055
Lessons
Completed
Best Reply Awards 11
Best Reply
Awards
  • start-engines Created with Sketch.

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • first-thousand Created with Sketch.

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • 1-year Created with Sketch.

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • 2-years Created with Sketch.

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • 3-years Created with Sketch.

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • 4-years Created with Sketch.

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • 5-years Created with Sketch.

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • school-session Created with Sketch.

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • welcome-newcomer Created with Sketch.

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • full-time-student Created with Sketch.

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • pay-it-forward Created with Sketch.

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • subscriber-token Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer-token Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • lara-evanghelist Created with Sketch.

    Laracasts Evangelist

    Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.

  • chatty-cathy Created with Sketch.

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • lara-veteran Created with Sketch.

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • 10k-strong Created with Sketch.

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • lara-master Created with Sketch.

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • laracasts-tutor Created with Sketch.

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • laracasts-sensei Created with Sketch.

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • top-50 Created with Sketch.

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

29 Oct
1 year ago

TiBian left a reply on Im Trying To Do If Im An Admin It Doesnt Show Maintence Page

try this...

public function coinflip() {
    if (DB::table('website' )->where('maintenance', '>', 0 )->get()) {
        return view('maintenance');
    } else {
        if (Auth::rank(69 || (DB::table('website')->where('maintenance', '>', 0)))) {
            return view('coinflip');
        } else {
            return $this->validateLogin((string) 'coinflip');
        }
    }
}

TiBian left a reply on Methd ForceDelte Doesn't Exist

in the first case my guess is that you can't delete multiple records on this way, so you get a error, can you tell us what is the error you get please.

something like ```Method forceDelete does not exist.'''

public function kill($id)
{
    $post = Post::withTrashed()->where('id',$id)->get(); // This is a Collection

    $post->forceDelete(); // You can't use forceDelete() on Collection

    // So the error coming from the forceDelete() on Collection, 

    return redirect()->back()->with('success','Post Deleted Succesfully');

}

TiBian left a reply on Laravel Can't Loop Print Out The Data

Ok let me try to explain step by step,

My guess is that previously you are returning some Eloquent/DB Collections from your Controller, so on foreach you can access the property of the object like $test->property or $test['property'] both work.

but now in your current case you are creating a array on your Controller and you pass this array to your view, so now on foreach you can access the property only like $test['property'].

now about your errors

  • Invalid argument supplied for foreach()

in this case you was returning from your Controller a json = STRING, so you can't perform a foreach on a String, so the argument for the foreach was Invalid.

  • Trying to get property of non-object

in this case from your Controller you returning like a set a array and not an Eloquent/DB or some Object, so the property from the array you can access only like a normal php $test['property']

I hope my answer clarify your questions.

TiBian left a reply on Laravel Can't Loop Print Out The Data

but in order to work you need to remove the json_encode from the method, you need to return some array or collection, and not a json response.

TiBian left a reply on Laravel Can't Loop Print Out The Data

i think this can fix the issue

<div class="panel-body" align="center">
    @foreach($test as $test)
        {{ $test['ProjectN'] }}
    @endforeach
</div>

TiBian left a reply on Laravel Can't Loop Print Out The Data

from your controller remove the json_encode and then you can use the foreach

24 Oct
1 year ago

TiBian left a reply on Is It Possible To Use If < DiffInMinutes Carbon Function To @include A Layout?

try one time this.


@if ($stock->updated_at < Carbon\Carbon::now()->subMinute(10))
    @include('layouts.getstocks')
@endif 

TiBian left a reply on Steps For Installing Laravel Packages

Read the previews replay I think you run composer require on wrong path. that is my conclusion, maybe I'm wrong

TiBian left a reply on Steps For Installing Laravel Packages

my previous question was more to make some conclusion on something I suspected.

I'm thinking you run composer composer require rangka/quickbooks dev-master on the wrong folder.

let me explain something else please.

here are the steps to install something with composer, and they are very simple.

first you need to navigate on your project cd /Path/To/SomeProject/ and then you run composer require rangka/quickbooks dev-master for example.

and then I'm 100% sure you can see the folder /vendor/rangka/quickbooks

TiBian left a reply on Steps For Installing Laravel Packages

something else I need to clarify, with laravel and all php frameworks, you can use any php package. So you can start used following the instructions from the package.

for example if you want to use https://github.com/intuit/QuickBooks-V3-PHP-SDK

after composer require quickbooks/v3-php-sdk all the source code is under the vendor folder

with laravel you ignore the require "vendor/autoload.php"; laravel handle this file, no need to include

so you continue with the rest Configuration... and the work begins :P

TiBian left a reply on Steps For Installing Laravel Packages

one more question please....

you say the composer require rangka/quickbooks dev-master was completed successfully.

can you open your project and look for the path /vendor/rangka/quickbooks exist?

TiBian left a reply on Steps For Installing Laravel Packages

ok ok now I see, you mean resources/views vendor folder...

to make something clear to you, only laravel packages create a vendor folder under the resources and only if the package provide this.

so search for something like quickbooks for laravel.

Take a look this if is ok for you.

https://github.com/myleshyson/laravel-quickbooks

TiBian left a reply on Steps For Installing Laravel Packages

you can see your laravel project on browser ?

if yes, this means the vendor directory already exist on your project.

please run on terminal composer , you can see some response ?

TiBian left a reply on Vue + Axios + Delete Resource Gives Method Not Allowed

try one time the follow

your route is

| DELETE    | {locale}/portal/users/{user}  | users.destroy |

so you need to do something like this.....

axios.delete('/nl/portal/users/3');

now you making a delete request on /nl/portal/users/

like I see from the response you don't have a delete route

General
Request URL:http://portal.app/nl/portal/users
Request Method:DELETE
Status Code:405 Method Not Allowed
Remote Address:192.168.10.10:80
Referrer Policy:no-referrer-when-downgrade
23 Oct
1 year ago

TiBian left a reply on Foreach Over A Collection Is Not Working.

if the example from @tisuchi is not working

try one time...

@foreach($subcategories as $subcategory)
    Id : {{ $subcategory['id'] }} |
    Name : {{ $subcategory['name'] }} |
    Selected? : {{ $subcategory['selected'] }} <br/>
@endforeach 

TiBian left a reply on {{task.body }} Does Not Show It's Value

you missing a comma on data

new Vue({
        el: '#app',

        data: {

            tasks: [
                {body: 'Go to the store', completed: false },
                {body: 'Go to the bank', completed: false },
                {body: 'Go to the doctor', completed: false }
            ]
        },

        methods: {
            toggleCompletedFor: function(task){
                task.completed = ! task.completed;
            }
        }
    });

24 Sep
1 year ago

TiBian left a reply on Array Automatically Changed To Object After Deletion

a single record from the Model will return a simple json, when you have more than 1 record will return a array.

25 Aug
1 year ago

TiBian left a reply on Vue Pagination Not Working Only In Chrome

Lately I have some issues with chrome, and the problem coming from the cache.

try one time Chrome Canary or Incognito Window

03 Aug
1 year ago

TiBian left a reply on Browse The Next Page

or ->get()

TiBian left a reply on Browse The Next Page

try one time on your controller

$query = $query->where('kategori_id', $theme->kategori_id)->first();

25 Jul
1 year ago

TiBian left a reply on Redirection In Vue Js

I don't think you need to make a get request, because you returning a view from your Controller.

try this ...


methods: {
  searchResult() {
    window.location.href = `/search?q=${this.searchData}`;
  }
}

and then from your Controller you return the results.

class SearchController extends Controller {

  public function index(Request $request) {
    $query = $request->get('q');

    dd($query);


    // Perform the db query, and return the results
    $results = //YOUR MODEL RESULTS HERE

    
    return view('search.index', ['results' => $results]);
  }
}

24 Jul
1 year ago

TiBian left a reply on Laravel Mix - ReferenceError: Dropzone Is Not Defined

try one time ....

import Dropzone from 'dropzone';

const myDropzone = new Dropzone("div#myId", { url: "/file/post"});

TiBian left a reply on I Deleted My Provider And Now I'm Getting This Error: FatalThrowableError

on the config/app.php on the providers section remove the App\Providers\MedicineDosageProvider if you don't use it.

02 Jul
2 years ago

TiBian left a reply on Undefined Property:

thanks :)

now you can remove the getAll() method from your Order Model, and if you want learn more about Eloquent Here

TiBian left a reply on Undefined Property:

hehe no Problem bro, one like will do the job :p

TiBian left a reply on Undefined Property:

try one last time on your CmsController

public function orders() {
    return view('cms.orders', ['orders' => Order::all()]);
}

TiBian left a reply on Undefined Property:

so, your Order Model don't return nothing valid, I think your sql query is wrong

TiBian left a reply on Undefined Property:

remove dd

TiBian left a reply on Undefined Property:

ok let's do something more simple

On your Order Model

static public function getAll(){
  $sql = "Select u.name, o.*FROM orders o " .
  "JOIN users u ON u.id=o.user_id " .
  "ORDER BY o.created_at DESC";

  return DB::table('orders')->select($sql);
}

on your CmsController

public function orders() {
  $orders = Order::getAll();

  dd($orders);

  return view('cms.orders', ['orders' => $orders]);
}

TiBian left a reply on Undefined Property:

try one time this, but now I think the problem coming from your model

public function orders() {
  $orders = Order::getAll(self::$data['orders']);

  dd($orders);

  return view('cms.orders', ['orders' => $orders]);
}

TiBian left a reply on Undefined Property:

ok now I see

try one time in your CmsController

dd(self::$data['orders'])

TiBian left a reply on Undefined Property:

Like I expected

the problem coming from the self::$data

TiBian left a reply on Undefined Property:

I think you dd is wrong.

public function orders() {
  // I'm not sure for this self::$data from where coming
  $orders = Order::getAll(self::$data);

  // if this return records then i think the below is working correctly
  dd($orders);

  return view('cms.orders', ['orders' => $orders]);
}

or you can try in view if the orders var exist, i don't think so but you can try.

orders.blade.php

{{ dd($orders) }}

TiBian left a reply on Undefined Property:

try one time in your controller

public function orders() {
    $orders = Order::getAll(self::$data);

    return view('cms.orders', ['orders' => $orders]);
}

06 May
2 years ago

TiBian left a reply on Laravel Mix Method Definition Error On Production Script

Create a file .babelrc on your root project.

{
    "plugins": ["transform-es2015-shorthand-properties"]
}

Install npm install babel-plugin-transform-es2015-shorthand-properties --save

and I think you are ready to go.

I hope this helps somebody the same issue.

22 Apr
2 years ago

TiBian left a reply on Preview Markdown Emails

Fast way to view your markdown email in the browser. Perfect and easy for development layout, component etc.

use Illuminate\Mail\Markdown;

Route::get('mail', function () {
    $markdown = new Markdown(view());

    return $markdown->render('emails.test');
});
06 Oct
2 years ago

TiBian left a reply on Removing /index.php Completely

Thank @amcardwell,

@amcardwell follow again this post please.

NGiNX configurations for Forge and Homestead

Forge Configuration

The configurations begins after charset utf-8;

Before that don't change nothing where SITENAME you need to change with your domain name

# FORGE CONFIG (DOT NOT REMOVE!)
include forge-conf/SITENAME/before/*;

server {
    charset utf-8;

    # FORGE CONFIG (DOT NOT REMOVE!)
    include forge-conf/SITENAME/server/*;

    # Error Page
    error_page 404 /index.php;
    error_page 403 /index.php;

    # Cache everything for better performance 
    location ~*  \.(jpg|jpeg|png|gif|ico|svg|woff|woff2|css|js)$ {
        expires 365d;
    }
    
    # Remove index.php$
    if ($request_uri ~* "^(.*/)index\.php$") {
        return 301 $1;
    }
    
    location / {
        try_files $uri $uri/ /index.php?$query_string;

        # Remove from everywhere index.php
        if ($request_uri ~* "^(.*/)index\.php(/?)(.*)") {
            return 301 $1$3;
        }
    }
    
    # Remove trailing slash.
    if (!-d $request_filename) {
        rewrite ^/(.+)/$ /$1 permanent;
    }

    # Clean Double Slashes
    if ($request_uri ~* "\/\/") {
        rewrite ^/(.*) /$1 permanent;
    }

    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt  { access_log off; log_not_found off; }

    access_log off;
    error_log  /var/log/nginx/SITENAME-error.log error;

    error_page 404 /index.php;
    error_page 403 /index.php;

    location ~ \.php$ {
        try_files  $uri = 404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
    }

    location ~ /\.ht {
        deny all;
    }
}

# FORGE CONFIG (DOT NOT REMOVE!)
include forge-conf/SITENAME/after/*;

Homestead Laravel Configuration

Edit scripts/serve-laravel.sh and simple run homestead provision to provision all your homestead sites

#!/usr/bin/env bash

mkdir /etc/nginx/ssl 2>/dev/null

PATH_SSL="/etc/nginx/ssl"
PATH_KEY="${PATH_SSL}/${1}.key"
PATH_CSR="${PATH_SSL}/${1}.csr"
PATH_CRT="${PATH_SSL}/${1}.crt"

if [ ! -f $PATH_KEY ] || [ ! -f $PATH_CSR ] || [ ! -f $PATH_CRT ]
then
  openssl genrsa -out "$PATH_KEY" 2048 2>/dev/null
  openssl req -new -key "$PATH_KEY" -out "$PATH_CSR" -subj "/CN=$1/O=Vagrant/C=UK" 2>/dev/null
  openssl x509 -req -days 365 -in "$PATH_CSR" -signkey "$PATH_KEY" -out "$PATH_CRT" 2>/dev/null
fi

block="server {
    listen ${3:-80};
    listen ${4:-443} ssl;
    server_name $1;
    root \"$2\";

    index index.html index.htm index.php;

    charset utf-8;

    # Error Page
    error_page 404 /index.php;
    error_page 403 /index.php;

    # Remove index.php$
    if (\$request_uri ~* \"^(.*/)index\.php$\") {
      return 301 \$1;
    }

    location / {
        try_files \$uri \$uri/ /index.php?\$query_string;

        # Remove from everywhere index.php
        if (\$request_uri ~* \"^(.*/)index\.php(/?)(.*)\") {
            return 301 \$1\$3;
        }
    }

    # Remove trailing slash.
    if (!-d \$request_filename) {
        rewrite ^/(.+)/$ /\$1 permanent;
    }

    # Clean Double Slashes
    if (\$request_uri ~* \"\/\/\") {
        rewrite ^/(.*) /\$1 permanent;
    }

    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt  { access_log off; log_not_found off; }

    access_log off;
    error_log  /var/log/nginx/$1-error.log error;

    sendfile off;

    client_max_body_size 100m;

    location ~ \.php$ {
        try_files  \$uri = 404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name;

        fastcgi_intercept_errors off;
        fastcgi_buffer_size 16k;
        fastcgi_buffers 4 16k;
        fastcgi_connect_timeout 300;
        fastcgi_send_timeout 300;
        fastcgi_read_timeout 300;
    }

    location ~ /\.ht {
       deny all;
    }

    ssl_certificate     /etc/nginx/ssl/$1.crt;
    ssl_certificate_key /etc/nginx/ssl/$1.key;
}
"

echo "$block" > "/etc/nginx/sites-available/$1"
ln -fs "/etc/nginx/sites-available/$1" "/etc/nginx/sites-enabled/$1"

If someone use the follow configuration, Commented #.

    if ( $request_uri ~ "/index.(php|html?)" ) {
       rewrite ^ /$1 permanent;
    }

I hope this help you :)

22 Aug
2 years ago
08 Aug
2 years ago

TiBian left a reply on Removing /index.php Completely

Here is what I use and is working perfect.

# Remove index.php$
if ($request_uri ~* "^(.*/)index\.php$") {
    return 301 $1;
}

location / {
    try_files $uri $uri/ /index.php?$query_string;

    # Remove from everywhere index.php
    if ($request_uri ~* "^(.*/)index\.php(/?)(.*)") {
        return 301 $1$3;
    }
}


# Remove trailing slash.
if (!-d $request_filename) {
    rewrite ^/(.+)/$ /$1 permanent;
}

# Clean Double Slashes
if ($request_uri ~* "\/\/") {
  rewrite ^/(.*) /$1 permanent;
}

Another one problem is, when you visit one url for example http://domain.dev/section/index.php you receive a nice message from nginx No input file specified.

To resolve this problem, on the section location ~ \.php$ add on the first line try_files $uri = 404;

16 Mar
3 years ago

TiBian left a reply on Where Are You All From?

Hi to everyone, I'm Michalis from Trikala Greece.

2011 I Moved to Germany, Hannover.