LetMeKnow

LetMeKnow

Member Since 1 Month Ago

Experience Points
2,410
Total
Experience

2,590 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
0
Lessons
Completed
Best Reply Awards
0
Best Reply
Awards
  • start your 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-in-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 Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • evangelist 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.

Level 1
2,410 XP
Sep
23
1 month ago
Activity icon

Replied to Image Profile Jetstream Not Found,

@siangboon already give chmod 644 in storage , but still not found , in my folder , thats photo same , not found to

Activity icon

Replied to SQLSTATE[HY000] [2002] No Such File Or Directory (SQL: Select * From Information_schema.tables Where Table_schema = Web And Table_name = Migrations And Table_type = 'BASE TABLE')

@sinnbeck , Thanks your for help me sir , like you say And I recommend 127.0.0.1 so stick with that thats solved my problem .

Activity icon

Replied to SQLSTATE[HY000] [2002] No Such File Or Directory (SQL: Select * From Information_schema.tables Where Table_schema = Web And Table_name = Migrations And Table_type = 'BASE TABLE')

yes sir @sinnbeck

database.php

<?php

use Illuminate\Support\Str;

return [

    /*
    |--------------------------------------------------------------------------
    | Default Database Connection Name
    |--------------------------------------------------------------------------
    |
    | Here you may specify which of the database connections below you wish
    | to use as your default connection for all database work. Of course
    | you may use many connections at once using the Database library.
    |
    */

    'default' => env('DB_CONNECTION', 'mysql'),

    /*
    |--------------------------------------------------------------------------
    | Database Connections
    |--------------------------------------------------------------------------
    |
    | Here are each of the database connections setup for your application.
    | Of course, examples of configuring each database platform that is
    | supported by Laravel is shown below to make development simple.
    |
    |
    | All database work in Laravel is done through the PHP PDO facilities
    | so make sure you have the driver for your particular database of
    | choice installed on your machine before you begin development.
    |
    */

    'connections' => [

        'sqlite' => [
            'driver' => 'sqlite',
            'url' => env('DATABASE_URL'),
            'database' => env('DB_DATABASE', database_path('database.sqlite')),
            'prefix' => '',
            'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
        ],

        'mysql' => [
            'driver' => 'mysql',
            'url' => env('DATABASE_URL'),
            'host' => env('DB_HOST', '127.0.0.1'),
            'port' => env('DB_PORT', '3306'),
            'database' => env('DB_DATABASE', 'forge'),
            'username' => env('DB_USERNAME', 'forge'),
            'password' => env('DB_PASSWORD', ''),
            'unix_socket' => env('DB_SOCKET', ''),
            'charset' => 'utf8mb4',
            'collation' => 'utf8mb4_unicode_ci',
            'prefix' => '',
            'prefix_indexes' => true,
            'strict' => true,
            'engine' => null,
            'options' => extension_loaded('pdo_mysql') ? array_filter([
                PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
            ]) : [],
        ],

        'pgsql' => [
            'driver' => 'pgsql',
            'url' => env('DATABASE_URL'),
            'host' => env('DB_HOST', '127.0.0.1'),
            'port' => env('DB_PORT', '5432'),
            'database' => env('DB_DATABASE', 'forge'),
            'username' => env('DB_USERNAME', 'forge'),
            'password' => env('DB_PASSWORD', ''),
            'charset' => 'utf8',
            'prefix' => '',
            'prefix_indexes' => true,
            'schema' => 'public',
            'sslmode' => 'prefer',
        ],

        'sqlsrv' => [
            'driver' => 'sqlsrv',
            'url' => env('DATABASE_URL'),
            'host' => env('DB_HOST', 'localhost'),
            'port' => env('DB_PORT', '1433'),
            'database' => env('DB_DATABASE', 'forge'),
            'username' => env('DB_USERNAME', 'forge'),
            'password' => env('DB_PASSWORD', ''),
            'charset' => 'utf8',
            'prefix' => '',
            'prefix_indexes' => true,
        ],

    ],

    /*
    |--------------------------------------------------------------------------
    | Migration Repository Table
    |--------------------------------------------------------------------------
    |
    | This table keeps track of all the migrations that have already run for
    | your application. Using this information, we can determine which of
    | the migrations on disk haven't actually been run in the database.
    |
    */

    'migrations' => 'migrations',

    /*
    |--------------------------------------------------------------------------
    | Redis Databases
    |--------------------------------------------------------------------------
    |
    | Redis is an open source, fast, and advanced key-value store that also
    | provides a richer body of commands than a typical key-value system
    | such as APC or Memcached. Laravel makes it easy to dig right in.
    |
    */

    'redis' => [

        'client' => env('REDIS_CLIENT', 'phpredis'),

        'options' => [
            'cluster' => env('REDIS_CLUSTER', 'redis'),
            'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'),
        ],

        'default' => [
            'url' => env('REDIS_URL'),
            'host' => env('REDIS_HOST', '127.0.0.1'),
            'password' => env('REDIS_PASSWORD', null),
            'port' => env('REDIS_PORT', '6379'),
            'database' => env('REDIS_DB', '0'),
        ],

        'cache' => [
            'url' => env('REDIS_URL'),
            'host' => env('REDIS_HOST', '127.0.0.1'),
            'password' => env('REDIS_PASSWORD', null),
            'port' => env('REDIS_PORT', '6379'),
            'database' => env('REDIS_CACHE_DB', '1'),
        ],

    ],

];
Activity icon

Replied to SQLSTATE[HY000] [2002] No Such File Or Directory (SQL: Select * From Information_schema.tables Where Table_schema = Web And Table_name = Migrations And Table_type = 'BASE TABLE')

@sinnbeck im trying to make new projek laravel with command laravel new Blog --jet , so i created a database name 'Unidhaand set Env in to same database , trying to php artisan migrate still same error sir

Activity icon

Replied to SQLSTATE[HY000] [2002] No Such File Or Directory (SQL: Select * From Information_schema.tables Where Table_schema = Web And Table_name = Migrations And Table_type = 'BASE TABLE')

@sinnbeck for verifcation

im using lampp , and create database with name web

in my env setting

APP_NAME=Laravel
APP_ENV=local
APP_KEY=base64:ksA1xSQkHsyTR765SS1j+EQuwY8OoQfgmlVaKvyDPRM=
APP_DEBUG=true
APP_URL=http://localhost

LOG_CHANNEL=stack

DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=web
DB_USERNAME=root
DB_PASSWORD=

BROADCAST_DRIVER=log
CACHE_DRIVER=file
QUEUE_CONNECTION=sync
SESSION_DRIVER=database
SESSION_LIFETIME=120

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_MAILER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS=null
MAIL_FROM_NAME="${APP_NAME}"

AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=

PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1

MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

in DB_HOST im trying to change 127.0.0.1 to localhost or locahlost to 127.0.0.1 , still same error

Activity icon

Replied to SQLSTATE[HY000] [2002] No Such File Or Directory (SQL: Select * From Information_schema.tables Where Table_schema = Web And Table_name = Migrations And Table_type = 'BASE TABLE')

@sinnbeck yes sir , this is output php -m

> php -m
[PHP Modules]
bcmath
calendar
Core
ctype
curl
date
dom
exif
FFI
fileinfo
filter
ftp
gd
gettext
hash
iconv
intl
json
libxml
mbstring
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
Phar
posix
readline
Reflection
session
shmop
SimpleXML
soap
sockets
sodium
SPL
standard
sysvmsg
sysvsem
sysvshm
tokenizer
xml
xmlreader
xmlrpc
xmlwriter
xsl
Zend OPcache
zip
zlib

[Zend Modules]
Zend OPcache
Activity icon

Replied to SQLSTATE[HY000] [2002] No Such File Or Directory (SQL: Select * From Information_schema.tables Where Table_schema = Web And Table_name = Migrations And Table_type = 'BASE TABLE')

@sinnbeck alreay installed sir

> sudo apt install php7.4-mysql
Reading package lists... Done
Building dependency tree       
Reading state information... Done
php7.4-mysql is already the newest version (7.4.9-2).
php7.4-mysql set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 32 not upgraded.

im trying to sudo apt upgrade

> sudo apt upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following packages have been kept back:
  clang-9 cpp g++ gcc gcc-10-base lib32gcc-s1 lib32stdc++6 libatomic1 libcc1-0
  libclang-common-9-dev libclang-cpp9 libfreefare-bin libfreefare0 libgcc-s1
  libgfortran5 libgomp1 libitm1 libllvm9 liblsan0 libnfc-bin libobjc4
  libquadmath0 libstdc++6 libtsan0 libubsan1 llvm-9 llvm-9-dev llvm-9-runtime
  llvm-9-tools mfcuk mfoc mfterm
0 upgraded, 0 newly installed, 0 to remove and 32 not upgraded.
Activity icon

Started a new Conversation SQLSTATE[HY000] [2002] No Such File Or Directory (SQL: Select * From Information_schema.tables Where Table_schema = Web And Table_name = Migrations And Table_type = 'BASE TABLE')

Hi, i have a problem using php artisan migrate , this problem because when im reInstall php 7.4 im check documentation for using laravel .

    PHP >= 7.3
    BCMath PHP Extension
    Ctype PHP Extension
    Fileinfo PHP extension
    JSON PHP Extension
    Mbstring PHP Extension
    OpenSSL PHP Extension
    PDO PHP Extension
    Tokenizer PHP Extension
    XML PHP Extension

and try install using command

sudo apt install openssl php-common php-curl php-json php-mbstring php-mysql php-xml php-zip

and

sudo apt install php7.4-common php7.4-bcmath openssl php7.4-json php7.4-mbstring

im trying to use command php artisan migrate

so i got error like this

> php artisan migrate

   Illuminate\Database\QueryException 

  SQLSTATE[HY000] [2002] No such file or directory (SQL: select * from information_schema.tables where table_schema = web and table_name = migrations and table_type = 'BASE TABLE')

  at vendor/laravel/framework/src/Illuminate/Database/Connection.php:671
    667▕         // If an exception occurs when attempting to run a query, we'll format the error
    668▕         // message to include the bindings with SQL, which will make this exception a
    669▕         // lot more helpful to the developer instead of just the database's errors.
    670▕         catch (Exception $e) {
  ➜ 671▕             throw new QueryException(
    672▕                 $query, $this->prepareBindings($bindings), $e
    673▕             );
    674▕         }
    675▕ 

      +34 vendor frames 
  35  artisan:37
      Illuminate\Foundation\Console\Kernel::handle()
Sep
22
1 month ago
Activity icon

Replied to Image Profile Jetstream Not Found,

@siangboon , if i can ask , how to give permission in storage folder ? is chmod 644 ?

Activity icon

Replied to Image Profile Jetstream Not Found,

@sinnbeck , this error when im set all file to chmod 777 , how to restore or set default chmod again sir ?

Activity icon

Replied to Image Profile Jetstream Not Found,

@sinnbeck im sorry ,

#0 /home/coupdegrace/Documents/BELAJAR/web/vendor/livewire/livewire/src/CompilerEngine.php(38): Illuminate\View\Engines\CompilerEngine->handleViewException()
#1 /home/coupdegrace/Documents/BELAJAR/web/vendor/laravel/framework/src/Illuminate/View/Engines/PhpEngine.php(60): Livewire\CompilerEngine->handleViewException()
#2 /home/coupdegrace/Documents/BELAJAR/web/vendor/livewire/livewire/src/LivewireViewCompilerEngine.php(32): Illuminate\View\Engines\PhpEngine->evaluatePath()
#3 /home/coupdegrace/Documents/BELAJAR/web/vendor/laravel/framework/src/Illuminate/View/Engines/CompilerEngine.php(61): Livewire\LivewireViewCompilerEngine->evaluatePath()
#4 /home/coupdegrace/Documents/BELAJAR/web/vendor/laravel/framework/src/Illuminate/View/View.php(139): Illuminate\View\Engines\CompilerEngine->get()
#5 /home/coupdegrace/Documents/BELAJAR/web/vendor/laravel/framework/src/Illuminate/View/View.php(122): Illuminate\View\View->getContents()
#6 /home/coupdegrace/Documents/BELAJAR/web/vendor/laravel/framework/src/Illuminate/View/View.php(91): Illuminate\View\View->renderContents()
#7 /home/coupdegrace/Documents/BELAJAR/web/vendor/laravel/framework/src/Illuminate/Http/Response.php(62): Illuminate\View\View->render()
Activity icon

Replied to Image Profile Jetstream Not Found,

@siangboon im already make all file to chmo +x *

and then , i found logs in storage like this

#10 /home/coupdegrace/Documents/BELAJAR/web/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(95): Illuminate\Container\Util::unwrapIfClosure()
#11 /home/coupdegrace/Documents/BELAJAR/web/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(39): Illuminate\Container\BoundMethod::callBoundMethod()
#12 /home/coupdegrace/Documents/BELAJAR/web/vendor/laravel/framework/src/Illuminate/Container/Container.php(596): Illuminate\Container\BoundMethod::call()
#13 /home/coupdegrace/Documents/BELAJAR/web/vendor/laravel/framework/src/Illuminate/Console/Command.php(136): Illuminate\Container\Container->call()
#14 /home/coupdegrace/Documents/BELAJAR/web/vendor/symfony/console/Command/Command.php(258): Illuminate\Console\Command->execute()
#15 /home/coupdegrace/Documents/BELAJAR/web/vendor/laravel/framework/src/Illuminate/Console/Command.php(121): Symfony\Component\Console\Command\Command->run()
#16 /home/coupdegrace/Documents/BELAJAR/web/vendor/symfony/console/Application.php(916): Illuminate\Console\Command->run()
#17 /home/coupdegrace/Documents/BELAJAR/web/vendor/symfony/console/Application.php(264): Symfony\Component\Console\Application->doRunCommand()
#18 /home/coupdegrace/Documents/BELAJAR/web/vendor/symfony/console/Application.php(140): Symfony\Component\Console\Application->doRun()
#19 /home/coupdegrace/Documents/BELAJAR/web/vendor/laravel/framework/src/Illuminate/Console/Application.php(93): Symfony\Component\Console\Application->run()
#20 /home/coupdegrace/Documents/BELAJAR/web/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(129): Illuminate\Console\Application->run()
#21 /home/coupdegrace/Documents/BELAJAR/web/artisan(37): Illuminate\Foundation\Console\Kernel->handle()
Activity icon

Started a new Conversation Image Profile Jetstream Not Found,

Hi, i wanna ask and need help too , Today, I got some problems, because my laptop has an error and it can't be repaired, it's just that I can save the folder, and I'm currently using a new OS, and when I want to try my project, it's all safe, it's just that I uploaded a profile, my picture did not go into the storage folder, even though before my laptop was damaged, all projects were safe, there were no errors.

this code default by laravel-jetstream , I don't have to change this code

<img src="{{ $this->user->profile_photo_url }}" alt="{{ $this->user->name }}" class="rounded-full h-20 w-20 object-cover">

Sorry for my bad english :)

Sep
21
1 month ago
Activity icon

Started a new Conversation Where To Edit Template Pagination Default By Laravel 8

Hi , im using laravel 8 . and my blog , i use pagination system to handle my table .

but when im using

{{ $data->links() }}

I'm got output like

Pagination.next and pagination.prev

how i can custom text Pagination.next and pagination.prev

Sep
20
1 month ago
Activity icon

Started a new Conversation How To Make Foreach But Only Display 3 Post Like Recent Post

Hi , i wanna ask, i have a view articel like this

                  @foreach($data as $isi_post)
                    <ul class="feature-post-list recent-post-widget">
                      <li>
                        <a href="{{ route('blog.isi', $isi_post->slug) }}" class="jl_small_format feature-image-link image_post featured-thumbnail" title="Sitting right here waiting for you come to me">
                          <div class="background_over_image"></div>
                        </a>
                        <div class="item-details">
                        <span class="meta-category-small"><a class="post-category-color-text" style="background:#d800f9" href="post-layout-6.html#">Techno</a></span>
                          <h3 class="feature-post-title"><a href="{{ route('blog.isi', $isi_post->slug) }}">
                {{ $isi_post->judul }}</a></h3>
                          <span class="post-meta meta-main-img auto_image_with_date">                             <span class="post-date"><i class="fa fa-clock-o"></i>Dec 24, 2016</span></span>
                        </div>
                      </li>
                      <li>
                    </ul>
                    @endforeach

but only display 1 post, how i can set 3 post ini recent post?

Activity icon

Started a new Conversation How To Display Content Articel

I have 6 posts, and I want to display one post that is in the 6 posts earlier,

its my code to show article

    @foreach($data as $isi_post)
<h3>{!!$isi_post->content !!}</h3>
 @endforeach

how i can display only 1 post article with foreach, where i have six article .

Sep
19
1 month ago
Activity icon

Replied to Route [blog.list] Not Defined.

@frankielee i got a problem , that route list not found in php artisan route:list ,

@laracoft becuase im set name like this sir

Route::get('/semua-artikel', '[email protected]_blog')->name('blog.list');
Activity icon

Started a new Conversation Route [blog.list] Not Defined.

Hai , i wanna ask , i have route like this in web.php

Route::get('/semua-artikel', '[email protected]_blog')->name('blog.list');

in my BlogController

    public function list_blog(){
        return view('blog.list_post');
    }

blade view

                   <h1><div class="text-right show-more"><a href="{{ route('blog.list') }}" class="wow fadeInUp animated btn btn-primary">SEMUA POST</a></div><br>
                    </h1>

My structur folder blade like this

blog/list_post.blade.php
Activity icon

Replied to Trying To Get Property 'name' Of Non-object [HELP]

@snapey im trying to table column to user_id but 'name' of non-object ,

Activity icon

Replied to Trying To Get Property 'name' Of Non-object [HELP]

@michaloravec

I want to call the User from the post table, with the users_id column,

And then I created a BelongsTo relation in the Posts.php model

    public function user(){
        return $this->belongsTo('App\Models\User');
    }

In blogcontroller

i make like this

    public function index(){
        $data = Posts::latest()->take(3)->get();
        $agenda = Agenda::latest()->take(5)->get();
        $papan = Papan::latest()->take(5)->get();
        $informasi = Informasi::latest()->take(1)->get();
        return view('blog', compact('data','agenda','papan','informasi'));

        // $recent_post = Posts::latest()->take(3)->get();
        // return view('blog', compact('recent_post'));
    }
Activity icon

Replied to Trying To Get Property 'name' Of Non-object [HELP]

@snapey yes sir , but im confused, last night im acces my project , its worked not error i found . but im edit functionin PostContoller

use Illuminate\Support\Facades\Auth as FacadesAuth;
        $post = Posts::create([
            'judul' => $request->judul,
            'category_id' => $request->category_id,
            'content' => $request->content,
            'gambar' => 'public/uploads/posts/'.$new_gambar,
            'slug' => Str::slug($request->judul),
            'users_id' => Auth::id()
        ]);

im changes thats code to

        $post = Posts::create([
            'judul' => $request->judul,
            'category_id' => $request->category_id,
            'content' => $request->content,
            'gambar' => 'public/uploads/posts/'.$new_gambar,
            'slug' => Str::slug($request->judul),
            'users_id' => FacadesAuth::id()
        ]);

Different only users_id .

im trying to make my controller to first step, still i get same error .

maybe i make a mistake ? :(

Activity icon

Replied to Trying To Get Property 'name' Of Non-object [HELP]

@sinnbeck still same error sir

Trying to get property 'name' of non-object (View:
Activity icon

Replied to Trying To Get Property 'name' Of Non-object [HELP]

Yes sir, i f i delete it , its work when i delete this line sir

Activity icon

Replied to Trying To Get Property 'name' Of Non-object [HELP]

@snapey like this sir

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Models\Posts;
use App\Models\Agenda;
use App\Models\Informasi;
use App\Models\Papan;
class BlogController extends Controller
{

    public function index(){
        $data = Posts::latest()->take(3)->get();
        $agenda = Agenda::latest()->take(5)->get();
        $papan = Papan::latest()->take(5)->get();
        $informasi = Informasi::latest()->take(1)->get();
        return view('blog', compact('data','agenda','papan','informasi'));

        $recent_post = Posts::latest()->take(3)->get();
        return view('blog', compact('recent_post'));
    }

    public function isi_blog($slug){
        $data = Posts::where('slug', $slug)->get();
        return view('blog.isi_post', compact('data'));
    }


}

so im foreach in blog.isi_post.blade.php

  @foreach ($data as $post_data)
                        <div class="col-md-4 col-sm-6 col-xs-12">
                            <div class="single-blog mb-60">
                                <div class="blog-img">
                                    <a href="{{ route('blog.isi', $post_data->slug) }}"><img src="{{ $post_data->gambar }}" alt="blog" class="img-rounded" alt="Responsive Image"
                                        width="350" height="250" /> </a>
                                    <div class="blog-hover">

                                    </div>
                                </div>
                                <div class="blog-content">
                                    <div class="blog-top">
                                        <p>By {{  $post_data->user->name ?? 'uknown' }} - {{ $post_data->created_at->diffForHumans() }}</p>
                                    </div>
                                    <div class="blog-bottom">
                                        <h2><a href="{{ route('blog.isi', $post_data->slug) }}">{{ Str::upper(Str::limit($post_data->judul,50)) }} </a></h2>
                                        <br>
                                        <a class ="btn btn-primary" href="{{ route('blog.isi', $post_data->slug) }}">Selengkapnya &raquo;</a><br>
                                    </div>
                                </div>

                            </div>
                        </div>
                        @endforeach
Activity icon

Replied to Trying To Get Property 'name' Of Non-object [HELP]

@snapey but i try its , im still get same error sir .

Activity icon

Replied to Trying To Get Property 'name' Of Non-object [HELP]

@snapey im already change to users_id to user_id sir, but still same error sir

Activity icon

Replied to Trying To Get Property 'name' Of Non-object [HELP]

@sinnbeck okay sir, i make a table like this

<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreatePostsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('posts', function (Blueprint $table) {
            $table->id();
            $table->string('judul');
            $table->integer('category_id');
            $table->text('content');
            $table->string('gambar');
            $table->string('slug');
	    $table->integer('users_id');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('posts');
    }
}

And my users table like this

    public function up()
    {
        Schema::create('users', function (Blueprint $table) {
            $table->id();
            $table->string('name');
            $table->string('email')->unique();
            $table->timestamp('email_verified_at')->nullable();
            $table->string('password');
            $table->rememberToken();
            $table->string('current_team_id')->nullable();
            $table->text('profile_photo_path')->nullable();
	    $table->boolean('tipe')->default(0);
            $table->timestamps();
        });
    }

my Posts Model

<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class Posts extends Model
{
    use SoftDeletes;

    protected $fillable = ['judul','category_id','content','gambar','slug','users_id'];
    public function category(){
        return $this->belongsTo('App\Models\Category');
    }

    public function tags(){
        return $this->belongsToMany('App\Models\Tags');
    }
    public function user(){
        return $this->belongsTo('App\Models\User');
    }
    use HasFactory;
}

in my BlogController.php

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Models\Posts;
use App\Models\Agenda;
use App\Models\Informasi;
use App\Models\Papan;
class BlogController extends Controller
{

    public function index(){
        $data = Posts::latest()->take(3)->get();
        $agenda = Agenda::latest()->take(5)->get();
        $papan = Papan::latest()->take(5)->get();
        $informasi = Informasi::latest()->take(1)->get();
        return view('blog', compact('data','agenda','papan','informasi'));

        $recent_post = Posts::latest()->take(3)->get();
        return view('blog', compact('recent_post'));
    }

    public function isi_blog($slug){
        $data = Posts::where('slug', $slug)->get();
        return view('blog.isi_post', compact('data'));
    }


}

Activity icon

Replied to Trying To Get Property 'name' Of Non-object [HELP]

@sinnbeck still error sir,

Trying to get property 'name' of non-object (View: /home/letmeknow/Documents/BELAJAR/web/resources/views/blog.blade.php)

in blog.blade.php

 @foreach ($data as $post_data)
                        <div class="col-md-4 col-sm-6 col-xs-12">
                            <div class="single-blog mb-60">
                                <div class="blog-img">
                                    <a href="{{ route('blog.isi', $post_data->slug) }}"><img src="{{ $post_data->gambar }}" alt="blog" class="img-rounded" alt="Responsive Image"
                                        width="350" height="250" /> </a>
                                    <div class="blog-hover">

                                    </div>
                                </div>
                                <div class="blog-content">
                                    <div class="blog-top">
                                        <p>By {{ $post_data->user->name }} - {{ $post_data->created_at->diffForHumans() }}</p>
                                    </div>
                                    <div class="blog-bottom">
                                        <h2><a href="{{ route('blog.isi', $post_data->slug) }}">{{ Str::upper(Str::limit($post_data->judul,50)) }} </a></h2>
                                        <br>
                                        <a class ="btn btn-primary" href="{{ route('blog.isi', $post_data->slug) }}">Selengkapnya &raquo;</a><br>
                                    </div>
                                </div>

                            </div>
                        </div>
                        @endforeach
Activity icon

Replied to Trying To Get Property 'name' Of Non-object [HELP]

@sinnbeck

my modes Posts.php

<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class Posts extends Model
{
    use SoftDeletes;

    protected $fillable = ['judul','category_id','content','gambar','slug','users_id'];
    public function category(){
        return $this->belongsTo('App\Models\Category');
    }

    public function tags(){
        return $this->belongsToMany('App\Models\Tags');
    }
    public function users(){
        return $this->belongsTo('App\Models\User');
    }
    use HasFactory;
}
Activity icon

Started a new Conversation Trying To Get Property 'name' Of Non-object [HELP]

Hi , Initially I used this coding and it worked.

                                    <div class="blog-top">
                                        <p>By {{ $post_data->users->name }} - {{ $post_data->created_at->diffForHumans() }}</p>
                                    </div>

But when im try to acces my home page , and i got error

Trying to get property 'name' of non-object

I don't know why, even though last night it worked well, but when I try to run my project now, I get an error like that.

Sep
18
1 month ago
Activity icon

Started a new Conversation Laravel 8 Jetstream Role User Permission

HI , i wanna asking about Jetstream , when we created a project using laravel jetstream , we can found a table User .

in web.php route , i look code like this

Route::middleware(['auth:sanctum', 'verified'])->group(function () {
    Route::get('/dashboard', function () {
        return view('dashboard');
    })->name('dashboard');

the question is , i have a user table and i add new column name user_tipe with bolean tipe 0 and 1 if 1 its Adminstrator , if 0 its Writer.

my view blade.

    <div class="mt-2"> <select data-search="false" class="tail-select w-full" name="tipe">
            <option value="1">Administrator</option>
            <option value="0">Writer</option>
        </select> </div>

my route look like this

Route::middleware(['auth:sanctum', 'verified'])->group(function () {
    Route::get('/dashboard', function () {
        return view('dashboard');
    })->name('dashboard');
 
	    Route::resource('/user', 'UserController');

});

So how i can manage dashboard , if admin , he can access

    Route::resource('/user', 'UserController');

if not he cant acces

    Route::resource('/user', 'UserController');
Activity icon

Replied to Uppercase In Blade Laravel .

@sinnbeck now i got example , thanks your for solved my problem sir siinbeck

Activity icon

Started a new Conversation Uppercase In Blade Laravel .

HI , i have a post content iwth 100+ character text , so im give a limit using Str::limit like this

{{ Str::limit($data_agenda->content,110) }}

can i use str uppercase with str::limit with 1 line ? or i can use different method to make this succes?

Activity icon

Replied to How To Make If Condition In Blade

@sinnbeck woahh , thanks your sir

Activity icon

Replied to How To Make If Condition In Blade

Thanks for example sir @ismaile

Activity icon

Started a new Conversation How To Make If Condition In Blade

Hi , i wanna ask . i have output like

<p style="padding-left:1px;font-size:13">{{ $post_papan ->content }} &ndash; <span style="color: #ff3c00" class="blink_me"><i>BARU</i>

What i want , if date 18 September 2020 and same with date Article i get text with blink BARU

if not , my home page display only article without text blink

how i can implementation code to my projek

Activity icon

Replied to Change Time_zone Not Working.

Still same sir :(

Activity icon

Replied to Change Time_zone Not Working.

@sinnbeck still not change sir

Activity icon

Replied to Change Time_zone Not Working.

yes sir , im already do like what you say sir , when im reload home page im got error like this sir

setlocale() expects at least 2 parameters, 1 given
Activity icon

Replied to Change Time_zone Not Working.

Okay sir , i have service provier like this

<?php

namespace App\Providers;

use Illuminate\Support\ServiceProvider;

class AppServiceProvider extends ServiceProvider
{
    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {
        //
    }

    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {

        config(['app.locale'=> 'id']);
        \Carbon\Carbon::setlocale('id');
        date_default_timezone_set('Asia/Jakarta');
    }
}

In app i set to

'timezone' => 'Asia/Jakarta',
'locale' => 'id',
'fallback_locale' => 'id',
'faker_locale' => 'id_ID',

My view home page

 @foreach ($papan as $post_papan)
  <p style="padding-left:1px;font-size:13">{{ $post_papan ->content }} &ndash; <span style="color: #ff3c00" class="blink_me"></p>
 <a style="color:#FF8300">{{ $post_papan->created_at->formatLocalized("%A, %d %B %Y") }} </a>
 @endforeach
Activity icon

Replied to Change Time_zone Not Working.

Yes sir , im trying using diffhumans, its work in indonesian language , but when im trying to display date day month and years, its not working sir.

Activity icon

Replied to Change Time_zone Not Working.

using this

{{$ post_board-> created_at-> diffForHumans () }}

its work , but i want like this

DAY | MONTH | YEARS

it will be like this in Indonesian

Jumat , September 2020
Activity icon

Replied to Change Time_zone Not Working.

@sinnbeck Thank you sir, now I got a new experience.

For implementation, use \ Carbon \ Carbon :: SetLocale ('id'); what is the blade like? Should it be set something like {{$ post_board-> created_at-> diffForHumans ()}}?

Activity icon

Replied to Change Time_zone Not Working.

set in blade or ni AppService Provider sir ? @sinnbeck I

Activity icon

Replied to Change Time_zone Not Working.

@sinnbeck

my view

 <a style="color:#FF8300">{{ $post_papan->created_at->formatLocalized("%A, %d %B %Y") }} </a>
Activity icon

Replied to Change Time_zone Not Working.

@silencebringer i try using set , but when im reload my home page , my date still English not indonesia this is result output date

Friday, 18 September 2020 10.20 WIB
Activity icon

Replied to Change Time_zone Not Working.

Ahh im sorry , that output i have when i try this

date_default_timezone_get() expects exactly 0 parameters, 1 given