Ramazan

Ramazan

Member Since 1 Year Ago

Experience Points
2,220
Total
Experience

2,780 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-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 1
2,220 XP
Jan
01
3 weeks ago
Activity icon

Replied to Laravel Notification The Notify() Is Not Working

the attach is not available by rooms this is the error Method Illuminate\Database\Eloquent\Collection::attach does not exist.

Activity icon

Replied to Laravel Notification The Notify() Is Not Working

the error is

Call to a member function notify() on null

Activity icon

Started a new Conversation Laravel Notification The Notify() Is Not Working

i want to send notification to database when a customer submit their phone number by form the customer want a hostel room so he/she send their phone number with that room id i want to store a notification when the form was submitted

the notification class

<?php

namespace App\Notifications;

use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use App\Room;
use App\Customer;

class Like extends Notification
{
    use Queueable;

    public $room;
    /**
     * Create a new notification instance.
     *
     * @return void
     */
    public function __construct(Room $room)
    {
        $this->room = $room;
    }

    /**
     * Get the notification's delivery channels.
     *
     * @param  mixed  $notifiable
     * @return array
     */
    public function via($notifiable)
    {
        return ['database'];
    }

    /**
     * Get the array representation of the notification.
     *
     * @param  mixed  $notifiable
     * @return array
     */
    public function toDatabase($notifiable)
    {
        return [
            'room' => $this->room,
        ];
    }
}

the customer store method

  public function store(Request $request , $room_id)
     {
        $customer = Customer::create([
          'phone'   => $request->phone,
        ]);
        
        $room = Room::find($room_id);
        $customer->rooms()->attach($room_id)->notify(new Like('$room'));
        return back();
    }

Dec
28
3 weeks ago
Activity icon

Started a new Conversation How To Make Sweet Delete With Sweet Alert Confirmation

i have make delete with sweet alert confirmation in laravel but it is delete with out confirmation of the sweet alert the alert is working but how to make the delete to work with confirming the alert

this is the <a> tag

  <a href="{{route('hostel.delete' ,$hostel->id)}}" id="m_sweetalert_demo_9" class="btn btn-outline-danger m-btn m-btn--icon m-btn--icon-only m-btn--pill  mt-3 mr-3 pull-left"><i class="fa flaticon-delete"></i></a>

the .js

$('a').click(function(){

  swal({
  title: 'Are you sure?',
  text: "It will permanently deleted !",
  type: 'warning',
  showCancelButton: true,
  confirmButtonColor: '#3085d6',
  cancelButtonColor: '#d33',
  confirmButtonText: 'Yes, delete it!'
}).then(function() {
  swal(
    'Deleted!',
    'Your file has been deleted.',
    'success'
  );
})

})
</script
Dec
15
1 month ago
Activity icon

Replied to How To Update Multi Select

the form is store the facility but the update is not working with more explain i have a hostel with many facilities i want to make edit the hostel facilities

this is the store method it's work correctly

    public function store(Request $request)
    {
        $hostel = new Hostel();
        $hostel->name = $request->name;
        $hostel->owner_id = 1; //Aut::user()->id;
        $hostel->type = $request->type;
        $hostel->phone = $request->phone;
        $hostel->email = $request->email;
        $hostel->description = $request->description;
        $hostel->save();
        $address = new Address();
        $address->hostel_id = $hostel->id;
        $address->province = $request->province;
        $address->state = $request->state;
        $address->rood = $request->rood;
        $address->alley = $request->alley;
        $address->station = $request->station;
        $address->home_number = $request->home_number;
        $address->save();
        // $facility =$request->input(facility_name);
        // $hostel->attach($f);

       foreach ($request->facility_name as  $name) {
              // code...
              $facility = new Facility;
              $facility->hostel_id = $hostel->id;
              $facility->facility_name = $name;
              $facility->save();
            }
      foreach ($request->file('file') as $file)
      {
         $isUploaded = uploadAttachments($hostel->id,0,0,$file,'attachments');
         if(!$isUploaded)

           Session()->flash('att_failed','File is note uploaded try again');
         }
        return redirect()->route('hostels_list');
    }

and this the edit it's work correctly

 public function edit($id)
   {
       // make edit hostel ... 'ramazan'
       if ($id && ctype_digit($id)){
           $hostel = Hostel::find($id);
           // if the object is
           if ($hostel && $hostel instanceof Hostel){

               return view('cms/hostel/hostel_create', compact('hostel'));
           }
       }

   }

and the update it[s dose not work only the facilities

    public function update(Request $request , $id)
    {
        // make update hostel details 'ramazan'

        $input = [
            'name' => request()->input('name'),
            'type' => request()->input('type'),
            'phone' => request()->input('phone'),
            'email' => request()->input('email'),
            'description' => request()->input('description'),
        ];

        $hostel = Hostel::find($id);
        $hostel->update($input);

        // make update the hostel address ... 'ramazan'
        $address = Address::find($id);
        $address->province = $request->get('province');
        $address->state = $request->get('state');
        $address->rood = $request->get('rood');
        $address->alley= $request->get('alley');
        $address->station= $request->get('station');
        $address->home_number= $request->get('home_number');
        $address->save();

       
        foreach ($request->facility_name as  $name) {
            $facility = new Facility;
            $facility->facility_name = $request->get('facility_name[]');
            $facility->save();
        }

        return redirect()->route('hostel.index');

    }
Activity icon

Replied to How To Update Multi Select

let me ask you how to make update the multi select this is the select dropdown

      <select class="form-control m-select2" id="m_select2_2_3" name="facility_name[]"
                        multiple="multiple">

                    <optgroup label="chose the hostel facility">

                        @foreach($hostel->facility as $fc)
                            {<option value="{{$fc->id}}" {{in_array($fc->id, old("facility_name") ?: []) ? "selected": ""}}>{{$fc-               
                                >facility_name}}</option>

                        @endforeach
                    </optgroup>
                </select>

Activity icon

Started a new Conversation How To Update Multi Select

please write an update method for the multi select

#####this is the create function

       foreach ($request->facility_name as  $name) {
              $facility = new Facility;
              $facility->hostel_id = $hostel->id;
              $facility->facility_name = $name;
              $facility->save();
            }
Dec
04
1 month ago
Activity icon

Started a new Conversation How To Upload Multiple File

i want store the multiple image from my form but i don't know the controller i have a hostelthat have multi image so how to store the image with hostel foreign key i have created the models and table and forms help me with controllers

Nov
02
2 months ago
Activity icon

Replied to How To Make Edit And Update Multi Select Form Value

i have no error but i want to send data from db to form for editing my form is multi select and i don't know how to and what is the update logic for a multi select inputs value thanks

Activity icon

Started a new Conversation How To Make Edit And Update Multi Select Form Value

i want edit and update the hostel facility that each hostel hasMany facilities so how to make edit and update the multi select values

<div class="form-group m-form__group row">
            <label class=" col-lg-12 col-sm-12 " style="">select facility</label>
            <div class="col-md-12 col-sm-12">
                <select class="form-control m-select2" id="m_select2_2_3" name="facility_name[]"
                        multiple="multiple">
                    <optgroup label="Eastern Time Zone">
                        <option value="internet"  >internet</option>
                        <option value="book">book</option>
                        <option value="coffiee">coffiee</option>
                        <option value="chairs">chairs</option>
                    </optgroup>
                </select>

            </div>
        </div>

my controller

    public function edit($id)
    {
        //
        if ($id && ctype_digit($id)){
            $hostel = Hostel::find($id);
            // if the object is
            if ($hostel && $hostel instanceof Hostel){

                return view('cms/hostel/hostel_create', compact('hostel'));
            }
        }

    }
//$hostels = Hostel::with('address')->get();
    /**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \App\hostels  $hostels
     * @return \Illuminate\Http\Response
     */
    public function update(Request $request , $id)
    {
        //


        $input = [
            'name' => request()->input('name'),
            'type' => request()->input('type'),
            'phone' => request()->input('phone'),
            'email' => request()->input('email'),
            'description' => request()->input('description'),
        ];

        $hostel = Hostel::find($id);
        $hostel->update($input);
        return redirect()->route('hostel.index');

    }
Oct
30
2 months ago
Activity icon

Replied to How To Send HasOne Relation Data For Edit In Select2 Forms

address is belongs to hostel and hostel hasone address how to send the data for update and edit

Activity icon

Started a new Conversation How To Send HasOne Relation Data For Edit In Select2 Forms

i want to send the hostel address for editing in to from i have used select2 form each hostel hasOne address so how to send the address for editing with hostel in one controller this is my edit method for hostel detials

  public function edit($id)
    {
        //
        if ($id && ctype_digit($id)){
            $hostel = Hostel::find($id);
            // if the object is
            if ($hostel && $hostel instanceof Hostel){
                return view('cms/hostel/hostel_create', compact('hostel'))
            }
        }

    }
Activity icon

Replied to I Got This Error While Updating The Inputs Records

this is my controller

 public function update(Request $request , $id)
    {


        $owner_input = [
            'name'              => request()->input('name'),
            'email'             => request()->input('email'),
            'phone_number'      => request()->input('phone_number'),
            'fb'                => request()->input('fb'),
            'insta'             => request()->input('insta'),
            'linkedIn'          => request()->input('linkedIn'),
            'twitter'           => request()->input('twitter')
        ];


        $owners = Owner::find($id);
        $owners->update($owner_input ,$owners);
        return redirect()->route('owner.index');

    }
Activity icon

Started a new Conversation I Got This Error While Updating The Inputs Records

this is the errors

Argument 2 passed to Illuminate\Database\Eloquent\Model::update() must be of the type array, object given, called in
Activity icon

Replied to How To Call The OneToMany Relation In Laravel Blade

my blade codes

<div class="m-portlet">
                    <div class="m-portlet__body m-portlet__body--no-padding">
                        @if($hostels && count($hostels))
                        <div class="m-invoice-2">
                            @foreach($hostels as $hostel)
                                <div class="m-invoice__wrapper">
                                    <div class="m-invoice__head"
                                         style="background-image: url(../../assets/app/media/img//logos/bg-6.jpg);">
                                        <div class="m-invoice__container m-invoice__container--centered">
                                            <div class="m-invoice__logo">
                                                <a href="#">
                                                    <h1>{{$hostel->name}}</h1>
                                                </a>
                                               

                                            </div>
                                            <span class="m-invoice__desc">
                                                            <span>{{$hostel->email}}</span>
                                                            <span>{{$hostel->phone}}</span>
                                                        </span>
                                            <div class="m-invoice__items">
                                                <div class="m-invoice__item">
                                                    <span class="m-invoice__subtitle">اfacilites</span>
                                                    @foreach($facilities as $facility)
                                                        <span class="m-invoice__text">{{$facility->facility_name}}</span>
                                                    @endforeach
                                                </div>
                                                <div class="m-invoice__item">
                                                    <span class="m-invoice__subtitle">details</span>
                                                    <span class="m-invoice__text">{{$hostel->name}}</span>
                                                    @if($hostel->type = 0)
                                                        <span class="m-invoice__text"> male</span>
                                                    @else()
                                                        <span class="m-invoice__text">female</span>
                                                    @endif
                                                </div>
                                                <div class="m-invoice__item">
                                                    <span class="m-invoice__subtitle">address</span>

                                                        <span class="m-invoice__text">{{$hostel->address->province}}<br> state :</span>

                                                </div>
                                            </div>
                                        </div>
                                    </div>
                            


                                        <div class="col-md-2">

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

Replied to How To Call The OneToMany Relation In Laravel Blade

this solution has error my relation is hasOne

Trying to get property of non-object (View: C:\xampp\htdocs\hostel\resources\views\cms\hostel\hostel_index.blade.php
Activity icon

Replied to How To Call The OneToMany Relation In Laravel Blade

this is my blade but does not work

  @foreach($hostel->address as $addres)
                                                        <span class="m-invoice__text">{{$addres->province}}<br> state :{{$addres->state}}</span>
    @endforeach
Activity icon

Replied to How To Call The OneToMany Relation In Laravel Blade

i have read the doc help me with my code please

Activity icon

Started a new Conversation How To Call The OneToMany Relation In Laravel Blade

i want show the hostel address in laravel blade each hostel has one address how to call the hostel address in laravel blade this is my models and contrllers

class Address extends Model
{
    // Address belongs to hostel
    public function hostels()
    {
      return $this->belongsTo(Hostel::class);
    }
}

hostel model

class Hostel extends Model
{
  

    // hostel has one address
    public function addresses()
    {
      return $this->hasOne(Address::class);
    }
}

this is the controller


   public function index()
    {
        $hostels = Hostel::all();
        $facilities = Facility::all();
        $address = Address::all();
        $Rooms = Room::all();
        return view('cms.hostel.hostel_index', compact('hostels','facilities' , 'Rooms' , 'address'));
    }

Oct
15
3 months ago
Activity icon

Replied to How To Store Dropzone In Laravel

this is the dropzone form

 <form class="m-form m-form--fit m-form--label-align-rightx" method="post" action="{{route('hostel.store')}} " enctype="multipart/form-data">
               @csrf
               <div class="form-group m-form__group row">
                   <div class="col-lg-12 col-md-12 col-sm-12">
                       <div class="m-dropzone dropzone m-dropzone--success dz-clickable form-Controller" action="{{route('hostel.store')}}" id="m-dropzone-three"  name="file" >
                           <div class="m-dropzone__msg dz-message needsclick">
                               <h3 class="m-dropzone__msg-title">drop your photos here</h3>
                               <span class="m-dropzone__msg-desc">only photos</span>
                           </div>
                       </div>
                   </div>
               </div>
</form>
Activity icon

Replied to How To Store Dropzone In Laravel

i have allowed but the dropezone dose't work this is the dropzone javascript

var DropzoneDemo = {
   init: function () {
       Dropzone.options.mDropzoneOne = {
           paramName: "file",
           maxFiles: 1,
           maxFilesize: 5,
           addRemoveLinks: !0,
           accept: function (e, o) {
               "justinbieber.jpg" == e.name ? o("Naha, you don't.") : o()
           }
       }, Dropzone.options.mDropzoneTwo = {
           paramName: "file",
           maxFiles: 10,
           maxFilesize: 10,
           addRemoveLinks: !0,
           accept: function (e, o) {
               "justinbieber.jpg" == e.name ? o("Naha, you don't.") : o()
           }
       }, Dropzone.options.mDropzoneThree = {
           paramName: "file",
           maxFiles: 10,
           maxFilesize: 10,
           addRemoveLinks: !0,
           acceptedFiles: "image/*,application/pdf,.psd",
           accept: function (e, o) {
               "justinbieber.jpg" == e.name ? o("Naha, you don't.") : o()
           }
       }
   }
};
DropzoneDemo.init();
Oct
09
3 months ago
Activity icon

Started a new Conversation How To Store Dropzone In Laravel

i want store mulitple image in table by this dropzone this is my blade


            <!--begin::Form-->
            <form class="m-form m-form--fit m-form--label-align-rightx" method="post" action="{{route('hostel.store')}}">
                {{csrf_field()}}


                <div class="form-group m-form__group row">
                    <div class="col-lg-12 col-md-12 col-sm-12">
                        <div class="m-dropzone dropzone m-dropzone--success dz-clickable form-Controller" action="{{route('hostel.store')}}" id="m-dropzone-three"  name="file">
                            <div class="m-dropzone__msg dz-message needsclick">
                                <h3 class="m-dropzone__msg-title">عکس های خوابگاه را برای اپلود دراینجا بکشید ویا کیلیک کیند.</h3>
                                <span class="m-dropzone__msg-desc">تنها عکس قابل بارگذاری میباشد</span>
                            </div>
                        </div>
                    </div>
                </div>
</form>
Oct
08
3 months ago
Activity icon

Replied to Multi Select Dropdwon

thank you. the implode is storing multi item in one row cloud you help me with jason_encode foreach i got this error with my foreach Invalid argument supplied for foreach() this is my foreach loop

foreach ($request->facility as  $facility) {
  // code...
  $facility = new Facility;
  $facility->facility_name = json_encode($request->facility_name);
  $facility->save();
}
Activity icon

Replied to Multi Select Dropdwon

this is the table

  public function up()
    {
        Schema::create('facilities', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('facility_name');
            $table->unsignedInteger('hostel_id');
            $table->softDeletes();
            $table->timestamps();
        });
    }
Activity icon

Replied to Multi Select Dropdwon

this is my blade

      <div class="form-group m-form__group row">
                                    <label class=" col-lg-12 col-sm-12 " style="" >select the time Zone</label>
                                    <div class="col-md-12 col-sm-12">
                                      <select class="form-control m-select2" id="m_select2_3" name="facility_name[]" multiple="multiple">
                                        <optgroup label="Eastern Time Zone">
                                          <option value="CT">Connecticut</option>
                                          <option value="DE">Delaware</option>
                                          <option value="FL">Florida</option>
                                          <option value="GA">Georgia</option>
                                      
                                        </optgroup>
                                      </select>
                                    </div>
                                  </div>
                </div>

this is the controller

    public function store(Request $request)
    
    {
      foreach ($request->facility as  $facility) {
        // code...
        $facility = new Facility;
        $facility->facility_name = $request->facility_name;
        $facility->save();
      }
]

Activity icon

Started a new Conversation Multi Select Dropdwon

how to save the multi select values from dropdown in laravel