sami2500

Experience

500

0 Best Reply Awards

  • Member Since 1 Week Ago
  • 0 Lessons Completed
  • 0 Favorites

23rd June, 2018

sami2500 started a new conversation How To Fix This Error؟ • 49 minutes ago

SQLSTATE[22007]: Invalid datetime format: 1366 Incorrect string value: '\xD8\xA2\xD8\xB2\xD8\xA7...' for column 'msg' at row 1 (SQL: insert into `alerts` (`msg`, `ext_date`, `updated_at`, `created_at`) values (آزادی از جمله تجملاتی است که هرکسی توان کسب آن را ندارد., 2018-07-04, 2018-06-23 05:20:21, 2018-06-23 05:20:21))

16th June, 2018

sami2500 started a new conversation How To Receive Data With A Checkbox In Laravel • 1 week ago

Hello I have multiple checkboxes for each user I want to put a value in the database when clicking on the checkbox and if the tick is removed, the value will be zeroed in the database. How should I check it?

14th June, 2018

sami2500 started a new conversation Convert Date Persian To English • 1 week ago

Only converts a year to English Do not turn day and month

public function store(Request $request){
 
        request()->validate([
            'matn' => 'required',
            'datex' => 'required'
       ]);
        $arabic = ['٩', '٨', '٧', '٦', '٥', '٤', '٣', '٢', '١','٠'];
        $num = range(0, 9);
        $convert = str_replace($persian, $num, $request->datex);
        list($year, $month, $day) = explode('-', $convert);


       $user=Post::create([
            'menu_id'=> $request->name,
            'user_id'=>auth()->user()->id,
            'body'=>$request->matn,
            'Expiration_date' =>Verta::getGregorian($year, $month, $day)
       ]);

sami2500 started a new conversation Convert A String To A Integer • 1 week ago

The input date value is displayed as follows "2014-10-20" I want to be numeric so that the converting function can be registered in the table 2014-10-20

sami2500 started a new conversation Convert Persian Date To Milad Data • 1 week ago

Convert farsi date to milad Inside the database I want to convert the date of the entry into the milad in the database

sami2500 left a reply on Delete Post Automatically By Date • 1 week ago

What code do I write right for you? @Snapey

sami2500 started a new conversation Delete Post Automatically By Date • 1 week ago

I've added an additional field for my post I want to delete posts from the database when the expiration date is equal to today's date I wrote the following Is that okay?

        $namess=Post::where('Expiration_date','=',Carbon::now())->delete();
        $namess=Post::where('user_id', auth()->user()->id)->paginate(4);
        return view('user.post.maneger',compact('namess'));

12th June, 2018

sami2500 left a reply on Trying To Get Property Of Non Object • 1 week ago

@Cronix Just edit the role

sami2500 left a reply on Trying To Get Property Of Non Object • 1 week ago

@Snapey null return

sami2500 left a reply on Trying To Get Property Of Non Object • 1 week ago

@Snapey Yes - I have information in any database

sami2500 left a reply on Trying To Get Property Of Non Object • 1 week ago

@Snapey where is the problem from?

sami2500 left a reply on Trying To Get Property Of Non Object • 1 week ago

@Snapey This is my table

user

id----name---username

role

id-----types

roleuser

id---user_id---role_id----active

sami2500 left a reply on Trying To Get Property Of Non Object • 1 week ago

@Snapey I wrote the following model user

public function roleuser()
    {
        return $this->hasOne(Roleuser::class);
    }

model roleuser

    public function user()
    {
        return $this->belongsTo(User::class);
    }

sami2500 left a reply on Trying To Get Property Of Non Object • 1 week ago

@rin4ik error:

Trying to get property of non-object 

sami2500 left a reply on Trying To Get Property Of Non Object • 1 week ago

@Snapey problem : in view

$find->user->name

sami2500 left a reply on Trying To Get Property Of Non Object • 1 week ago

@Snapey where is the problem from

sami2500 left a reply on Trying To Get Property Of Non Object • 1 week ago

error: Trying to get property of non-object line: $find->user->name

sami2500 left a reply on Trying To Get Property Of Non Object • 1 week ago

@Snapey As follows

protected $table = 'user';

sami2500 left a reply on Trying To Get Property Of Non Object • 1 week ago

@Snapey This is my table user id----name---username role id-----types roleuser id---user_id---role_id----active The error below Trying to get property of non object

sami2500 left a reply on Trying To Get Property Of Non Object • 1 week ago

@Snapey I wrote the following model user

public function roleuser()
    {
        return $this->hasOne(Roleuser::class);
    }

model roleuser

    public function user()
    {
        return $this->belongsTo(User::class);//once paper for once a user
    }

sami2500 left a reply on Trying To Get Property Of Non Object • 1 week ago

@Snapey How to write this relationship in the model?

sami2500 started a new conversation Trying To Get Property Of Non Object • 1 week ago

controller:

  public function edit($id){
        $find=Roleuser::find($id);
        return view('admin.role.roleupdate',compact('find'));
    }

view:

$dd=$find->user_id;
  $pos=DB::table('users')->where('id','=',$dd)->pluck('name');
Edit Your Profile
Update

Want to change your profile photo? We pull from gravatar.com.