codebullet

codebullet

Member Since 2 Years Ago

Experience Points
28,890
Total
Experience

1,110 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
273
Lessons
Completed
Best Reply Awards
1
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.

Level 6
28,890 XP
Dec
17
1 month ago
Activity icon

Replied to "Trying To Get Property 'meta_title' Of Non-object"

I am using multiple Route Parementa /{slug}/{offplan}

if i

$project = Project::where('slug', $slug)->first();

i will get a return of first parameter which will not exist in the projects slug

Activity icon

Replied to "Trying To Get Property 'meta_title' Of Non-object"

I am little confuse because i get data if i dd

App\Project {#857 ▼
  #guarded: array:1 [▶]
  #connection: "mysql"
  #table: "projects"
  #primaryKey: "id"
  #keyType: "int"
  +incrementing: true
  #with: []
  #withCount: []
  #perPage: 15
  +exists: true
  +wasRecentlyCreated: false
  #attributes: array:29 [▼
    "id" => 7
    "title" => "Non in provident vo"
    "meta_title" => "Qui voluptate adipis"
    "meta_description" => "Dolore consequat Of"
    "keywords" => null
    "slug" => "qui-voluptate-adipis"
    "price" => 480
    "type_id" => 12
    "developer_id" => 19
    "emirates_id" => null
    "community_id" => 20
    "subcommunity_id" => null
    "address" => "Eligendi vel ad quo"
    "featured_img" => "1576571140.jpeg"
    "lat" => "Ullamco aut ducimus"
    "lng" => "Minim velit assumend"
    "vr_code" => "Quas facilis itaque"
    "description" => null
    "payment_plan" => null
    "video" => "Et accusamus aliqua"
    "created_at" => "2019-12-17 08:25:41"
    "updated_at" => "2019-12-17 08:25:41"
    "size" => null
    "handover_date" => null
    "payment" => null
    "brochure" => "fidu_20191217082541.pdf"
    "floor_plans" => "["fidu_floor_1576571141.jpg","fidu_floor_1576571141.jpeg"]"
    "gallery" => "["fidu_projects_1576571141.jpeg","fidu_projects_1576571141.jpeg","fidu_projects_1576571141.jpeg"]"
    "cover_img" => "1576571140.jpeg"
  ]
  #original: array:29 [▶]
  #changes: []

Activity icon

Started a new Conversation "Trying To Get Property 'meta_title' Of Non-object"

Hello Please i need some help, for some reason I am getting this error

C:\laragon\www9\app\Http\Controllers\front\ProjectController.php
use App\Http\Controllers\Controller;
use Artesaos\SEOTools\Facades\OpenGraph;
use Artesaos\SEOTools\Facades\SEOMeta;
use Artesaos\SEOTools\Facades\JsonLd;
 
class ProjectController extends Controller
{
    //
 
    public function index(){
        return view('projects.index');
 
        
    }
 
    public function show($slug, $offplan) {
 
        $project = Project::where('slug', $offplan)->first();
        // dd($project->meta_title);
        SEOMeta::setTitle($project->meta_title);
        SEOMeta::setDescription($project->meta_description);
        SEOMeta::addMeta('article:published_time', $project->created_at->toW3CString(), 'property');
        SEOMeta::addMeta('article:section', 'Real Estate Project', 'property');
        SEOMeta::addKeyword($project->keywords);
 
        OpenGraph::setDescription($project->meta_description);
        OpenGraph::setTitle($project->title);
        OpenGraph::setUrl( route('news.show', $project->slug));
        OpenGraph::addProperty('type', 'article');
 
        OpenGraph::addImage( asset('media/news/'.$project->imae));
 
        JsonLd::setTitle($project->meta_title);
        JsonLd::setDescription($project->meta_description);
        JsonLd::setType('article');
        JsonLd::addImage( asset('media/project/'.$project->image));
//        dd($project);
        return view('projects.show', compact('project'));
    }
}
Arguments
"Trying to get property 'meta_title' of non-object"

Here is my route


Route::get('/off-plan/{slug}', 'front\[email protected]')->name('project');
Route::get('/off-plan/{slug}/{offplan}', 'front\[email protected]')->name('project.show');

this is the screenshot http://prntscr.com/qbxhr6

here is my controller


    public function show($slug, $project) {
        
        $project = Project::where('slug', $project)->first();

        SEOMeta::setTitle($project->meta_title);
        SEOMeta::setDescription($project->meta_desc);
        SEOMeta::addMeta('article:published_time', $project->created_at->toW3CString(), 'property');
        SEOMeta::addMeta('article:section', 'Real Estate News', 'property');
        SEOMeta::addKeyword($project->keywords);

        OpenGraph::setDescription($project->meta_desc);
        OpenGraph::setTitle($project->title);
        OpenGraph::setUrl( route('news.show', $project->slug));
        OpenGraph::addProperty('type', 'article');

        OpenGraph::addImage( asset('media/properties/'.$project->featured_img));

        JsonLd::setTitle($project->meta_title);
        JsonLd::setDescription($project->meta_desc);
        JsonLd::setType('article');
        JsonLd::addImage( asset('media/properties/'.$project->featured_img));
        
        return view('projects.show', compact('project'));
    }

it works for other models except this one may be cuz i am using multiple route parameters

Please advise

Activity icon

Replied to Laravel Multiple Route Parameters

Thank you for helping,

I have to add the second route parameter


public function show($slug, $project) {
        $project = Project::where('slug', $project)->first();
        dd($project);

If i pass the only the slug i get only the first route parameter that will return null because it is a slug of the community

Now i am trying to solve community with the wrong slug will not show 404 page

Activity icon

Replied to Laravel Multiple Route Parameters

this are my routes to the methods

Routes

Route::get('/off-plan/{slug}', 'front\[email protected]')->name('community.show');
Route::get('/off-plan/{slug}/{project}', 'front\[email protected]')->name('project.show');

my community method

    public function show($slug)
    {
        //

        $community = Community::where('slug', $slug)->with('projects')->first();
     
        return view('communities.show', compact('community'));

    }
Activity icon

Replied to Laravel Multiple Route Parameters

Sorry my mistake on this post

this is my actual controller method

    public function show($slug) {
        $project = Project::where('slug', $slug)->first();
        dd($project);

I get null if i change the route to just www.domain.com/project/{slug}

i get data returned.

Activity icon

Started a new Conversation Laravel Multiple Route Parameters

Hello,

Please I am seeking help advise on multiple route route parameters

I need to make dynamic category like so www.domain.com/{community}/{property}

I face issue if the requested slug is not available, i am expecting 404 page as usual but i get

C:\laragon\www9\vendor\laravel\framework\src\Illuminate\View\Engines\PhpEngine.php
     *
     * @param  string  $__path
     * @param  array   $__data
     * @return string
     */
    protected function evaluatePath($__path, $__data)
    {
        $obLevel = ob_get_level();
 
        ob_start();
 
        extract($__data, EXTR_SKIP);
 
        // We'll evaluate the contents of the view inside a try/catch block so we can
        // flush out any stray output that might get out before an error occurs or
        // an exception is thrown. This prevents any partial views from leaking.
        try {
            include $__path;
        } catch (Exception $e) {
            $this->handleViewException($e, $obLevel);
        } catch (Throwable $e) {
            $this->handleViewException(new FatalThrowableError($e), $obLevel);
        }
 
        return ltrim(ob_get_clean());
    }
 
    /**
     * Handle a view exception.
     *
     * @param  \Exception  $e
     * @param  int  $obLevel
     * @return void
     *
     * @throws \Exception
     */
    protected function handleViewException(Exception $e, $obLevel)
    {
        while (ob_get_level() > $obLevel) {
            ob_end_clean();
Arguments
ErrorException {#851 ▼
  #message: "Trying to get property 'name' of non-object"
  #code: 0
  #file: "C:\laragon\www9\storage\framework\viewsbf0967fc3fea3d21ece4ce61fed17bf4dfd323b.php"
  #line: 2
  #severity: E_NOTICE
}
1

secondly i get null if i am trying to get the property by slug

    public function show($slug) {
        $project = Property::where('slug', $slug)->first();
        dd($property);

Please how can i get property data cuz at the moment i get null, i will need to pass community slug in show method may be

public function show($community, $slug) {
       #how can i query to get the property
        dd($property);

Thanks for reading

Oct
22
3 months ago
Activity icon

Replied to Access Denied For User

This user "nhkhan_root" have access to the database? maybe try adding new user and password the database, then try again may be "nhkhan_root" don't have database access or restricted

Activity icon

Replied to Package Installation And Php Artisan Serve Not Working

try checking your /public/index.php to see where require autoload.php if the path is right or maybe commented out

Sep
23
3 months ago
Activity icon

Replied to Getting ID From Collection To Sync Many-to-many Relationshi

Thank you so much, i appreciate. save my day.

Activity icon

Started a new Conversation Getting ID From Collection To Sync Many-to-many Relationshi

Hi all, please i need some help with collections

i am receiving a string separated by comma, I exploded and do for each to updateOrCreate() like so



            //get amenity a string convert to array and save as models
            $PropAmenities[] = explode(",",  $property->get('amenities'));
            foreach ($PropAmenities[0] as $item) {
                $amenities[] = Amenity::firstOrCreate([
                    'short_name' => $item,
                ]);

            }
            dd($amenities);

I get this


array:31 [▼
  0 => Amenity {#1103 ▼
    #fillable: array:3 [▶]
    #connection: "mysql"
    #table: "amenities"
    #primaryKey: "id"
    #keyType: "int"
    +incrementing: true
    #with: []
    #withCount: []
    #perPage: 15
    +exists: true
    +wasRecentlyCreated: false
    #attributes: array:6 [▼
      "id" => 1
      "name" => "Balcony"
      "short_name" => "BA"
      "icon" => "NULL"
      "created_at" => "2019-07-22 11:10:00"
      "updated_at" => "2019-07-22 11:10:00"
    ]
    #original: array:6 [▶]
    #changes: []
    #casts: []
    #dates: []
    #dateFormat: null
    #appends: []
    #dispatchesEvents: []
    #observables: []
    #relations: []
    #touches: []
    +timestamps: true
    #hidden: []
    #visible: []
    #guarded: array:1 [▶]
  }
  1 => Amenity {#1140 ▶}
  2 => Amenity {#1177 ▶}
  3 => Amenity {#1214 ▶}
  4 => Amenity {#1251 ▶}
  5 => Amenity {#1288 ▶}
  6 => Amenity {#1325 ▶}
  7 => Amenity {#1362 ▶}
  8 => Amenity {#1399 ▶}
  9 => Amenity {#1436 ▶}

i try to reach out to get the id of the collection and attach to a relationship i get errors

when i

 dd($amenities[0]);

i get this


  #fillable: array:3 [▼
    0 => "name"
    1 => "short_name"
    2 => "icon"
  ]
  #connection: "mysql"
  #table: "amenities"
  #primaryKey: "id"
  #keyType: "int"
  +incrementing: true
  #with: []
  #withCount: []
  #perPage: 15
  +exists: true
  +wasRecentlyCreated: false
  #attributes: array:6 [▼
    "id" => 1
    "name" => "Balcony"
    "short_name" => "BA"
    "icon" => "NULL"
    "created_at" => "2019-07-22 11:10:00"
    "updated_at" => "2019-07-22 11:10:00"
  ]
  #original: array:6 [▼
    "id" => 1
    "name" => "Balcony"
    "short_name" => "BA"
    "icon" => "NULL"
    "created_at" => "2019-07-22 11:10:00"
    "updated_at" => "2019-07-22 11:10:00"
  ]
  #changes: []

I can only reach out to the id like this

 dd($amenities[0])->id;

I am lost trying to attach this another model doing this i get null

 $property->amenities()->attach($amenities[0]);

please i need a guide to grab the ids and attach or sync to the model the relationship is mapped correctly with pivot table working well in tinker adding one value problem is with this chunck of value.

Thank you